--- a/hgext/eol.py Wed Jul 13 19:23:33 2011 +0200
+++ b/hgext/eol.py Wed Jul 13 19:24:54 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 Wed Jul 13 19:23:33 2011 +0200
+++ b/mercurial/commandserver.py Wed Jul 13 19:24:54 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 Wed Jul 13 19:23:33 2011 +0200
+++ b/mercurial/dispatch.py Wed Jul 13 19:24:54 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 Wed Jul 13 19:23:33 2011 +0200
+++ b/mercurial/scmutil.py Wed Jul 13 19:24:54 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 Wed Jul 13 19:23:33 2011 +0200
+++ b/mercurial/verify.py Wed Jul 13 19:24:54 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 Wed Jul 13 19:23:33 2011 +0200
+++ b/tests/test-commandserver.py Wed Jul 13 19:24:54 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 Wed Jul 13 19:23:33 2011 +0200
+++ b/tests/test-commandserver.py.out Wed Jul 13 19:24:54 2011 -0500
@@ -36,3 +36,5 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: 1
+? bar
+? foo/bar