Show More
@@ -100,7 +100,8 b' def snapshot(ui, repo, files, node, tmpr' | |||||
100 | if 'x' in fctx.flags(): |
|
100 | if 'x' in fctx.flags(): | |
101 | util.set_flags(dest, False, True) |
|
101 | util.set_flags(dest, False, True) | |
102 | if node is None: |
|
102 | if node is None: | |
103 |
fns_and_mtime.append((dest, repo.wjoin(fn), |
|
103 | fns_and_mtime.append((dest, repo.wjoin(fn), | |
|
104 | os.lstat(dest).st_mtime)) | |||
104 | return dirname, fns_and_mtime |
|
105 | return dirname, fns_and_mtime | |
105 |
|
106 | |||
106 | def dodiff(ui, repo, diffcmd, diffopts, pats, opts): |
|
107 | def dodiff(ui, repo, diffcmd, diffopts, pats, opts): | |
@@ -222,7 +223,7 b' def dodiff(ui, repo, diffcmd, diffopts, ' | |||||
222 | util.system(cmdline, cwd=tmproot) |
|
223 | util.system(cmdline, cwd=tmproot) | |
223 |
|
224 | |||
224 | for copy_fn, working_fn, mtime in fns_and_mtime: |
|
225 | for copy_fn, working_fn, mtime in fns_and_mtime: | |
225 |
if os. |
|
226 | if os.lstat(copy_fn).st_mtime != mtime: | |
226 | ui.debug('file changed while diffing. ' |
|
227 | ui.debug('file changed while diffing. ' | |
227 | 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn)) |
|
228 | 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn)) | |
228 | util.copyfile(copy_fn, working_fn) |
|
229 | util.copyfile(copy_fn, working_fn) |
@@ -834,7 +834,7 b' class queue(object):' | |||||
834 | raise util.Abort(_("local changes found")) |
|
834 | raise util.Abort(_("local changes found")) | |
835 | return m, a, r, d |
|
835 | return m, a, r, d | |
836 |
|
836 | |||
837 | _reserved = ('series', 'status', 'guards') |
|
837 | _reserved = ('series', 'status', 'guards', '.', '..') | |
838 | def check_reserved_name(self, name): |
|
838 | def check_reserved_name(self, name): | |
839 | if (name in self._reserved or name.startswith('.hg') |
|
839 | if (name in self._reserved or name.startswith('.hg') | |
840 | or name.startswith('.mq') or '#' in name or ':' in name): |
|
840 | or name.startswith('.mq') or '#' in name or ':' in name): |
@@ -27,7 +27,7 b' You can discover Zeroconf-enabled reposi' | |||||
27 | import socket, time, os |
|
27 | import socket, time, os | |
28 |
|
28 | |||
29 | import Zeroconf |
|
29 | import Zeroconf | |
30 | from mercurial import ui, hg, encoding, util |
|
30 | from mercurial import ui, hg, encoding, util, dispatch | |
31 | from mercurial import extensions |
|
31 | from mercurial import extensions | |
32 | from mercurial.hgweb import hgweb_mod |
|
32 | from mercurial.hgweb import hgweb_mod | |
33 | from mercurial.hgweb import hgwebdir_mod |
|
33 | from mercurial.hgweb import hgwebdir_mod | |
@@ -166,6 +166,18 b' def defaultdest(orig, source):' | |||||
166 | return name.encode(encoding.encoding) |
|
166 | return name.encode(encoding.encoding) | |
167 | return orig(source) |
|
167 | return orig(source) | |
168 |
|
168 | |||
|
169 | def cleanupafterdispatch(orig, ui, options, cmd, cmdfunc): | |||
|
170 | try: | |||
|
171 | return orig(ui, options, cmd, cmdfunc) | |||
|
172 | finally: | |||
|
173 | # we need to call close() on the server to notify() the various | |||
|
174 | # threading Conditions and allow the background threads to exit | |||
|
175 | global server | |||
|
176 | if server: | |||
|
177 | server.close() | |||
|
178 | ||||
|
179 | extensions.wrapfunction(dispatch, '_runcommand', cleanupafterdispatch) | |||
|
180 | ||||
169 | extensions.wrapfunction(ui.ui, 'config', config) |
|
181 | extensions.wrapfunction(ui.ui, 'config', config) | |
170 | extensions.wrapfunction(ui.ui, 'configitems', configitems) |
|
182 | extensions.wrapfunction(ui.ui, 'configitems', configitems) | |
171 | extensions.wrapfunction(hg, 'defaultdest', defaultdest) |
|
183 | extensions.wrapfunction(hg, 'defaultdest', defaultdest) |
@@ -10,6 +10,7 b' import stat, subprocess, tarfile' | |||||
10 | from i18n import _ |
|
10 | from i18n import _ | |
11 | import config, util, node, error, cmdutil |
|
11 | import config, util, node, error, cmdutil | |
12 | hg = None |
|
12 | hg = None | |
|
13 | propertycache = util.propertycache | |||
13 |
|
14 | |||
14 | nullstate = ('', '', 'empty') |
|
15 | nullstate = ('', '', 'empty') | |
15 |
|
16 | |||
@@ -521,8 +522,18 b' class svnsubrepo(abstractsubrepo):' | |||||
521 | self._ui = ctx._repo.ui |
|
522 | self._ui = ctx._repo.ui | |
522 |
|
523 | |||
523 | def _svncommand(self, commands, filename=''): |
|
524 | def _svncommand(self, commands, filename=''): | |
524 | path = os.path.join(self._ctx._repo.origroot, self._path, filename) |
|
525 | cmd = ['svn'] | |
525 | cmd = ['svn'] + commands + [path] |
|
526 | # Starting in svn 1.5 --non-interactive is a global flag | |
|
527 | # instead of being per-command, but we need to support 1.4 so | |||
|
528 | # we have to be intelligent about what commands take | |||
|
529 | # --non-interactive. | |||
|
530 | if (not self._ui.interactive() and | |||
|
531 | commands[0] in ('update', 'checkout', 'commit')): | |||
|
532 | cmd.append('--non-interactive') | |||
|
533 | cmd.extend(commands) | |||
|
534 | if filename is not None: | |||
|
535 | path = os.path.join(self._ctx._repo.origroot, self._path, filename) | |||
|
536 | cmd.append(path) | |||
526 | env = dict(os.environ) |
|
537 | env = dict(os.environ) | |
527 | # Avoid localized output, preserve current locale for everything else. |
|
538 | # Avoid localized output, preserve current locale for everything else. | |
528 | env['LC_MESSAGES'] = 'C' |
|
539 | env['LC_MESSAGES'] = 'C' | |
@@ -535,6 +546,14 b' class svnsubrepo(abstractsubrepo):' | |||||
535 | raise util.Abort(stderr) |
|
546 | raise util.Abort(stderr) | |
536 | return stdout |
|
547 | return stdout | |
537 |
|
548 | |||
|
549 | @propertycache | |||
|
550 | def _svnversion(self): | |||
|
551 | output = self._svncommand(['--version'], filename=None) | |||
|
552 | m = re.search(r'^svn,\s+version\s+(\d+)\.(\d+)', output) | |||
|
553 | if not m: | |||
|
554 | raise util.Abort(_('cannot retrieve svn tool version')) | |||
|
555 | return (int(m.group(1)), int(m.group(2))) | |||
|
556 | ||||
538 | def _wcrevs(self): |
|
557 | def _wcrevs(self): | |
539 | # Get the working directory revision as well as the last |
|
558 | # Get the working directory revision as well as the last | |
540 | # commit revision so we can compare the subrepo state with |
|
559 | # commit revision so we can compare the subrepo state with | |
@@ -629,7 +648,11 b' class svnsubrepo(abstractsubrepo):' | |||||
629 | def get(self, state, overwrite=False): |
|
648 | def get(self, state, overwrite=False): | |
630 | if overwrite: |
|
649 | if overwrite: | |
631 | self._svncommand(['revert', '--recursive']) |
|
650 | self._svncommand(['revert', '--recursive']) | |
632 | status = self._svncommand(['checkout', state[0], '--revision', state[1]]) |
|
651 | args = ['checkout'] | |
|
652 | if self._svnversion >= (1, 5): | |||
|
653 | args.append('--force') | |||
|
654 | args.extend([state[0], '--revision', state[1]]) | |||
|
655 | status = self._svncommand(args) | |||
633 | if not re.search('Checked out revision [0-9]+.', status): |
|
656 | if not re.search('Checked out revision [0-9]+.', status): | |
634 | raise util.Abort(status.splitlines()[-1]) |
|
657 | raise util.Abort(status.splitlines()[-1]) | |
635 | self._ui.status(status) |
|
658 | self._ui.status(status) |
@@ -121,6 +121,15 b' def has_docutils():' | |||||
121 | except ImportError: |
|
121 | except ImportError: | |
122 | return False |
|
122 | return False | |
123 |
|
123 | |||
|
124 | def getsvnversion(): | |||
|
125 | m = matchoutput('svn --version 2>&1', r'^svn,\s+version\s+(\d+)\.(\d+)') | |||
|
126 | if not m: | |||
|
127 | return (0, 0) | |||
|
128 | return (int(m.group(1)), int(m.group(2))) | |||
|
129 | ||||
|
130 | def has_svn15(): | |||
|
131 | return getsvnversion() >= (1, 5) | |||
|
132 | ||||
124 | def has_svn(): |
|
133 | def has_svn(): | |
125 | return matchoutput('svn --version 2>&1', r'^svn, version') and \ |
|
134 | return matchoutput('svn --version 2>&1', r'^svn, version') and \ | |
126 | matchoutput('svnadmin --version 2>&1', r'^svnadmin, version') |
|
135 | matchoutput('svnadmin --version 2>&1', r'^svnadmin, version') | |
@@ -204,6 +213,7 b' checks = {' | |||||
204 | "pygments": (has_pygments, "Pygments source highlighting library"), |
|
213 | "pygments": (has_pygments, "Pygments source highlighting library"), | |
205 | "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"), |
|
214 | "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"), | |
206 | "svn": (has_svn, "subversion client and admin tools"), |
|
215 | "svn": (has_svn, "subversion client and admin tools"), | |
|
216 | "svn15": (has_svn15, "subversion client and admin tools >= 1.5"), | |||
207 | "svn-bindings": (has_svn_bindings, "subversion python bindings"), |
|
217 | "svn-bindings": (has_svn_bindings, "subversion python bindings"), | |
208 | "symlink": (has_symlink, "symbolic links"), |
|
218 | "symlink": (has_symlink, "symbolic links"), | |
209 | "tla": (has_tla, "GNU Arch tla client"), |
|
219 | "tla": (has_tla, "GNU Arch tla client"), |
@@ -167,4 +167,18 b' Test extdiff with --option:' | |||||
167 | $ hg falabala -o this -c 1 |
|
167 | $ hg falabala -o this -c 1 | |
168 | diffing this a.8a5febb7f867/a a.34eed99112ab/a |
|
168 | diffing this a.8a5febb7f867/a a.34eed99112ab/a | |
169 | [1] |
|
169 | [1] | |
|
170 | $ cd .. | |||
170 |
|
171 | |||
|
172 | $ hg init testsymlinks | |||
|
173 | $ cd testsymlinks | |||
|
174 | $ echo a > a | |||
|
175 | $ hg ci -Am adda | |||
|
176 | adding a | |||
|
177 | $ echo a >> a | |||
|
178 | $ ln -s missing linka | |||
|
179 | $ hg add linka | |||
|
180 | $ hg falabala -r 0 --traceback | |||
|
181 | diffing testsymlinks.07f494440405 testsymlinks | |||
|
182 | [1] | |||
|
183 | $ cd .. | |||
|
184 |
@@ -17,7 +17,7 b' url for proxy, stream' | |||||
17 | $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --uncompressed http://localhost:$HGPORT/ b |
|
17 | $ http_proxy=http://localhost:$HGPORT1/ hg --config http_proxy.always=True clone --uncompressed http://localhost:$HGPORT/ b | |
18 | streaming all changes |
|
18 | streaming all changes | |
19 | 3 files to transfer, 303 bytes of data |
|
19 | 3 files to transfer, 303 bytes of data | |
20 |
transferred * bytes in * seconds (* |
|
20 | transferred * bytes in * seconds (*/sec) (glob) | |
21 | updating to branch default |
|
21 | updating to branch default | |
22 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
22 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
23 | $ cd b |
|
23 | $ cd b |
@@ -27,7 +27,7 b' clone via stream' | |||||
27 | $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 |
|
27 | $ hg clone --uncompressed http://localhost:$HGPORT/ copy 2>&1 | |
28 | streaming all changes |
|
28 | streaming all changes | |
29 | 6 files to transfer, 606 bytes of data |
|
29 | 6 files to transfer, 606 bytes of data | |
30 |
transferred * bytes in * seconds (* |
|
30 | transferred * bytes in * seconds (*/sec) (glob) | |
31 | updating to branch default |
|
31 | updating to branch default | |
32 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
32 | 4 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
33 | $ hg verify -R copy |
|
33 | $ hg verify -R copy |
@@ -15,6 +15,8 b'' | |||||
15 | > hg qnew series |
|
15 | > hg qnew series | |
16 | > hg qnew status |
|
16 | > hg qnew status | |
17 | > hg qnew guards |
|
17 | > hg qnew guards | |
|
18 | > hg qnew . | |||
|
19 | > hg qnew .. | |||
18 | > hg qnew .hgignore |
|
20 | > hg qnew .hgignore | |
19 | > hg qnew .mqfoo |
|
21 | > hg qnew .mqfoo | |
20 | > hg qnew 'foo#bar' |
|
22 | > hg qnew 'foo#bar' | |
@@ -102,6 +104,8 b' plain headers' | |||||
102 | abort: "series" cannot be used as the name of a patch |
|
104 | abort: "series" cannot be used as the name of a patch | |
103 | abort: "status" cannot be used as the name of a patch |
|
105 | abort: "status" cannot be used as the name of a patch | |
104 | abort: "guards" cannot be used as the name of a patch |
|
106 | abort: "guards" cannot be used as the name of a patch | |
|
107 | abort: "." cannot be used as the name of a patch | |||
|
108 | abort: ".." cannot be used as the name of a patch | |||
105 | abort: ".hgignore" cannot be used as the name of a patch |
|
109 | abort: ".hgignore" cannot be used as the name of a patch | |
106 | abort: ".mqfoo" cannot be used as the name of a patch |
|
110 | abort: ".mqfoo" cannot be used as the name of a patch | |
107 | abort: "foo#bar" cannot be used as the name of a patch |
|
111 | abort: "foo#bar" cannot be used as the name of a patch | |
@@ -167,6 +171,8 b' hg headers' | |||||
167 | abort: "series" cannot be used as the name of a patch |
|
171 | abort: "series" cannot be used as the name of a patch | |
168 | abort: "status" cannot be used as the name of a patch |
|
172 | abort: "status" cannot be used as the name of a patch | |
169 | abort: "guards" cannot be used as the name of a patch |
|
173 | abort: "guards" cannot be used as the name of a patch | |
|
174 | abort: "." cannot be used as the name of a patch | |||
|
175 | abort: ".." cannot be used as the name of a patch | |||
170 | abort: ".hgignore" cannot be used as the name of a patch |
|
176 | abort: ".hgignore" cannot be used as the name of a patch | |
171 | abort: ".mqfoo" cannot be used as the name of a patch |
|
177 | abort: ".mqfoo" cannot be used as the name of a patch | |
172 | abort: "foo#bar" cannot be used as the name of a patch |
|
178 | abort: "foo#bar" cannot be used as the name of a patch |
@@ -438,3 +438,54 b' Test subrepo already at intended revisio' | |||||
438 | $ svnversion |
|
438 | $ svnversion | |
439 | 2 |
|
439 | 2 | |
440 | $ cd .. |
|
440 | $ cd .. | |
|
441 | ||||
|
442 | Test case where subversion would fail to update the subrepo because there | |||
|
443 | are unknown directories being replaced by tracked ones (happens with rebase). | |||
|
444 | ||||
|
445 | $ cd $WCROOT/src | |||
|
446 | $ mkdir dir | |||
|
447 | $ echo epsilon.py > dir/epsilon.py | |||
|
448 | $ svn add dir | |||
|
449 | A dir | |||
|
450 | A dir/epsilon.py | |||
|
451 | $ svn ci -m 'Add dir/epsilon.py' | |||
|
452 | Adding src/dir | |||
|
453 | Adding src/dir/epsilon.py | |||
|
454 | Transmitting file data . | |||
|
455 | Committed revision 6. | |||
|
456 | $ cd ../.. | |||
|
457 | $ hg init rebaserepo | |||
|
458 | $ cd rebaserepo | |||
|
459 | $ svn co -r5 --quiet "$SVNREPO"/src s | |||
|
460 | $ echo "s = [svn] $SVNREPO/src" >> .hgsub | |||
|
461 | $ hg add .hgsub | |||
|
462 | $ hg ci -m addsub | |||
|
463 | committing subrepository s | |||
|
464 | $ echo a > a | |||
|
465 | $ hg ci -Am adda | |||
|
466 | adding a | |||
|
467 | $ hg up 0 | |||
|
468 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
469 | $ svn up -r6 s | |||
|
470 | A s/dir | |||
|
471 | A s/dir/epsilon.py | |||
|
472 | ||||
|
473 | Fetching external item into 's/externals' | |||
|
474 | Updated external to revision 1. | |||
|
475 | ||||
|
476 | Updated to revision 6. | |||
|
477 | $ hg ci -m updatesub | |||
|
478 | committing subrepository s | |||
|
479 | created new head | |||
|
480 | $ echo pyc > s/dir/epsilon.pyc | |||
|
481 | $ hg up 1 | |||
|
482 | D $TESTTMP/rebaserepo/s/dir | |||
|
483 | ||||
|
484 | Fetching external item into '$TESTTMP/rebaserepo/s/externals' | |||
|
485 | Checked out external at revision 1. | |||
|
486 | ||||
|
487 | Checked out revision 5. | |||
|
488 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
489 | $ if "$TESTDIR/hghave" -q svn15; then | |||
|
490 | > hg up 2 >/dev/null 2>&1 || echo update failed | |||
|
491 | > fi |
General Comments 0
You need to be logged in to leave comments.
Login now