summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9f90c73)
raw | patch | inline | side by side (parent: 9f90c73)
author | Scott Lamb <slamb@slamb.org> | |
Mon, 16 Jul 2007 03:58:11 +0000 (20:58 -0700) | ||
committer | Simon Hausmann <simon@lst.de> | |
Tue, 17 Jul 2007 06:35:33 +0000 (08:35 +0200) |
This approach, suggested by Alex Riesen, bypasses the need for xargs-style
argument list handling. The handling in question looks broken in a corner
case with SC_ARG_MAX=4096 and final argument over 96 characters.
Signed-off-by: Scott Lamb <slamb@slamb.org>
Signed-off-by: Simon Hausmann <simon@lst.de>
argument list handling. The handling in question looks broken in a corner
case with SC_ARG_MAX=4096 and final argument over 96 characters.
Signed-off-by: Scott Lamb <slamb@slamb.org>
Signed-off-by: Simon Hausmann <simon@lst.de>
contrib/fast-import/git-p4 | patch | blob | history |
index d93e6561554a1592afdc70833d9cac51d6ad55b6..54053e3f3d404567ce4b5734b2c7e94cdf666645 100755 (executable)
if not files:
return
- # We cannot put all the files on the command line
- # OS have limitations on the max lenght of arguments
- # 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/
- if (self.isWindows):
- argmax = 2000
- else:
- argmax = min(4000, os.sysconf('SC_ARG_MAX'))
-
- chunk = ''
- filedata = []
- for i in xrange(len(files)):
- f = files[i]
- chunk += '"%s#%s" ' % (f['path'], f['rev'])
- if len(chunk) > argmax or i == len(files)-1:
- data = p4CmdList('print %s' % chunk)
- if "p4ExitCode" in data[0]:
- die("Problems executing p4. Error: [%d]." % (data[0]['p4ExitCode']));
- filedata.extend(data)
- chunk = ''
+ filedata = p4CmdList('-x - print',
+ stdin='\n'.join(['%s#%s' % (f['path'], f['rev'])
+ for f in files]),
+ stdin_mode='w+')
+ if "p4ExitCode" in filedata[0]:
+ die("Problems executing p4. Error: [%d]."
+ % (filedata[0]['p4ExitCode']));
j = 0;
contents = {}