Show More
@@ -254,7 +254,7 b' class commandline(object):' | |||
|
254 | 254 | def postrun(self): |
|
255 | 255 | pass |
|
256 | 256 | |
|
257 | def _cmdline(self, cmd, *args, **kwargs): | |
|
257 | def _cmdline(self, cmd, closestdin, *args, **kwargs): | |
|
258 | 258 | cmdline = [self.command, cmd] + list(args) |
|
259 | 259 | for k, v in kwargs.iteritems(): |
|
260 | 260 | if len(k) == 1: |
@@ -271,16 +271,23 b' class commandline(object):' | |||
|
271 | 271 | cmdline = [util.shellquote(arg) for arg in cmdline] |
|
272 | 272 | if not self.ui.debugflag: |
|
273 | 273 | cmdline += ['2>', util.nulldev] |
|
274 | cmdline += ['<', util.nulldev] | |
|
274 | if closestdin: | |
|
275 | cmdline += ['<', util.nulldev] | |
|
275 | 276 | cmdline = ' '.join(cmdline) |
|
276 | 277 | return cmdline |
|
277 | 278 | |
|
278 | 279 | def _run(self, cmd, *args, **kwargs): |
|
279 |
|
|
|
280 | return self._dorun(util.popen, cmd, True, *args, **kwargs) | |
|
281 | ||
|
282 | def _run2(self, cmd, *args, **kwargs): | |
|
283 | return self._dorun(util.popen2, cmd, False, *args, **kwargs) | |
|
284 | ||
|
285 | def _dorun(self, openfunc, cmd, closestdin, *args, **kwargs): | |
|
286 | cmdline = self._cmdline(cmd, closestdin, *args, **kwargs) | |
|
280 | 287 | self.ui.debug('running: %s\n' % (cmdline,)) |
|
281 | 288 | self.prerun() |
|
282 | 289 | try: |
|
283 |
return |
|
|
290 | return openfunc(cmdline) | |
|
284 | 291 | finally: |
|
285 | 292 | self.postrun() |
|
286 | 293 | |
@@ -336,8 +343,9 b' class commandline(object):' | |||
|
336 | 343 | self._argmax = self._argmax / 2 - 1 |
|
337 | 344 | return self._argmax |
|
338 | 345 | |
|
339 | def limit_arglist(self, arglist, cmd, *args, **kwargs): | |
|
340 |
|
|
|
346 | def limit_arglist(self, arglist, cmd, closestdin, *args, **kwargs): | |
|
347 | cmdlen = len(self._cmdline(cmd, closestdin, *args, **kwargs)) | |
|
348 | limit = self.getargmax() - cmdlen | |
|
341 | 349 | bytes = 0 |
|
342 | 350 | fl = [] |
|
343 | 351 | for fn in arglist: |
@@ -353,7 +361,7 b' class commandline(object):' | |||
|
353 | 361 | yield fl |
|
354 | 362 | |
|
355 | 363 | def xargs(self, arglist, cmd, *args, **kwargs): |
|
356 | for l in self.limit_arglist(arglist, cmd, *args, **kwargs): | |
|
364 | for l in self.limit_arglist(arglist, cmd, True, *args, **kwargs): | |
|
357 | 365 | self.run0(cmd, *(list(args) + l), **kwargs) |
|
358 | 366 | |
|
359 | 367 | class mapfile(dict): |
General Comments 0
You need to be logged in to leave comments.
Login now