merge with stable
authorMatt Mackall <mpm@selenic.com>
Wed, 13 Jul 2011 16:29:28 -0500
changeset 14866 ad6a58581ecd
parent 14860 67add0f24f83 (current diff)
parent 14865 eb914541a950 (diff)
child 14871 3a65e3f34b8c
merge with stable
hgext/eol.py
mercurial/dispatch.py
--- a/hgext/eol.py	Tue Jul 12 16:36:34 2011 -0500
+++ b/hgext/eol.py	Wed Jul 13 16:29:28 2011 -0500
@@ -330,7 +330,10 @@
             for f in sorted(ctx.added() + ctx.modified()):
                 if not self._eolfile(f):
                     continue
-                data = ctx[f].data()
+                try:
+                    data = ctx[f].data()
+                except IOError:
+                    continue
                 if util.binary(data):
                     # We should not abort here, since the user should
                     # be able to say "** = native" to automatically
--- a/mercurial/commandserver.py	Tue Jul 12 16:36:34 2011 -0500
+++ b/mercurial/commandserver.py	Wed Jul 13 16:29:28 2011 -0500
@@ -7,7 +7,7 @@
 
 from i18n import _
 import struct
-import sys
+import sys, os
 import dispatch, encoding, util
 
 logfile = None
@@ -131,6 +131,7 @@
     based stream to stdout.
     """
     def __init__(self, ui, repo, mode):
+        self.cwd = os.getcwd()
         self.ui = ui
 
         logpath = ui.config("cmdserver", "log", None)
@@ -183,11 +184,15 @@
         self.repo.baseui = copiedui
         self.repo.ui = self.repo.dirstate._ui = self.repoui.copy()
 
-        req = dispatch.request(args, copiedui, self.repo, self.cin,
+        req = dispatch.request(args[:], copiedui, self.repo, self.cin,
                                self.cout, self.cerr)
 
         ret = dispatch.dispatch(req) or 0 # might return None
 
+        # restore old cwd
+        if '--cwd' in args:
+            os.chdir(self.cwd)
+
         self.cresult.write(struct.pack('>i', int(ret)))
 
     def getencoding(self):
--- a/mercurial/dispatch.py	Tue Jul 12 16:36:34 2011 -0500
+++ b/mercurial/dispatch.py	Wed Jul 13 16:29:28 2011 -0500
@@ -633,7 +633,7 @@
     cmdpats = args[:]
     if cmd not in commands.norepo.split():
         # use the repo from the request only if we don't have -R
-        if not rpath:
+        if not rpath and not cwd:
             repo = req.repo
 
         if repo:
--- a/mercurial/scmutil.py	Tue Jul 12 16:36:34 2011 -0500
+++ b/mercurial/scmutil.py	Wed Jul 13 16:29:28 2011 -0500
@@ -8,7 +8,7 @@
 from i18n import _
 import util, error, osutil, revset, similar
 import match as matchmod
-import os, errno, stat, sys, glob
+import os, errno, re, stat, sys, glob
 
 def checkfilename(f):
     '''Check that the filename f is an acceptable filename for a tracked file'''
--- a/mercurial/verify.py	Tue Jul 12 16:36:34 2011 -0500
+++ b/mercurial/verify.py	Wed Jul 13 16:29:28 2011 -0500
@@ -168,6 +168,8 @@
         for c, m in sorted([(c, m) for m in mflinkrevs
                             for c in mflinkrevs[m]]):
             count += 1
+            if m == nullid:
+                continue
             ui.progress(_('crosschecking'), count, total=total)
             err(c, _("changeset refers to unknown manifest %s") % short(m))
         mflinkrevs = None # del is bad here due to scope issues
--- a/tests/test-commandserver.py	Tue Jul 12 16:36:34 2011 -0500
+++ b/tests/test-commandserver.py	Wed Jul 13 16:29:28 2011 -0500
@@ -120,6 +120,15 @@
     runcommand(server, ['import', '-'], input=cStringIO.StringIO(patch))
     runcommand(server, ['log'])
 
+def cwd(server):
+    """ check that --cwd doesn't persist between requests """
+    readchannel(server)
+    os.mkdir('foo')
+    open('foo/bar', 'w').write('a')
+    runcommand(server, ['--cwd', 'foo', 'st', 'bar'])
+    runcommand(server, ['st', 'foo/bar'])
+    os.remove('foo/bar')
+
 if __name__ == '__main__':
     os.system('hg init')
 
@@ -128,3 +137,4 @@
     check(checkruncommand)
     check(inputeof)
     check(serverinput)
+    check(cwd)
--- a/tests/test-commandserver.py.out	Tue Jul 12 16:36:34 2011 -0500
+++ b/tests/test-commandserver.py.out	Wed Jul 13 16:29:28 2011 -0500
@@ -36,3 +36,5 @@
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     1
 
+? bar
+? foo/bar