Show More
@@ -852,7 +852,7 b' class queue(object):' | |||||
852 | raise util.Abort(_("local changes found")) |
|
852 | raise util.Abort(_("local changes found")) | |
853 | return m, a, r, d |
|
853 | return m, a, r, d | |
854 |
|
854 | |||
855 | _reserved = ('series', 'status', 'guards') |
|
855 | _reserved = ('series', 'status', 'guards', '.', '..') | |
856 | def check_reserved_name(self, name): |
|
856 | def check_reserved_name(self, name): | |
857 | if (name in self._reserved or name.startswith('.hg') |
|
857 | if (name in self._reserved or name.startswith('.hg') | |
858 | or name.startswith('.mq') or '#' in name or ':' in name): |
|
858 | or name.startswith('.mq') or '#' in name or ':' in name): |
@@ -10,6 +10,7 b' import stat, subprocess, tarfile' | |||||
10 | from i18n import _ |
|
10 | from i18n import _ | |
11 | import config, scmutil, util, node, error, cmdutil, url, bookmarks |
|
11 | import config, scmutil, util, node, error, cmdutil, url, bookmarks | |
12 | hg = None |
|
12 | hg = None | |
|
13 | propertycache = util.propertycache | |||
13 |
|
14 | |||
14 | nullstate = ('', '', 'empty') |
|
15 | nullstate = ('', '', 'empty') | |
15 |
|
16 | |||
@@ -511,7 +512,6 b' class svnsubrepo(abstractsubrepo):' | |||||
511 | self._ui = ctx._repo.ui |
|
512 | self._ui = ctx._repo.ui | |
512 |
|
513 | |||
513 | def _svncommand(self, commands, filename=''): |
|
514 | def _svncommand(self, commands, filename=''): | |
514 | path = os.path.join(self._ctx._repo.origroot, self._path, filename) |
|
|||
515 | cmd = ['svn'] |
|
515 | cmd = ['svn'] | |
516 | # Starting in svn 1.5 --non-interactive is a global flag |
|
516 | # Starting in svn 1.5 --non-interactive is a global flag | |
517 | # instead of being per-command, but we need to support 1.4 so |
|
517 | # instead of being per-command, but we need to support 1.4 so | |
@@ -521,7 +521,9 b' class svnsubrepo(abstractsubrepo):' | |||||
521 | commands[0] in ('update', 'checkout', 'commit')): |
|
521 | commands[0] in ('update', 'checkout', 'commit')): | |
522 | cmd.append('--non-interactive') |
|
522 | cmd.append('--non-interactive') | |
523 | cmd.extend(commands) |
|
523 | cmd.extend(commands) | |
524 | cmd.append(path) |
|
524 | if filename is not None: | |
|
525 | path = os.path.join(self._ctx._repo.origroot, self._path, filename) | |||
|
526 | cmd.append(path) | |||
525 | env = dict(os.environ) |
|
527 | env = dict(os.environ) | |
526 | # Avoid localized output, preserve current locale for everything else. |
|
528 | # Avoid localized output, preserve current locale for everything else. | |
527 | env['LC_MESSAGES'] = 'C' |
|
529 | env['LC_MESSAGES'] = 'C' | |
@@ -534,6 +536,14 b' class svnsubrepo(abstractsubrepo):' | |||||
534 | raise util.Abort(stderr) |
|
536 | raise util.Abort(stderr) | |
535 | return stdout |
|
537 | return stdout | |
536 |
|
538 | |||
|
539 | @propertycache | |||
|
540 | def _svnversion(self): | |||
|
541 | output = self._svncommand(['--version'], filename=None) | |||
|
542 | m = re.search(r'^svn,\s+version\s+(\d+)\.(\d+)', output) | |||
|
543 | if not m: | |||
|
544 | raise util.Abort(_('cannot retrieve svn tool version')) | |||
|
545 | return (int(m.group(1)), int(m.group(2))) | |||
|
546 | ||||
537 | def _wcrevs(self): |
|
547 | def _wcrevs(self): | |
538 | # Get the working directory revision as well as the last |
|
548 | # Get the working directory revision as well as the last | |
539 | # commit revision so we can compare the subrepo state with |
|
549 | # commit revision so we can compare the subrepo state with | |
@@ -628,7 +638,11 b' class svnsubrepo(abstractsubrepo):' | |||||
628 | def get(self, state, overwrite=False): |
|
638 | def get(self, state, overwrite=False): | |
629 | if overwrite: |
|
639 | if overwrite: | |
630 | self._svncommand(['revert', '--recursive']) |
|
640 | self._svncommand(['revert', '--recursive']) | |
631 | status = self._svncommand(['checkout', state[0], '--revision', state[1]]) |
|
641 | args = ['checkout'] | |
|
642 | if self._svnversion >= (1, 5): | |||
|
643 | args.append('--force') | |||
|
644 | args.extend([state[0], '--revision', state[1]]) | |||
|
645 | status = self._svncommand(args) | |||
632 | if not re.search('Checked out revision [0-9]+.', status): |
|
646 | if not re.search('Checked out revision [0-9]+.', status): | |
633 | raise util.Abort(status.splitlines()[-1]) |
|
647 | raise util.Abort(status.splitlines()[-1]) | |
634 | self._ui.status(status) |
|
648 | 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"), |
@@ -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