Show More
@@ -330,7 +330,10 b' def reposetup(ui, repo):' | |||||
330 | for f in sorted(ctx.added() + ctx.modified()): |
|
330 | for f in sorted(ctx.added() + ctx.modified()): | |
331 | if not self._eolfile(f): |
|
331 | if not self._eolfile(f): | |
332 | continue |
|
332 | continue | |
333 |
|
|
333 | try: | |
|
334 | data = ctx[f].data() | |||
|
335 | except IOError: | |||
|
336 | continue | |||
334 | if util.binary(data): |
|
337 | if util.binary(data): | |
335 | # We should not abort here, since the user should |
|
338 | # We should not abort here, since the user should | |
336 | # be able to say "** = native" to automatically |
|
339 | # be able to say "** = native" to automatically |
@@ -7,7 +7,7 b'' | |||||
7 |
|
7 | |||
8 | from i18n import _ |
|
8 | from i18n import _ | |
9 | import struct |
|
9 | import struct | |
10 | import sys |
|
10 | import sys, os | |
11 | import dispatch, encoding, util |
|
11 | import dispatch, encoding, util | |
12 |
|
12 | |||
13 | logfile = None |
|
13 | logfile = None | |
@@ -131,6 +131,7 b' class server(object):' | |||||
131 | based stream to stdout. |
|
131 | based stream to stdout. | |
132 | """ |
|
132 | """ | |
133 | def __init__(self, ui, repo, mode): |
|
133 | def __init__(self, ui, repo, mode): | |
|
134 | self.cwd = os.getcwd() | |||
134 | self.ui = ui |
|
135 | self.ui = ui | |
135 |
|
136 | |||
136 | logpath = ui.config("cmdserver", "log", None) |
|
137 | logpath = ui.config("cmdserver", "log", None) | |
@@ -183,11 +184,15 b' class server(object):' | |||||
183 | self.repo.baseui = copiedui |
|
184 | self.repo.baseui = copiedui | |
184 | self.repo.ui = self.repo.dirstate._ui = self.repoui.copy() |
|
185 | self.repo.ui = self.repo.dirstate._ui = self.repoui.copy() | |
185 |
|
186 | |||
186 | req = dispatch.request(args, copiedui, self.repo, self.cin, |
|
187 | req = dispatch.request(args[:], copiedui, self.repo, self.cin, | |
187 | self.cout, self.cerr) |
|
188 | self.cout, self.cerr) | |
188 |
|
189 | |||
189 | ret = dispatch.dispatch(req) or 0 # might return None |
|
190 | ret = dispatch.dispatch(req) or 0 # might return None | |
190 |
|
191 | |||
|
192 | # restore old cwd | |||
|
193 | if '--cwd' in args: | |||
|
194 | os.chdir(self.cwd) | |||
|
195 | ||||
191 | self.cresult.write(struct.pack('>i', int(ret))) |
|
196 | self.cresult.write(struct.pack('>i', int(ret))) | |
192 |
|
197 | |||
193 | def getencoding(self): |
|
198 | def getencoding(self): |
@@ -633,7 +633,7 b' def _dispatch(req):' | |||||
633 | cmdpats = args[:] |
|
633 | cmdpats = args[:] | |
634 | if cmd not in commands.norepo.split(): |
|
634 | if cmd not in commands.norepo.split(): | |
635 | # use the repo from the request only if we don't have -R |
|
635 | # use the repo from the request only if we don't have -R | |
636 | if not rpath: |
|
636 | if not rpath and not cwd: | |
637 | repo = req.repo |
|
637 | repo = req.repo | |
638 |
|
638 | |||
639 | if repo: |
|
639 | if repo: |
@@ -8,7 +8,7 b'' | |||||
8 | from i18n import _ |
|
8 | from i18n import _ | |
9 | import util, error, osutil, revset, similar |
|
9 | import util, error, osutil, revset, similar | |
10 | import match as matchmod |
|
10 | import match as matchmod | |
11 | import os, errno, stat, sys, glob |
|
11 | import os, errno, re, stat, sys, glob | |
12 |
|
12 | |||
13 | def checkfilename(f): |
|
13 | def checkfilename(f): | |
14 | '''Check that the filename f is an acceptable filename for a tracked file''' |
|
14 | '''Check that the filename f is an acceptable filename for a tracked file''' |
@@ -168,6 +168,8 b' def _verify(repo):' | |||||
168 | for c, m in sorted([(c, m) for m in mflinkrevs |
|
168 | for c, m in sorted([(c, m) for m in mflinkrevs | |
169 | for c in mflinkrevs[m]]): |
|
169 | for c in mflinkrevs[m]]): | |
170 | count += 1 |
|
170 | count += 1 | |
|
171 | if m == nullid: | |||
|
172 | continue | |||
171 | ui.progress(_('crosschecking'), count, total=total) |
|
173 | ui.progress(_('crosschecking'), count, total=total) | |
172 | err(c, _("changeset refers to unknown manifest %s") % short(m)) |
|
174 | err(c, _("changeset refers to unknown manifest %s") % short(m)) | |
173 | mflinkrevs = None # del is bad here due to scope issues |
|
175 | mflinkrevs = None # del is bad here due to scope issues |
@@ -120,6 +120,15 b' diff -r 000000000000 -r c103a3dec114 a' | |||||
120 | runcommand(server, ['import', '-'], input=cStringIO.StringIO(patch)) |
|
120 | runcommand(server, ['import', '-'], input=cStringIO.StringIO(patch)) | |
121 | runcommand(server, ['log']) |
|
121 | runcommand(server, ['log']) | |
122 |
|
122 | |||
|
123 | def cwd(server): | |||
|
124 | """ check that --cwd doesn't persist between requests """ | |||
|
125 | readchannel(server) | |||
|
126 | os.mkdir('foo') | |||
|
127 | open('foo/bar', 'w').write('a') | |||
|
128 | runcommand(server, ['--cwd', 'foo', 'st', 'bar']) | |||
|
129 | runcommand(server, ['st', 'foo/bar']) | |||
|
130 | os.remove('foo/bar') | |||
|
131 | ||||
123 | if __name__ == '__main__': |
|
132 | if __name__ == '__main__': | |
124 | os.system('hg init') |
|
133 | os.system('hg init') | |
125 |
|
134 | |||
@@ -128,3 +137,4 b" if __name__ == '__main__':" | |||||
128 | check(checkruncommand) |
|
137 | check(checkruncommand) | |
129 | check(inputeof) |
|
138 | check(inputeof) | |
130 | check(serverinput) |
|
139 | check(serverinput) | |
|
140 | check(cwd) |
General Comments 0
You need to be logged in to leave comments.
Login now