Show More
@@ -852,7 +852,7 b' class queue(object):' | |||
|
852 | 852 | raise util.Abort(_("local changes found")) |
|
853 | 853 | return m, a, r, d |
|
854 | 854 | |
|
855 | _reserved = ('series', 'status', 'guards') | |
|
855 | _reserved = ('series', 'status', 'guards', '.', '..') | |
|
856 | 856 | def check_reserved_name(self, name): |
|
857 | 857 | if (name in self._reserved or name.startswith('.hg') |
|
858 | 858 | or name.startswith('.mq') or '#' in name or ':' in name): |
@@ -10,6 +10,7 b' import stat, subprocess, tarfile' | |||
|
10 | 10 | from i18n import _ |
|
11 | 11 | import config, scmutil, util, node, error, cmdutil, url, bookmarks |
|
12 | 12 | hg = None |
|
13 | propertycache = util.propertycache | |
|
13 | 14 | |
|
14 | 15 | nullstate = ('', '', 'empty') |
|
15 | 16 | |
@@ -511,7 +512,6 b' class svnsubrepo(abstractsubrepo):' | |||
|
511 | 512 | self._ui = ctx._repo.ui |
|
512 | 513 | |
|
513 | 514 | def _svncommand(self, commands, filename=''): |
|
514 | path = os.path.join(self._ctx._repo.origroot, self._path, filename) | |
|
515 | 515 | cmd = ['svn'] |
|
516 | 516 | # Starting in svn 1.5 --non-interactive is a global flag |
|
517 | 517 | # instead of being per-command, but we need to support 1.4 so |
@@ -521,7 +521,9 b' class svnsubrepo(abstractsubrepo):' | |||
|
521 | 521 | commands[0] in ('update', 'checkout', 'commit')): |
|
522 | 522 | cmd.append('--non-interactive') |
|
523 | 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 | 527 | env = dict(os.environ) |
|
526 | 528 | # Avoid localized output, preserve current locale for everything else. |
|
527 | 529 | env['LC_MESSAGES'] = 'C' |
@@ -534,6 +536,14 b' class svnsubrepo(abstractsubrepo):' | |||
|
534 | 536 | raise util.Abort(stderr) |
|
535 | 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 | 547 | def _wcrevs(self): |
|
538 | 548 | # Get the working directory revision as well as the last |
|
539 | 549 | # commit revision so we can compare the subrepo state with |
@@ -628,7 +638,11 b' class svnsubrepo(abstractsubrepo):' | |||
|
628 | 638 | def get(self, state, overwrite=False): |
|
629 | 639 | if overwrite: |
|
630 | 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 | 646 | if not re.search('Checked out revision [0-9]+.', status): |
|
633 | 647 | raise util.Abort(status.splitlines()[-1]) |
|
634 | 648 | self._ui.status(status) |
@@ -121,6 +121,15 b' def has_docutils():' | |||
|
121 | 121 | except ImportError: |
|
122 | 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 | 133 | def has_svn(): |
|
125 | 134 | return matchoutput('svn --version 2>&1', r'^svn, version') and \ |
|
126 | 135 | matchoutput('svnadmin --version 2>&1', r'^svnadmin, version') |
@@ -204,6 +213,7 b' checks = {' | |||
|
204 | 213 | "pygments": (has_pygments, "Pygments source highlighting library"), |
|
205 | 214 | "ssl": (has_ssl, "python >= 2.6 ssl module and python OpenSSL"), |
|
206 | 215 | "svn": (has_svn, "subversion client and admin tools"), |
|
216 | "svn15": (has_svn15, "subversion client and admin tools >= 1.5"), | |
|
207 | 217 | "svn-bindings": (has_svn_bindings, "subversion python bindings"), |
|
208 | 218 | "symlink": (has_symlink, "symbolic links"), |
|
209 | 219 | "tla": (has_tla, "GNU Arch tla client"), |
@@ -15,6 +15,8 b'' | |||
|
15 | 15 | > hg qnew series |
|
16 | 16 | > hg qnew status |
|
17 | 17 | > hg qnew guards |
|
18 | > hg qnew . | |
|
19 | > hg qnew .. | |
|
18 | 20 | > hg qnew .hgignore |
|
19 | 21 | > hg qnew .mqfoo |
|
20 | 22 | > hg qnew 'foo#bar' |
@@ -102,6 +104,8 b' plain headers' | |||
|
102 | 104 | abort: "series" cannot be used as the name of a patch |
|
103 | 105 | abort: "status" cannot be used as the name of a patch |
|
104 | 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 | 109 | abort: ".hgignore" cannot be used as the name of a patch |
|
106 | 110 | abort: ".mqfoo" cannot be used as the name of a patch |
|
107 | 111 | abort: "foo#bar" cannot be used as the name of a patch |
@@ -167,6 +171,8 b' hg headers' | |||
|
167 | 171 | abort: "series" cannot be used as the name of a patch |
|
168 | 172 | abort: "status" cannot be used as the name of a patch |
|
169 | 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 | 176 | abort: ".hgignore" cannot be used as the name of a patch |
|
171 | 177 | abort: ".mqfoo" cannot be used as the name of a patch |
|
172 | 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 | 438 | $ svnversion |
|
439 | 439 | 2 |
|
440 | 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