Show More
@@ -950,8 +950,9 b' def bookmark(ui, repo, *names, **opts):' | |||||
950 | if ui.quiet: |
|
950 | if ui.quiet: | |
951 | ui.write("%s\n" % bmark, label=label) |
|
951 | ui.write("%s\n" % bmark, label=label) | |
952 | else: |
|
952 | else: | |
953 | ui.write(" %s %-25s %d:%s\n" % ( |
|
953 | pad = " " * (25 - encoding.colwidth(bmark)) | |
954 | prefix, bmark, repo.changelog.rev(n), hexfn(n)), |
|
954 | ui.write(" %s %s%s %d:%s\n" % ( | |
|
955 | prefix, bmark, pad, repo.changelog.rev(n), hexfn(n)), | |||
955 | label=label) |
|
956 | label=label) | |
956 |
|
957 | |||
957 | @command('branch', |
|
958 | @command('branch', |
@@ -355,7 +355,7 b' class cmdalias(object):' | |||||
355 | if not self.definition: |
|
355 | if not self.definition: | |
356 | def fn(ui, *args): |
|
356 | def fn(ui, *args): | |
357 | ui.warn(_("no definition for alias '%s'\n") % self.name) |
|
357 | ui.warn(_("no definition for alias '%s'\n") % self.name) | |
358 | return 1 |
|
358 | return -1 | |
359 | self.fn = fn |
|
359 | self.fn = fn | |
360 | self.badalias = True |
|
360 | self.badalias = True | |
361 | return |
|
361 | return | |
@@ -383,7 +383,16 b' class cmdalias(object):' | |||||
383 | self.fn = fn |
|
383 | self.fn = fn | |
384 | return |
|
384 | return | |
385 |
|
385 | |||
386 | args = shlex.split(self.definition) |
|
386 | try: | |
|
387 | args = shlex.split(self.definition) | |||
|
388 | except ValueError, inst: | |||
|
389 | def fn(ui, *args): | |||
|
390 | ui.warn(_("error in definition for alias '%s': %s\n") | |||
|
391 | % (self.name, inst)) | |||
|
392 | return -1 | |||
|
393 | self.fn = fn | |||
|
394 | self.badalias = True | |||
|
395 | return | |||
387 | self.cmdname = cmd = args.pop(0) |
|
396 | self.cmdname = cmd = args.pop(0) | |
388 | args = map(util.expandpath, args) |
|
397 | args = map(util.expandpath, args) | |
389 |
|
398 | |||
@@ -393,7 +402,7 b' class cmdalias(object):' | |||||
393 | ui.warn(_("error in definition for alias '%s': %s may only " |
|
402 | ui.warn(_("error in definition for alias '%s': %s may only " | |
394 | "be given on the command line\n") |
|
403 | "be given on the command line\n") | |
395 | % (self.name, invalidarg)) |
|
404 | % (self.name, invalidarg)) | |
396 | return 1 |
|
405 | return -1 | |
397 |
|
406 | |||
398 | self.fn = fn |
|
407 | self.fn = fn | |
399 | self.badalias = True |
|
408 | self.badalias = True | |
@@ -425,14 +434,14 b' class cmdalias(object):' | |||||
425 | commands.help_(ui, cmd, unknowncmd=True) |
|
434 | commands.help_(ui, cmd, unknowncmd=True) | |
426 | except error.UnknownCommand: |
|
435 | except error.UnknownCommand: | |
427 | pass |
|
436 | pass | |
428 | return 1 |
|
437 | return -1 | |
429 | self.fn = fn |
|
438 | self.fn = fn | |
430 | self.badalias = True |
|
439 | self.badalias = True | |
431 | except error.AmbiguousCommand: |
|
440 | except error.AmbiguousCommand: | |
432 | def fn(ui, *args): |
|
441 | def fn(ui, *args): | |
433 | ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \ |
|
442 | ui.warn(_("alias '%s' resolves to ambiguous command '%s'\n") \ | |
434 | % (self.name, cmd)) |
|
443 | % (self.name, cmd)) | |
435 | return 1 |
|
444 | return -1 | |
436 | self.fn = fn |
|
445 | self.fn = fn | |
437 | self.badalias = True |
|
446 | self.badalias = True | |
438 |
|
447 |
@@ -142,3 +142,25 b' def canonpath(root, cwd, myname, auditor' | |||||
142 | name = dirname |
|
142 | name = dirname | |
143 |
|
143 | |||
144 | raise util.Abort(_("%s not under root '%s'") % (myname, root)) |
|
144 | raise util.Abort(_("%s not under root '%s'") % (myname, root)) | |
|
145 | ||||
|
146 | def normasprefix(path): | |||
|
147 | '''normalize the specified path as path prefix | |||
|
148 | ||||
|
149 | Returned vaule can be used safely for "p.startswith(prefix)", | |||
|
150 | "p[len(prefix):]", and so on. | |||
|
151 | ||||
|
152 | For efficiency, this expects "path" argument to be already | |||
|
153 | normalized by "os.path.normpath", "os.path.realpath", and so on. | |||
|
154 | ||||
|
155 | See also issue3033 for detail about need of this function. | |||
|
156 | ||||
|
157 | >>> normasprefix('/foo/bar').replace(os.sep, '/') | |||
|
158 | '/foo/bar/' | |||
|
159 | >>> normasprefix('/').replace(os.sep, '/') | |||
|
160 | '/' | |||
|
161 | ''' | |||
|
162 | d, p = os.path.splitdrive(path) | |||
|
163 | if len(p) != len(os.sep): | |||
|
164 | return path + os.sep | |||
|
165 | else: | |||
|
166 | return path |
@@ -277,8 +277,7 b' def reporelpath(repo):' | |||||
277 | parent = repo |
|
277 | parent = repo | |
278 | while util.safehasattr(parent, '_subparent'): |
|
278 | while util.safehasattr(parent, '_subparent'): | |
279 | parent = parent._subparent |
|
279 | parent = parent._subparent | |
280 | p = parent.root.rstrip(os.sep) |
|
280 | return repo.root[len(pathutil.normasprefix(parent.root)):] | |
281 | return repo.root[len(p) + 1:] |
|
|||
282 |
|
281 | |||
283 | def subrelpath(sub): |
|
282 | def subrelpath(sub): | |
284 | """return path to this subrepo as seen from outermost repo""" |
|
283 | """return path to this subrepo as seen from outermost repo""" | |
@@ -315,17 +314,19 b' def _abssource(repo, push=False, abort=T' | |||||
315 | if abort: |
|
314 | if abort: | |
316 | raise util.Abort(_("default path for subrepository not found")) |
|
315 | raise util.Abort(_("default path for subrepository not found")) | |
317 |
|
316 | |||
318 | def _sanitize(ui, path): |
|
317 | def _sanitize(ui, path, ignore): | |
319 | def v(arg, dirname, names): |
|
318 | for dirname, dirs, names in os.walk(path): | |
|
319 | for i, d in enumerate(dirs): | |||
|
320 | if d.lower() == ignore: | |||
|
321 | del dirs[i] | |||
|
322 | break | |||
320 | if os.path.basename(dirname).lower() != '.hg': |
|
323 | if os.path.basename(dirname).lower() != '.hg': | |
321 |
|
|
324 | continue | |
322 | for f in names: |
|
325 | for f in names: | |
323 | if f.lower() == 'hgrc': |
|
326 | if f.lower() == 'hgrc': | |
324 | ui.warn( |
|
327 | ui.warn(_("warning: removing potentially hostile 'hgrc' " | |
325 | _("warning: removing potentially hostile .hg/hgrc in '%s'") |
|
328 | "in '%s'\n") % dirname) | |
326 | % path) |
|
|||
327 | os.unlink(os.path.join(dirname, f)) |
|
329 | os.unlink(os.path.join(dirname, f)) | |
328 | os.walk(path, v, None) |
|
|||
329 |
|
330 | |||
330 | def subrepo(ctx, path): |
|
331 | def subrepo(ctx, path): | |
331 | """return instance of the right subrepo class for subrepo in path""" |
|
332 | """return instance of the right subrepo class for subrepo in path""" | |
@@ -1059,7 +1060,7 b' class svnsubrepo(abstractsubrepo):' | |||||
1059 | # update to a directory which has since been deleted and recreated. |
|
1060 | # update to a directory which has since been deleted and recreated. | |
1060 | args.append('%s@%s' % (state[0], state[1])) |
|
1061 | args.append('%s@%s' % (state[0], state[1])) | |
1061 | status, err = self._svncommand(args, failok=True) |
|
1062 | status, err = self._svncommand(args, failok=True) | |
1062 | _sanitize(self._ui, self._path) |
|
1063 | _sanitize(self._ui, self._ctx._repo.wjoin(self._path), '.svn') | |
1063 | if not re.search('Checked out revision [0-9]+.', status): |
|
1064 | if not re.search('Checked out revision [0-9]+.', status): | |
1064 | if ('is already a working copy for a different URL' in err |
|
1065 | if ('is already a working copy for a different URL' in err | |
1065 | and (self._wcchanged()[:2] == (False, False))): |
|
1066 | and (self._wcchanged()[:2] == (False, False))): | |
@@ -1352,7 +1353,7 b' class gitsubrepo(abstractsubrepo):' | |||||
1352 | self._gitcommand(['reset', 'HEAD']) |
|
1353 | self._gitcommand(['reset', 'HEAD']) | |
1353 | cmd.append('-f') |
|
1354 | cmd.append('-f') | |
1354 | self._gitcommand(cmd + args) |
|
1355 | self._gitcommand(cmd + args) | |
1355 | _sanitize(self._ui, self._path) |
|
1356 | _sanitize(self._ui, self._abspath, '.git') | |
1356 |
|
1357 | |||
1357 | def rawcheckout(): |
|
1358 | def rawcheckout(): | |
1358 | # no branch to checkout, check it out with no branch |
|
1359 | # no branch to checkout, check it out with no branch | |
@@ -1401,6 +1402,7 b' class gitsubrepo(abstractsubrepo):' | |||||
1401 | if tracking[remote] != self._gitcurrentbranch(): |
|
1402 | if tracking[remote] != self._gitcurrentbranch(): | |
1402 | checkout([tracking[remote]]) |
|
1403 | checkout([tracking[remote]]) | |
1403 | self._gitcommand(['merge', '--ff', remote]) |
|
1404 | self._gitcommand(['merge', '--ff', remote]) | |
|
1405 | _sanitize(self._ui, self._abspath, '.git') | |||
1404 | else: |
|
1406 | else: | |
1405 | # a real merge would be required, just checkout the revision |
|
1407 | # a real merge would be required, just checkout the revision | |
1406 | rawcheckout() |
|
1408 | rawcheckout() | |
@@ -1436,7 +1438,7 b' class gitsubrepo(abstractsubrepo):' | |||||
1436 | self.get(state) # fast forward merge |
|
1438 | self.get(state) # fast forward merge | |
1437 | elif base != self._state[1]: |
|
1439 | elif base != self._state[1]: | |
1438 | self._gitcommand(['merge', '--no-commit', revision]) |
|
1440 | self._gitcommand(['merge', '--no-commit', revision]) | |
1439 | _sanitize(self._ui, self._path) |
|
1441 | _sanitize(self._ui, self._abspath, '.git') | |
1440 |
|
1442 | |||
1441 | if self.dirty(): |
|
1443 | if self.dirty(): | |
1442 | if self._gitstate() != revision: |
|
1444 | if self._gitstate() != revision: |
@@ -11,6 +11,7 b'' | |||||
11 | > ambiguous = s |
|
11 | > ambiguous = s | |
12 | > recursive = recursive |
|
12 | > recursive = recursive | |
13 | > nodefinition = |
|
13 | > nodefinition = | |
|
14 | > noclosingquotation = ' | |||
14 | > no--cwd = status --cwd elsewhere |
|
15 | > no--cwd = status --cwd elsewhere | |
15 | > no-R = status -R elsewhere |
|
16 | > no-R = status -R elsewhere | |
16 | > no--repo = status --repo elsewhere |
|
17 | > no--repo = status --repo elsewhere | |
@@ -60,7 +61,7 b' unknown' | |||||
60 |
|
61 | |||
61 | $ hg unknown |
|
62 | $ hg unknown | |
62 | alias 'unknown' resolves to unknown command 'bargle' |
|
63 | alias 'unknown' resolves to unknown command 'bargle' | |
63 |
[ |
|
64 | [255] | |
64 | $ hg help unknown |
|
65 | $ hg help unknown | |
65 | alias 'unknown' resolves to unknown command 'bargle' |
|
66 | alias 'unknown' resolves to unknown command 'bargle' | |
66 |
|
67 | |||
@@ -69,7 +70,7 b' ambiguous' | |||||
69 |
|
70 | |||
70 | $ hg ambiguous |
|
71 | $ hg ambiguous | |
71 | alias 'ambiguous' resolves to ambiguous command 's' |
|
72 | alias 'ambiguous' resolves to ambiguous command 's' | |
72 |
[ |
|
73 | [255] | |
73 | $ hg help ambiguous |
|
74 | $ hg help ambiguous | |
74 | alias 'ambiguous' resolves to ambiguous command 's' |
|
75 | alias 'ambiguous' resolves to ambiguous command 's' | |
75 |
|
76 | |||
@@ -78,7 +79,7 b' recursive' | |||||
78 |
|
79 | |||
79 | $ hg recursive |
|
80 | $ hg recursive | |
80 | alias 'recursive' resolves to unknown command 'recursive' |
|
81 | alias 'recursive' resolves to unknown command 'recursive' | |
81 |
[ |
|
82 | [255] | |
82 | $ hg help recursive |
|
83 | $ hg help recursive | |
83 | alias 'recursive' resolves to unknown command 'recursive' |
|
84 | alias 'recursive' resolves to unknown command 'recursive' | |
84 |
|
85 | |||
@@ -87,36 +88,45 b' no definition' | |||||
87 |
|
88 | |||
88 | $ hg nodef |
|
89 | $ hg nodef | |
89 | no definition for alias 'nodefinition' |
|
90 | no definition for alias 'nodefinition' | |
90 |
[ |
|
91 | [255] | |
91 | $ hg help nodef |
|
92 | $ hg help nodef | |
92 | no definition for alias 'nodefinition' |
|
93 | no definition for alias 'nodefinition' | |
93 |
|
94 | |||
94 |
|
95 | |||
|
96 | no closing quotation | |||
|
97 | ||||
|
98 | $ hg noclosing | |||
|
99 | error in definition for alias 'noclosingquotation': No closing quotation | |||
|
100 | [255] | |||
|
101 | $ hg help noclosing | |||
|
102 | error in definition for alias 'noclosingquotation': No closing quotation | |||
|
103 | ||||
|
104 | ||||
95 | invalid options |
|
105 | invalid options | |
96 |
|
106 | |||
97 | $ hg no--cwd |
|
107 | $ hg no--cwd | |
98 | error in definition for alias 'no--cwd': --cwd may only be given on the command line |
|
108 | error in definition for alias 'no--cwd': --cwd may only be given on the command line | |
99 |
[ |
|
109 | [255] | |
100 | $ hg help no--cwd |
|
110 | $ hg help no--cwd | |
101 | error in definition for alias 'no--cwd': --cwd may only be given on the command line |
|
111 | error in definition for alias 'no--cwd': --cwd may only be given on the command line | |
102 | $ hg no-R |
|
112 | $ hg no-R | |
103 | error in definition for alias 'no-R': -R may only be given on the command line |
|
113 | error in definition for alias 'no-R': -R may only be given on the command line | |
104 |
[ |
|
114 | [255] | |
105 | $ hg help no-R |
|
115 | $ hg help no-R | |
106 | error in definition for alias 'no-R': -R may only be given on the command line |
|
116 | error in definition for alias 'no-R': -R may only be given on the command line | |
107 | $ hg no--repo |
|
117 | $ hg no--repo | |
108 | error in definition for alias 'no--repo': --repo may only be given on the command line |
|
118 | error in definition for alias 'no--repo': --repo may only be given on the command line | |
109 |
[ |
|
119 | [255] | |
110 | $ hg help no--repo |
|
120 | $ hg help no--repo | |
111 | error in definition for alias 'no--repo': --repo may only be given on the command line |
|
121 | error in definition for alias 'no--repo': --repo may only be given on the command line | |
112 | $ hg no--repository |
|
122 | $ hg no--repository | |
113 | error in definition for alias 'no--repository': --repository may only be given on the command line |
|
123 | error in definition for alias 'no--repository': --repository may only be given on the command line | |
114 |
[ |
|
124 | [255] | |
115 | $ hg help no--repository |
|
125 | $ hg help no--repository | |
116 | error in definition for alias 'no--repository': --repository may only be given on the command line |
|
126 | error in definition for alias 'no--repository': --repository may only be given on the command line | |
117 | $ hg no--config |
|
127 | $ hg no--config | |
118 | error in definition for alias 'no--config': --config may only be given on the command line |
|
128 | error in definition for alias 'no--config': --config may only be given on the command line | |
119 |
[ |
|
129 | [255] | |
120 |
|
130 | |||
121 | optional repository |
|
131 | optional repository | |
122 |
|
132 |
@@ -19,6 +19,7 b" testmod('mercurial.hg')" | |||||
19 | testmod('mercurial.hgweb.hgwebdir_mod') |
|
19 | testmod('mercurial.hgweb.hgwebdir_mod') | |
20 | testmod('mercurial.match') |
|
20 | testmod('mercurial.match') | |
21 | testmod('mercurial.minirst') |
|
21 | testmod('mercurial.minirst') | |
|
22 | testmod('mercurial.pathutil') | |||
22 | testmod('mercurial.revset') |
|
23 | testmod('mercurial.revset') | |
23 | testmod('mercurial.store') |
|
24 | testmod('mercurial.store') | |
24 | testmod('mercurial.subrepo') |
|
25 | testmod('mercurial.subrepo') |
@@ -116,22 +116,25 b' add branches/tags' | |||||
116 | marked working directory as branch \xe7\x9f\xad\xe5\x90\x8d (esc) |
|
116 | marked working directory as branch \xe7\x9f\xad\xe5\x90\x8d (esc) | |
117 | (branches are permanent and global, did you want a bookmark?) |
|
117 | (branches are permanent and global, did you want a bookmark?) | |
118 | $ hg tag $S |
|
118 | $ hg tag $S | |
|
119 | $ hg book -f $S | |||
119 | $ hg branch $M |
|
120 | $ hg branch $M | |
120 | marked working directory as branch MIDDLE_ |
|
121 | marked working directory as branch MIDDLE_ | |
121 | (branches are permanent and global, did you want a bookmark?) |
|
122 | (branches are permanent and global, did you want a bookmark?) | |
122 | $ hg tag $M |
|
123 | $ hg tag $M | |
|
124 | $ hg book -f $M | |||
123 | $ hg branch $L |
|
125 | $ hg branch $L | |
124 | marked working directory as branch \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d (esc) |
|
126 | marked working directory as branch \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d (esc) | |
125 | (branches are permanent and global, did you want a bookmark?) |
|
127 | (branches are permanent and global, did you want a bookmark?) | |
126 | $ hg tag $L |
|
128 | $ hg tag $L | |
|
129 | $ hg book -f $L | |||
127 |
|
130 | |||
128 | check alignment of branches |
|
131 | check alignment of branches | |
129 |
|
132 | |||
130 |
$ hg |
|
133 | $ hg branches | |
131 | tip 5:d745ff46155b |
|
134 | \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 5:d745ff46155b (esc) | |
132 | \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 4:9259be597f19 (esc) |
|
135 | MIDDLE_ 4:9259be597f19 (inactive) | |
133 |
|
|
136 | \xe7\x9f\xad\xe5\x90\x8d 3:b06c5b6def9e (inactive) (esc) | |
134 |
|
|
137 | default 2:64a70663cee8 (inactive) | |
135 |
|
138 | |||
136 | check alignment of tags |
|
139 | check alignment of tags | |
137 |
|
140 | |||
@@ -141,4 +144,9 b' check alignment of tags' | |||||
141 | MIDDLE_ 3:b06c5b6def9e |
|
144 | MIDDLE_ 3:b06c5b6def9e | |
142 | \xe7\x9f\xad\xe5\x90\x8d 2:64a70663cee8 (esc) |
|
145 | \xe7\x9f\xad\xe5\x90\x8d 2:64a70663cee8 (esc) | |
143 |
|
146 | |||
144 | $ cd .. |
|
147 | check alignment of bookmarks | |
|
148 | ||||
|
149 | $ hg book | |||
|
150 | MIDDLE_ 5:d745ff46155b | |||
|
151 | \xe7\x9f\xad\xe5\x90\x8d 4:9259be597f19 (esc) | |||
|
152 | * \xe9\x95\xb7\xe3\x81\x84\xe9\x95\xb7\xe3\x81\x84\xe5\x90\x8d\xe5\x89\x8d 5:d745ff46155b (esc) |
@@ -566,3 +566,105 b' traceback' | |||||
566 | #endif |
|
566 | #endif | |
567 |
|
567 | |||
568 | $ cd .. |
|
568 | $ cd .. | |
|
569 | ||||
|
570 | Test sanitizing ".hg/hgrc" in subrepo | |||
|
571 | ||||
|
572 | $ cd t | |||
|
573 | $ hg tip -q | |||
|
574 | 7:af6d2edbb0d3 | |||
|
575 | $ hg update -q -C af6d2edbb0d3 | |||
|
576 | $ cd s | |||
|
577 | $ git checkout -q -b sanitize-test | |||
|
578 | $ mkdir .hg | |||
|
579 | $ echo '.hg/hgrc in git repo' > .hg/hgrc | |||
|
580 | $ mkdir -p sub/.hg | |||
|
581 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc | |||
|
582 | $ git add .hg sub | |||
|
583 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update' | |||
|
584 | $ git push -q origin sanitize-test | |||
|
585 | $ cd .. | |||
|
586 | $ grep ' s$' .hgsubstate | |||
|
587 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s | |||
|
588 | $ hg commit -qm 'commit with git revision including .hg/hgrc' | |||
|
589 | $ hg parents -q | |||
|
590 | 8:3473d20bddcf | |||
|
591 | $ grep ' s$' .hgsubstate | |||
|
592 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s | |||
|
593 | $ cd .. | |||
|
594 | ||||
|
595 | $ hg -R tc pull -q | |||
|
596 | $ hg -R tc update -q -C 3473d20bddcf 2>&1 | sort | |||
|
597 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) | |||
|
598 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) | |||
|
599 | $ cd tc | |||
|
600 | $ hg parents -q | |||
|
601 | 8:3473d20bddcf | |||
|
602 | $ grep ' s$' .hgsubstate | |||
|
603 | c4069473b459cf27fd4d7c2f50c4346b4e936599 s | |||
|
604 | $ cat s/.hg/hgrc | |||
|
605 | cat: s/.hg/hgrc: No such file or directory | |||
|
606 | [1] | |||
|
607 | $ cat s/sub/.hg/hgrc | |||
|
608 | cat: s/sub/.hg/hgrc: No such file or directory | |||
|
609 | [1] | |||
|
610 | $ cd .. | |||
|
611 | ||||
|
612 | additional test for "git merge --ff" route: | |||
|
613 | ||||
|
614 | $ cd t | |||
|
615 | $ hg tip -q | |||
|
616 | 8:3473d20bddcf | |||
|
617 | $ hg update -q -C af6d2edbb0d3 | |||
|
618 | $ cd s | |||
|
619 | $ git checkout -q testing | |||
|
620 | $ mkdir .hg | |||
|
621 | $ echo '.hg/hgrc in git repo' > .hg/hgrc | |||
|
622 | $ mkdir -p sub/.hg | |||
|
623 | $ echo 'sub/.hg/hgrc in git repo' > sub/.hg/hgrc | |||
|
624 | $ git add .hg sub | |||
|
625 | $ git commit -qm 'add .hg/hgrc to be sanitized at hg update (git merge --ff)' | |||
|
626 | $ git push -q origin testing | |||
|
627 | $ cd .. | |||
|
628 | $ grep ' s$' .hgsubstate | |||
|
629 | 32a343883b74769118bb1d3b4b1fbf9156f4dddc s | |||
|
630 | $ hg commit -qm 'commit with git revision including .hg/hgrc' | |||
|
631 | $ hg parents -q | |||
|
632 | 9:ed23f7fe024e | |||
|
633 | $ grep ' s$' .hgsubstate | |||
|
634 | f262643c1077219fbd3858d54e78ef050ef84fbf s | |||
|
635 | $ cd .. | |||
|
636 | ||||
|
637 | $ cd tc | |||
|
638 | $ hg update -q -C af6d2edbb0d3 | |||
|
639 | $ cat s/.hg/hgrc | |||
|
640 | cat: s/.hg/hgrc: No such file or directory | |||
|
641 | [1] | |||
|
642 | $ cat s/sub/.hg/hgrc | |||
|
643 | cat: s/sub/.hg/hgrc: No such file or directory | |||
|
644 | [1] | |||
|
645 | $ cd .. | |||
|
646 | $ hg -R tc pull -q | |||
|
647 | $ hg -R tc update -q -C ed23f7fe024e 2>&1 | sort | |||
|
648 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/.hg' (glob) | |||
|
649 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/tc/s/sub/.hg' (glob) | |||
|
650 | $ cd tc | |||
|
651 | $ hg parents -q | |||
|
652 | 9:ed23f7fe024e | |||
|
653 | $ grep ' s$' .hgsubstate | |||
|
654 | f262643c1077219fbd3858d54e78ef050ef84fbf s | |||
|
655 | $ cat s/.hg/hgrc | |||
|
656 | cat: s/.hg/hgrc: No such file or directory | |||
|
657 | [1] | |||
|
658 | $ cat s/sub/.hg/hgrc | |||
|
659 | cat: s/sub/.hg/hgrc: No such file or directory | |||
|
660 | [1] | |||
|
661 | ||||
|
662 | Test that sanitizing is omitted in meta data area: | |||
|
663 | ||||
|
664 | $ mkdir s/.git/.hg | |||
|
665 | $ echo '.hg/hgrc in git metadata area' > s/.git/.hg/hgrc | |||
|
666 | $ hg update -q -C af6d2edbb0d3 | |||
|
667 | checking out detached HEAD in subrepo s | |||
|
668 | check out a git branch if you intend to make changes | |||
|
669 | ||||
|
670 | $ cd .. |
@@ -635,3 +635,54 b' well.' | |||||
635 | Checked out revision 15. |
|
635 | Checked out revision 15. | |
636 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
636 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
637 | $ cd .. |
|
637 | $ cd .. | |
|
638 | ||||
|
639 | Test sanitizing ".hg/hgrc" in subrepo | |||
|
640 | ||||
|
641 | $ cd sub/t | |||
|
642 | $ hg update -q -C tip | |||
|
643 | $ cd s | |||
|
644 | $ mkdir .hg | |||
|
645 | $ echo '.hg/hgrc in svn repo' > .hg/hgrc | |||
|
646 | $ mkdir -p sub/.hg | |||
|
647 | $ echo 'sub/.hg/hgrc in svn repo' > sub/.hg/hgrc | |||
|
648 | $ svn add .hg sub | |||
|
649 | A .hg | |||
|
650 | A .hg/hgrc (glob) | |||
|
651 | A sub | |||
|
652 | A sub/.hg (glob) | |||
|
653 | A sub/.hg/hgrc (glob) | |||
|
654 | $ svn ci -m 'add .hg/hgrc to be sanitized at hg update' | |||
|
655 | Adding .hg | |||
|
656 | Adding .hg/hgrc (glob) | |||
|
657 | Adding sub | |||
|
658 | Adding sub/.hg (glob) | |||
|
659 | Adding sub/.hg/hgrc (glob) | |||
|
660 | Transmitting file data .. | |||
|
661 | Committed revision 16. | |||
|
662 | $ svn up -q | |||
|
663 | $ cd .. | |||
|
664 | $ hg commit -S -m 'commit with svn revision including .hg/hgrc' | |||
|
665 | $ grep ' s$' .hgsubstate | |||
|
666 | 16 s | |||
|
667 | $ cd .. | |||
|
668 | ||||
|
669 | $ hg -R tc pull -u -q 2>&1 | sort | |||
|
670 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/.hg' (glob) | |||
|
671 | warning: removing potentially hostile 'hgrc' in '$TESTTMP/sub/tc/s/sub/.hg' (glob) | |||
|
672 | $ cd tc | |||
|
673 | $ grep ' s$' .hgsubstate | |||
|
674 | 16 s | |||
|
675 | $ cat s/.hg/hgrc | |||
|
676 | cat: s/.hg/hgrc: No such file or directory | |||
|
677 | [1] | |||
|
678 | $ cat s/sub/.hg/hgrc | |||
|
679 | cat: s/sub/.hg/hgrc: No such file or directory | |||
|
680 | [1] | |||
|
681 | ||||
|
682 | Test that sanitizing is omitted in meta data area: | |||
|
683 | ||||
|
684 | $ mkdir s/.svn/.hg | |||
|
685 | $ echo '.hg/hgrc in svn metadata area' > s/.svn/.hg/hgrc | |||
|
686 | $ hg update -q -C '.^1' | |||
|
687 | ||||
|
688 | $ cd ../.. |
General Comments 0
You need to be logged in to leave comments.
Login now