Skip to contentSkip to conversation

Fix git-p4 on Windows to not use the Posix sysconf

PATCH In review Marius Storm-Olsen 5 participants 8 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix git-p4 on Windows to not use the Posix sysconf

From 255ec32feb7525db8eef582eeed2b6e60be35ed8 Mon Sep 17 00:00:00 2001
From: Marius Storm-Olsen <[email protected]>
Date: Fri, 13 Jul 2007 14:39:05 +0200
Subject: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf function.

Add condition for Windows, since it doesn't support the os.sysconf module. We hardcode the commandline limit to 2K, as that should work on most Windows platforms.

---
 contrib/fast-import/git-p4 |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
contrib/fast-import/git-p4 +0 -0
index 54a05eb..746e0ca 100755
@@ -717,7 +717,11 @@ class P4Sync(Command):
         # POSIX says it's 4096 bytes, default for Linux seems to be 

130 K.

         # and all OS from the table below seems to be higher than POSIX.
         # See http://www.in-ulm.de/~mascheck/various/argmax/
-        argmax = min(4000, os.sysconf('SC_ARG_MAX'))
+        if (self.isWindows):
+            argmax = 2000
+        else:
+            argmax = min(4000, os.sysconf('SC_ARG_MAX'))
+
         chunk = ''
         filedata = []
         for i in xrange(len(files)):
Signature · 1 line
1.5.2-GUB
#1 lore raw
Quoted 1 line · Marius Storm-Olsen
     argmax = min(4000, os.sysconf('SC_ARG_MAX'))

I wonder why the code in question does not use "-x"? I use it git-p4-import and haven't seen the limit yet. I.e.:

  $ ls |p4 -x - print -q
  $ p4 help usage
  ...
  The -x flag instructs p4 to read arguments, one per line, from the
  named file.  If the file is named '-', then standard input is read.
  ...
#2 lore raw
Quoted 7 lines · On Friday 13 July 2007 15:03:51 Alex Riesen wrote:
Quoted 1 line · Marius Storm-Olsen
     argmax = min(4000, os.sysconf('SC_ARG_MAX'))

I wonder why the code in question does not use "-x"? I use it git-p4-import and haven't seen the limit yet. I.e.:

Quoted 6 lines
   $ ls |p4 -x - print -q
   $ p4 help usage
   ...
   The -x flag instructs p4 to read arguments, one per line, from the
   named file.  If the file is named '-', then standard input is read.
   ...

Good idea!

I still think the patch makes sense as stop-gap for 1.5.3 though, because without it git-p4 doesn't work at all on Windows.

Simon

#3 lore raw
Quoted 9 lines · Simon Hausmann
Quoted 5 lines · On Friday 13 July 2007 15:03:51 Alex Riesen wrote:
Quoted 1 line · Marius Storm-Olsen
     argmax = min(4000, os.sysconf('SC_ARG_MAX'))

I wonder why the code in question does not use "-x"? I use it git-p4-import and haven't seen the limit yet.

I still think the patch makes sense as stop-gap for 1.5.3 though, because without it git-p4 doesn't work at all on Windows.

Thanks. Marius' patch was whitespace damaged in the context lines, but it was easily repaired. I've got a couple of other small items in my fastimport repository that I'm going to ask Junio to include in 1.5.3 shortly.

Signature · 1 line
Shawn.
#4 lore raw
Quoted 4 lines · Shawn O. Pearce

Thanks. Marius' patch was whitespace damaged in the context lines, but it was easily repaired. I've got a couple of other small items in my fastimport repository that I'm going to ask Junio to include in 1.5.3 shortly.

Thanks for taking care of this. I have pulled gfi master into 'master'. Perhaps we would want to tag -rc2 this weekend, run with it for a week or so and see if we need -rc3 before the final.

#5 lore raw
Quoted 11 lines · Junio C Hamano
Quoted 4 lines · Shawn O. Pearce

Thanks. Marius' patch was whitespace damaged in the context lines, but it was easily repaired. I've got a couple of other small items in my fastimport repository that I'm going to ask Junio to include in 1.5.3 shortly.

Thanks for taking care of this. I have pulled gfi master into 'master'. Perhaps we would want to tag -rc2 this weekend, run with it for a week or so and see if we need -rc3 before the final.

I'm not entirely sure how we're going to handle the git-p4 patches; I see there's already another set available to use '-x -' to avoid command line length problems.

I'm more than happy to play patch monkey and ship them through the fastimport repository, but since I'm not a p4 user that offers little value to the process, other than perhaps to save you a little time.

Simon suggested he might setup a git fork on repo.or.cz himself, at which point you could pull the patches for git-p4 directly from him.

Simon?

Signature · 1 line
Shawn.
#6 lore raw
Quoted 16 lines · On Monday 16 July 2007 07:35:11 Shawn O. Pearce wrote:
Quoted 10 lines · Junio C Hamano
Quoted 4 lines · Shawn O. Pearce

Thanks. Marius' patch was whitespace damaged in the context lines, but it was easily repaired. I've got a couple of other small items in my fastimport repository that I'm going to ask Junio to include in 1.5.3 shortly.

Thanks for taking care of this. I have pulled gfi master into 'master'. Perhaps we would want to tag -rc2 this weekend, run with it for a week or so and see if we need -rc3 before the final.

I'm not entirely sure how we're going to handle the git-p4 patches; I see there's already another set available to use '-x -' to avoid command line length problems.

Quoted 8 lines

I'm more than happy to play patch monkey and ship them through the fastimport repository, but since I'm not a p4 user that offers little value to the process, other than perhaps to save you a little time.

Simon suggested he might setup a git fork on repo.or.cz himself, at which point you could pull the patches for git-p4 directly from him.

Simon?

Yes, sounds good to me. I have tried creating a git clone on repo.or.cz but somehow I can't edit the project. Need to find pasky on IRC to help me :). Until then I have created a repository on freedesktop.org:

git://people.freedesktop.org/~hausmann/git-p4
http://gitweb.freedesktop.org/?p=users/hausmann/git-p4;a=summary

Simon

#7 lore raw
In reply to Shawn O. Pearce
Quoted 8 lines · Shawn O. Pearce

I'm more than happy to play patch monkey and ship them through the fastimport repository, but since I'm not a p4 user that offers little value to the process, other than perhaps to save you a little time.

Simon suggested he might setup a git fork on repo.or.cz himself, at which point you could pull the patches for git-p4 directly from him.

Simon?

Pulling from Simon sounds the sanest.

How big is the population that can help testing and cheering-on git-p4 on this list? If we can have git-p4 subgroup that would be wonderful, as I do not interoperate with p4 myself.