threads / patch / 9020

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

Subject: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf

## tl;dr

8 messages between Jul 13, 2007 and Jul 16, 2007. Diffs are folded; open one to read it.

replies: 7people: 5as markdown or json

Marius Storm-Olsen· Jul 13, 2007, 12:56 UTC · lore
 From 255ec32feb7525db8eef582eeed2b6e60be35ed8 Mon Sep 17 00:00:00 2001
From: Marius Storm-Olsen <marius@trolltech.com>
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.

Signed-off-by: Marius Storm-Olsen <marius@trolltech.com>
---
  contrib/fast-import/git-p4 |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)
Show changes to contrib/fast-import/git-p4 +5 −1
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index 54a05eb..746e0ca 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -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)):
-- 
1.5.2-GUB
Alex Riesen· Jul 13, 2007, 13:03 UTC · re: Marius Storm-Olsen · lore

Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf

On 7/13/07, Marius Storm-Olsen <marius@trolltech.com> wrote:
>      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.
   ...
Simon Hausmann· Jul 13, 2007, 13:33 UTC · re: Alex Riesen · lore

Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf

On Friday 13 July 2007 15:03:51 Alex Riesen wrote:
Show 13 quoted lines
> On 7/13/07, Marius Storm-Olsen <marius@trolltech.com> wrote:
> >      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.
>    ...
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
Shawn O. Pearce· Jul 15, 2007, 02:49 UTC · re: Simon Hausmann · lore

Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf

Simon Hausmann <simon@lst.de> wrote:
Show 9 quoted lines
> On Friday 13 July 2007 15:03:51 Alex Riesen wrote:
> > On 7/13/07, Marius Storm-Olsen <marius@trolltech.com> wrote:
> > >      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.

-- 
Shawn.
Junio C Hamano· Jul 15, 2007, 06:12 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf

"Shawn O. Pearce" <spearce@spearce.org> writes:
> 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.

Shawn O. Pearce· Jul 16, 2007, 05:35 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf

Junio C Hamano <gitster@pobox.com> wrote:
Show 11 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> 
> > 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?
-- 
Shawn.
Junio C Hamano· Jul 16, 2007, 07:00 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf

"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 8 quoted 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?
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.

Simon Hausmann· Jul 16, 2007, 18:30 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] Fix git-p4 on Windows to not use the Posix sysconf

On Monday 16 July 2007 07:35:11 Shawn O. Pearce wrote:
Show 24 quoted lines
> Junio C Hamano <gitster@pobox.com> wrote:
> > "Shawn O. Pearce" <spearce@spearce.org> writes:
> > > 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?

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

← back to recent threads