changeset 17417:072209ae4ddb stable 2.3.1

merge with crew
author Matt Mackall <mpm@selenic.com>
date Sat, 01 Sep 2012 12:48:08 -0500
parents 97f1f22c2dba (diff) 59b6a7002d9f (current diff)
children 928f900894ba
files
diffstat 5 files changed, 46 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/common.py	Sat Sep 01 14:31:31 2012 +0200
+++ b/hgext/convert/common.py	Sat Sep 01 12:48:08 2012 -0500
@@ -5,8 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import base64, errno
-import os
+import base64, errno, subprocess, os
 import cPickle as pickle
 from mercurial import util
 from mercurial.i18n import _
@@ -260,7 +259,7 @@
     def postrun(self):
         pass
 
-    def _cmdline(self, cmd, closestdin, *args, **kwargs):
+    def _cmdline(self, cmd, *args, **kwargs):
         cmdline = [self.command, cmd] + list(args)
         for k, v in kwargs.iteritems():
             if len(k) == 1:
@@ -277,19 +276,22 @@
         cmdline = [util.shellquote(arg) for arg in cmdline]
         if not self.ui.debugflag:
             cmdline += ['2>', os.devnull]
-        if closestdin:
-            cmdline += ['<', os.devnull]
         cmdline = ' '.join(cmdline)
         return cmdline
 
     def _run(self, cmd, *args, **kwargs):
-        return self._dorun(util.popen, cmd, True, *args, **kwargs)
+        def popen(cmdline):
+            p = subprocess.Popen(cmdline, shell=True, bufsize=-1,
+                    close_fds=util.closefds,
+                    stdout=subprocess.PIPE)
+            return p
+        return self._dorun(popen, cmd, *args, **kwargs)
 
     def _run2(self, cmd, *args, **kwargs):
-        return self._dorun(util.popen2, cmd, False, *args, **kwargs)
+        return self._dorun(util.popen2, cmd, *args, **kwargs)
 
-    def _dorun(self, openfunc, cmd, closestdin, *args, **kwargs):
-        cmdline = self._cmdline(cmd, closestdin, *args, **kwargs)
+    def _dorun(self, openfunc, cmd,  *args, **kwargs):
+        cmdline = self._cmdline(cmd, *args, **kwargs)
         self.ui.debug('running: %s\n' % (cmdline,))
         self.prerun()
         try:
@@ -298,16 +300,17 @@
             self.postrun()
 
     def run(self, cmd, *args, **kwargs):
-        fp = self._run(cmd, *args, **kwargs)
-        output = fp.read()
+        p = self._run(cmd, *args, **kwargs)
+        output = p.communicate()[0]
         self.ui.debug(output)
-        return output, fp.close()
+        return output, p.returncode
 
     def runlines(self, cmd, *args, **kwargs):
-        fp = self._run(cmd, *args, **kwargs)
-        output = fp.readlines()
+        p = self._run(cmd, *args, **kwargs)
+        output = p.stdout.readlines()
+        p.wait()
         self.ui.debug(''.join(output))
-        return output, fp.close()
+        return output, p.returncode
 
     def checkexit(self, status, output=''):
         if status:
@@ -345,8 +348,8 @@
         # (and make happy Windows shells while doing this).
         return argmax // 2 - 1
 
-    def limit_arglist(self, arglist, cmd, closestdin, *args, **kwargs):
-        cmdlen = len(self._cmdline(cmd, closestdin, *args, **kwargs))
+    def _limit_arglist(self, arglist, cmd, *args, **kwargs):
+        cmdlen = len(self._cmdline(cmd, *args, **kwargs))
         limit = self.argmax - cmdlen
         bytes = 0
         fl = []
@@ -363,7 +366,7 @@
             yield fl
 
     def xargs(self, arglist, cmd, *args, **kwargs):
-        for l in self.limit_arglist(arglist, cmd, True, *args, **kwargs):
+        for l in self._limit_arglist(arglist, cmd, *args, **kwargs):
             self.run0(cmd, *(list(args) + l), **kwargs)
 
 class mapfile(dict):
--- a/hgext/convert/darcs.py	Sat Sep 01 14:31:31 2012 +0200
+++ b/hgext/convert/darcs.py	Sat Sep 01 12:48:08 2012 -0500
@@ -104,9 +104,10 @@
         # possible, etree will still raise an exception if any
         # non-printable characters are in the XML changelog.
         parser = XMLParser(encoding='latin-1')
-        fp = self._run(cmd, **kwargs)
-        etree.parse(fp, parser=parser)
-        self.checkexit(fp.close())
+        p = self._run(cmd, **kwargs)
+        etree.parse(p.stdout, parser=parser)
+        p.wait()
+        self.checkexit(p.returncode)
         return etree.getroot()
 
     def format(self):
--- a/hgext/largefiles/localstore.py	Sat Sep 01 14:31:31 2012 +0200
+++ b/hgext/largefiles/localstore.py	Sat Sep 01 12:48:08 2012 -0500
@@ -33,8 +33,12 @@
         lfutil.link(lfutil.storepath(self.repo, hash),
                 lfutil.storepath(self.remote, hash))
 
-    def exists(self, hash):
-        return lfutil.instore(self.remote, hash)
+    def exists(self, hashes):
+        retval = {}
+        for hash in hashes:
+            retval[hash] = lfutil.instore(self.remote, hash)
+        return retval
+
 
     def _getfile(self, tmpfile, filename, hash):
         if lfutil.instore(self.remote, hash):
--- a/mercurial/repair.py	Sat Sep 01 14:31:31 2012 +0200
+++ b/mercurial/repair.py	Sat Sep 01 12:48:08 2012 -0500
@@ -111,9 +111,8 @@
         saverevs.difference_update(descendants)
     savebases = [cl.node(r) for r in saverevs]
     stripbases = [cl.node(r) for r in tostrip]
-    rset = ' or '.join([str(r) for r in tostrip])
-    newbmtarget = repo.revs('sort(heads(ancestors(%r) - (%r)), -rev)',
-                            rset, rset)
+    newbmtarget = repo.revs('sort(heads((::%ld) - (%ld)), -rev)',
+                            tostrip, tostrip)
     if newbmtarget:
         newbmtarget = newbmtarget[0]
     else:
--- a/tests/test-largefiles.t	Sat Sep 01 14:31:31 2012 +0200
+++ b/tests/test-largefiles.t	Sat Sep 01 12:48:08 2012 -0500
@@ -1141,6 +1141,19 @@
   A f1
   $ cd ..
 
+largefiles can be pushed locally (issue3583)
+  $ hg init dest
+  $ cd r4
+  $ hg push ../dest
+  pushing to ../dest
+  searching for changes
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  $ cd ..
+
 #if serve
   $ hg serve -R r4 -d -p $HGPORT2 --pid-file hg.pid
   $ cat hg.pid >> $DAEMON_PIDS