Show More
@@ -0,0 +1,17 b'' | |||||
|
1 | #!/bin/sh | |||
|
2 | ||||
|
3 | "$TESTDIR/hghave" execbit || exit 80 | |||
|
4 | ||||
|
5 | hg init repo | |||
|
6 | cd repo | |||
|
7 | echo foo > foo | |||
|
8 | chmod 644 foo | |||
|
9 | hg ci -qAm '644' | |||
|
10 | ||||
|
11 | chmod 755 foo | |||
|
12 | hg ci -qAm '755' | |||
|
13 | ||||
|
14 | echo '% reverting to rev 0' | |||
|
15 | hg revert -a -r 0 | |||
|
16 | hg st | |||
|
17 | hg diff --git |
@@ -0,0 +1,6 b'' | |||||
|
1 | % reverting to rev 0 | |||
|
2 | reverting foo | |||
|
3 | M foo | |||
|
4 | diff --git a/foo b/foo | |||
|
5 | old mode 100755 | |||
|
6 | new mode 100644 |
@@ -1554,6 +1554,8 b' def init(ui, repo, **opts):' | |||||
1554 | if r: |
|
1554 | if r: | |
1555 | if not os.path.exists(r.wjoin('.hgignore')): |
|
1555 | if not os.path.exists(r.wjoin('.hgignore')): | |
1556 | fp = r.wopener('.hgignore', 'w') |
|
1556 | fp = r.wopener('.hgignore', 'w') | |
|
1557 | fp.write('^\\.hg\n') | |||
|
1558 | fp.write('^\\.mq\n') | |||
1557 | fp.write('syntax: glob\n') |
|
1559 | fp.write('syntax: glob\n') | |
1558 | fp.write('status\n') |
|
1560 | fp.write('status\n') | |
1559 | fp.write('guards\n') |
|
1561 | fp.write('guards\n') |
@@ -225,6 +225,7 b' def backout(ui, repo, node=None, rev=Non' | |||||
225 | revert_opts['date'] = None |
|
225 | revert_opts['date'] = None | |
226 | revert_opts['all'] = True |
|
226 | revert_opts['all'] = True | |
227 | revert_opts['rev'] = hex(parent) |
|
227 | revert_opts['rev'] = hex(parent) | |
|
228 | revert_opts['no_backup'] = None | |||
228 | revert(ui, repo, **revert_opts) |
|
229 | revert(ui, repo, **revert_opts) | |
229 | commit_opts = opts.copy() |
|
230 | commit_opts = opts.copy() | |
230 | commit_opts['addremove'] = False |
|
231 | commit_opts['addremove'] = False | |
@@ -2196,7 +2197,6 b' def revert(ui, repo, *pats, **opts):' | |||||
2196 | # but not other. |
|
2197 | # but not other. | |
2197 |
|
2198 | |||
2198 | names = {} |
|
2199 | names = {} | |
2199 | target_only = {} |
|
|||
2200 |
|
2200 | |||
2201 | wlock = repo.wlock() |
|
2201 | wlock = repo.wlock() | |
2202 | try: |
|
2202 | try: | |
@@ -2204,8 +2204,6 b' def revert(ui, repo, *pats, **opts):' | |||||
2204 | for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, |
|
2204 | for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, | |
2205 | badmatch=mf.has_key): |
|
2205 | badmatch=mf.has_key): | |
2206 | names[abs] = (rel, exact) |
|
2206 | names[abs] = (rel, exact) | |
2207 | if src == 'b': |
|
|||
2208 | target_only[abs] = True |
|
|||
2209 |
|
2207 | |||
2210 | # walk target manifest. |
|
2208 | # walk target manifest. | |
2211 |
|
2209 | |||
@@ -2223,10 +2221,9 b' def revert(ui, repo, *pats, **opts):' | |||||
2223 | if abs in names or src == 'b': |
|
2221 | if abs in names or src == 'b': | |
2224 | continue |
|
2222 | continue | |
2225 | names[abs] = (rel, exact) |
|
2223 | names[abs] = (rel, exact) | |
2226 | target_only[abs] = True |
|
2224 | ||
2227 |
|
2225 | changes = repo.status(match=names.has_key)[:4] | ||
2228 | changes = repo.status(match=names.has_key)[:5] |
|
2226 | modified, added, removed, deleted = map(dict.fromkeys, changes) | |
2229 | modified, added, removed, deleted, unknown = map(dict.fromkeys, changes) |
|
|||
2230 |
|
2227 | |||
2231 | # if f is a rename, also revert the source |
|
2228 | # if f is a rename, also revert the source | |
2232 | cwd = repo.getcwd() |
|
2229 | cwd = repo.getcwd() | |
@@ -2254,8 +2251,6 b' def revert(ui, repo, *pats, **opts):' | |||||
2254 | (added, revert, forget, True, False), |
|
2251 | (added, revert, forget, True, False), | |
2255 | (removed, undelete, None, False, False), |
|
2252 | (removed, undelete, None, False, False), | |
2256 | (deleted, revert, remove, False, False), |
|
2253 | (deleted, revert, remove, False, False), | |
2257 | (unknown, add, None, True, False), |
|
|||
2258 | (target_only, add, None, False, False), |
|
|||
2259 | ) |
|
2254 | ) | |
2260 |
|
2255 | |||
2261 | entries = names.items() |
|
2256 | entries = names.items() | |
@@ -2282,10 +2277,14 b' def revert(ui, repo, *pats, **opts):' | |||||
2282 | handle(hitlist, backuphit) |
|
2277 | handle(hitlist, backuphit) | |
2283 | elif misslist is not None: |
|
2278 | elif misslist is not None: | |
2284 | handle(misslist, backupmiss) |
|
2279 | handle(misslist, backupmiss) | |
2285 | else: |
|
|||
2286 | if exact: ui.warn(_('file not managed: %s\n') % rel) |
|
|||
2287 | break |
|
2280 | break | |
2288 | else: |
|
2281 | else: | |
|
2282 | if abs not in repo.dirstate: | |||
|
2283 | if mfentry: | |||
|
2284 | handle(add, True) | |||
|
2285 | elif exact: | |||
|
2286 | ui.warn(_('file not managed: %s\n') % rel) | |||
|
2287 | continue | |||
2289 | # file has not changed in dirstate |
|
2288 | # file has not changed in dirstate | |
2290 | if node == parent: |
|
2289 | if node == parent: | |
2291 | if exact: ui.warn(_('no changes needed to %s\n') % rel) |
|
2290 | if exact: ui.warn(_('no changes needed to %s\n') % rel) | |
@@ -2298,7 +2297,8 b' def revert(ui, repo, *pats, **opts):' | |||||
2298 | if mfentry: |
|
2297 | if mfentry: | |
2299 | # if version of file is same in parent and target |
|
2298 | # if version of file is same in parent and target | |
2300 | # manifests, do nothing |
|
2299 | # manifests, do nothing | |
2301 |
if pmf[abs] != mfentry |
|
2300 | if (pmf[abs] != mfentry or | |
|
2301 | pmf.flags(abs) != mf.flags(abs)): | |||
2302 | handle(revert, False) |
|
2302 | handle(revert, False) | |
2303 | else: |
|
2303 | else: | |
2304 | handle(remove, False) |
|
2304 | handle(remove, False) |
@@ -369,6 +369,14 b' class dirstate(object):' | |||||
369 | % (self.pathto(f), kind)) |
|
369 | % (self.pathto(f), kind)) | |
370 | return False |
|
370 | return False | |
371 |
|
371 | |||
|
372 | def _dirignore(self, f): | |||
|
373 | if self._ignore(f): | |||
|
374 | return True | |||
|
375 | for c in strutil.findall(f, '/'): | |||
|
376 | if self._ignore(f[:c]): | |||
|
377 | return True | |||
|
378 | return False | |||
|
379 | ||||
372 | def walk(self, files=None, match=util.always, badmatch=None): |
|
380 | def walk(self, files=None, match=util.always, badmatch=None): | |
373 | # filter out the stat |
|
381 | # filter out the stat | |
374 | for src, f, st in self.statwalk(files, match, badmatch=badmatch): |
|
382 | for src, f, st in self.statwalk(files, match, badmatch=badmatch): | |
@@ -404,9 +412,11 b' class dirstate(object):' | |||||
404 | return match(file_) |
|
412 | return match(file_) | |
405 |
|
413 | |||
406 | ignore = self._ignore |
|
414 | ignore = self._ignore | |
|
415 | dirignore = self._dirignore | |||
407 | if ignored: |
|
416 | if ignored: | |
408 | imatch = match |
|
417 | imatch = match | |
409 | ignore = util.never |
|
418 | ignore = util.never | |
|
419 | dirignore = util.never | |||
410 |
|
420 | |||
411 | # self._root may end with a path separator when self._root == '/' |
|
421 | # self._root may end with a path separator when self._root == '/' | |
412 | common_prefix_len = len(self._root) |
|
422 | common_prefix_len = len(self._root) | |
@@ -492,8 +502,9 b' class dirstate(object):' | |||||
492 | yield 'b', ff, None |
|
502 | yield 'b', ff, None | |
493 | continue |
|
503 | continue | |
494 | if s_isdir(st.st_mode): |
|
504 | if s_isdir(st.st_mode): | |
495 | for f, src, st in findfiles(f): |
|
505 | if not dirignore(nf): | |
496 |
|
|
506 | for f, src, st in findfiles(f): | |
|
507 | yield src, f, st | |||
497 | else: |
|
508 | else: | |
498 | if nf in known: |
|
509 | if nf in known: | |
499 | continue |
|
510 | continue | |
@@ -519,6 +530,7 b' class dirstate(object):' | |||||
519 | lookup, modified, added, unknown, ignored = [], [], [], [], [] |
|
530 | lookup, modified, added, unknown, ignored = [], [], [], [], [] | |
520 | removed, deleted, clean = [], [], [] |
|
531 | removed, deleted, clean = [], [], [] | |
521 |
|
532 | |||
|
533 | files = files or [] | |||
522 | _join = self._join |
|
534 | _join = self._join | |
523 | lstat = os.lstat |
|
535 | lstat = os.lstat | |
524 | cmap = self._copymap |
|
536 | cmap = self._copymap | |
@@ -536,8 +548,9 b' class dirstate(object):' | |||||
536 | if fn in dmap: |
|
548 | if fn in dmap: | |
537 | type_, mode, size, time, foo = dmap[fn] |
|
549 | type_, mode, size, time, foo = dmap[fn] | |
538 | else: |
|
550 | else: | |
539 | if list_ignored and self._ignore(fn): |
|
551 | if (list_ignored or fn in files) and self._dirignore(fn): | |
540 |
i |
|
552 | if list_ignored: | |
|
553 | iadd(fn) | |||
541 | else: |
|
554 | else: | |
542 | uadd(fn) |
|
555 | uadd(fn) | |
543 | continue |
|
556 | continue |
@@ -1,6 +1,6 b'' | |||||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
2 | <html> |
|
2 | <html> | |
3 | <head> |
|
3 | <head> | |
4 |
<link rel="icon" href="#staticurl#hgicon.png" type="image/png" |
|
4 | <link rel="icon" href="#staticurl#hgicon.png" type="image/png"> | |
5 | <meta name="robots" content="index, nofollow" /> |
|
5 | <meta name="robots" content="index, nofollow" /> | |
6 | <link rel="stylesheet" href="#staticurl#style.css" type="text/css" /> |
|
6 | <link rel="stylesheet" href="#staticurl#style.css" type="text/css" /> |
@@ -1,6 +1,6 b'' | |||||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
2 | <html> |
|
2 | <html> | |
3 | <head> |
|
3 | <head> | |
4 |
<link rel="icon" href="?static=hgicon.png" type="image/png" |
|
4 | <link rel="icon" href="?static=hgicon.png" type="image/png"> | |
5 | <meta name="robots" content="index, nofollow" /> |
|
5 | <meta name="robots" content="index, nofollow" /> | |
6 | <link rel="stylesheet" href="?static=style.css" type="text/css" /> |
|
6 | <link rel="stylesheet" href="?static=style.css" type="text/css" /> |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -24,7 +24,7 b' 404 Not Found' | |||||
24 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
24 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | |
25 | <html> |
|
25 | <html> | |
26 | <head> |
|
26 | <head> | |
27 |
<link rel="icon" href="/static/hgicon.png" type="image/png" |
|
27 | <link rel="icon" href="/static/hgicon.png" type="image/png"> | |
28 | <meta name="robots" content="index, nofollow" /> |
|
28 | <meta name="robots" content="index, nofollow" /> | |
29 | <link rel="stylesheet" href="/static/style.css" type="text/css" /> |
|
29 | <link rel="stylesheet" href="/static/style.css" type="text/css" /> | |
30 |
|
30 |
@@ -70,6 +70,8 b' A series' | |||||
70 | A test.patch |
|
70 | A test.patch | |
71 | % qinit; qinit -c |
|
71 | % qinit; qinit -c | |
72 | .hgignore: |
|
72 | .hgignore: | |
|
73 | ^\.hg | |||
|
74 | ^\.mq | |||
73 | syntax: glob |
|
75 | syntax: glob | |
74 | status |
|
76 | status | |
75 | guards |
|
77 | guards |
@@ -1,6 +1,7 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | hg init |
|
3 | hg init repo | |
|
4 | cd repo | |||
4 | echo 123 > a |
|
5 | echo 123 > a | |
5 | echo 123 > c |
|
6 | echo 123 > c | |
6 | echo 123 > e |
|
7 | echo 123 > e | |
@@ -40,19 +41,26 b' hg revert q' | |||||
40 | rm q |
|
41 | rm q | |
41 | echo %% should say file not found |
|
42 | echo %% should say file not found | |
42 | hg revert notfound |
|
43 | hg revert notfound | |
|
44 | touch d | |||
|
45 | hg add d | |||
43 | hg rm a |
|
46 | hg rm a | |
44 | hg commit -m "second" -d "1000000 0" |
|
47 | hg commit -m "second" -d "1000000 0" | |
45 | echo z > z |
|
48 | echo z > z | |
46 | hg add z |
|
49 | hg add z | |
47 | hg st |
|
50 | hg st | |
48 | echo %% should add a, forget z |
|
51 | echo %% should add a, remove d, forget z | |
49 | hg revert --all -r0 |
|
52 | hg revert --all -r0 | |
50 | echo %% should forget a |
|
53 | echo %% should forget a, undelete d | |
51 | hg revert --all -rtip |
|
54 | hg revert --all -rtip | |
52 | rm a *.orig |
|
55 | rm a *.orig | |
53 | echo %% should silently add a |
|
56 | echo %% should silently add a | |
54 | hg revert -r0 a |
|
57 | hg revert -r0 a | |
55 | hg st a |
|
58 | hg st a | |
|
59 | hg rm d | |||
|
60 | hg st d | |||
|
61 | echo %% should silently keep d removed | |||
|
62 | hg revert -r0 d | |||
|
63 | hg st d | |||
56 |
|
64 | |||
57 | hg update -C |
|
65 | hg update -C | |
58 | chmod +x c |
|
66 | chmod +x c | |
@@ -68,6 +76,8 b' hg revert --all' | |||||
68 | echo %% should print executable |
|
76 | echo %% should print executable | |
69 | test -x c && echo executable |
|
77 | test -x c && echo executable | |
70 |
|
78 | |||
|
79 | cd .. | |||
|
80 | ||||
71 | echo %% issue 241 |
|
81 | echo %% issue 241 | |
72 | hg init a |
|
82 | hg init a | |
73 | cd a |
|
83 | cd a | |
@@ -100,3 +110,33 b' hg mv a newa' | |||||
100 | hg revert newa |
|
110 | hg revert newa | |
101 | hg st a newa |
|
111 | hg st a newa | |
102 |
|
112 | |||
|
113 | cd .. | |||
|
114 | ||||
|
115 | hg init ignored | |||
|
116 | cd ignored | |||
|
117 | echo '^ignored$' > .hgignore | |||
|
118 | echo '^ignoreddir$' >> .hgignore | |||
|
119 | echo '^removed$' >> .hgignore | |||
|
120 | ||||
|
121 | mkdir ignoreddir | |||
|
122 | touch ignoreddir/file | |||
|
123 | touch ignoreddir/removed | |||
|
124 | touch ignored | |||
|
125 | touch removed | |||
|
126 | echo '%% 4 ignored files (we will add/commit everything)' | |||
|
127 | hg st -A -X .hgignore | |||
|
128 | hg ci -qAm 'add files' ignored ignoreddir/file ignoreddir/removed removed | |||
|
129 | ||||
|
130 | echo >> ignored | |||
|
131 | echo >> ignoreddir/file | |||
|
132 | hg rm removed ignoreddir/removed | |||
|
133 | echo '%% should revert ignored* and undelete *removed' | |||
|
134 | hg revert -a --no-backup | |||
|
135 | hg st -mardi | |||
|
136 | ||||
|
137 | hg up -qC | |||
|
138 | echo >> ignored | |||
|
139 | hg rm removed | |||
|
140 | echo %% should silently revert the named files | |||
|
141 | hg revert --no-backup ignored removed | |||
|
142 | hg st -mardi |
@@ -37,14 +37,19 b' notfound: No such file in rev 095eacd0c0' | |||||
37 | A z |
|
37 | A z | |
38 | ? b |
|
38 | ? b | |
39 | ? e.orig |
|
39 | ? e.orig | |
40 | %% should add a, forget z |
|
40 | %% should add a, remove d, forget z | |
41 | adding a |
|
41 | adding a | |
|
42 | removing d | |||
42 | forgetting z |
|
43 | forgetting z | |
43 | %% should forget a |
|
44 | %% should forget a, undelete d | |
44 | forgetting a |
|
45 | forgetting a | |
|
46 | undeleting d | |||
45 | %% should silently add a |
|
47 | %% should silently add a | |
46 | A a |
|
48 | A a | |
47 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
49 | R d | |
|
50 | %% should silently keep d removed | |||
|
51 | R d | |||
|
52 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
48 | reverting c |
|
53 | reverting c | |
49 | %% should print non-executable |
|
54 | %% should print non-executable | |
50 | non-executable |
|
55 | non-executable | |
@@ -65,3 +70,14 b' forgetting newdir/newfile' | |||||
65 | reverting b/b |
|
70 | reverting b/b | |
66 | % reverting a rename target should revert the source |
|
71 | % reverting a rename target should revert the source | |
67 | ? newa |
|
72 | ? newa | |
|
73 | %% 4 ignored files (we will add/commit everything) | |||
|
74 | I ignored | |||
|
75 | I ignoreddir/file | |||
|
76 | I ignoreddir/removed | |||
|
77 | I removed | |||
|
78 | %% should revert ignored* and undelete *removed | |||
|
79 | reverting ignored | |||
|
80 | reverting ignoreddir/file | |||
|
81 | undeleting ignoreddir/removed | |||
|
82 | undeleting removed | |||
|
83 | %% should silently revert the named files |
@@ -21,7 +21,7 b' cd ..' | |||||
21 | hg init repo2 |
|
21 | hg init repo2 | |
22 | cd repo2 |
|
22 | cd repo2 | |
23 | touch modified removed deleted ignored |
|
23 | touch modified removed deleted ignored | |
24 | echo "ignored" > .hgignore |
|
24 | echo "^ignored$" > .hgignore | |
25 | hg ci -A -m 'initial checkin' -d "1000000 0" |
|
25 | hg ci -A -m 'initial checkin' -d "1000000 0" | |
26 | sleep 1 # make sure mtime is changed |
|
26 | sleep 1 # make sure mtime is changed | |
27 | touch modified added unknown ignored |
|
27 | touch modified added unknown ignored | |
@@ -37,3 +37,10 b' echo "hg status -C:"' | |||||
37 | hg status -C |
|
37 | hg status -C | |
38 | echo "hg status -A:" |
|
38 | echo "hg status -A:" | |
39 | hg status -A |
|
39 | hg status -A | |
|
40 | echo "^ignoreddir$" > .hgignore | |||
|
41 | mkdir ignoreddir | |||
|
42 | touch ignoreddir/file | |||
|
43 | echo "hg status ignoreddir/file:" | |||
|
44 | hg status ignoreddir/file | |||
|
45 | echo "hg status -i ignoreddir/file:" | |||
|
46 | hg status -i ignoreddir/file |
@@ -99,7 +99,6 b' never-existed: No such file or directory' | |||||
99 | A added |
|
99 | A added | |
100 | R removed |
|
100 | R removed | |
101 | ! deleted |
|
101 | ! deleted | |
102 | ? ignored |
|
|||
103 | ? unknown |
|
102 | ? unknown | |
104 | hg status -C: |
|
103 | hg status -C: | |
105 | A added |
|
104 | A added | |
@@ -118,3 +117,6 b' R removed' | |||||
118 | I ignored |
|
117 | I ignored | |
119 | C .hgignore |
|
118 | C .hgignore | |
120 | C modified |
|
119 | C modified | |
|
120 | hg status ignoreddir/file: | |||
|
121 | hg status -i ignoreddir/file: | |||
|
122 | I ignoreddir/file |
@@ -93,6 +93,13 b' hg rm fenugreek' | |||||
93 | debugwalk fenugreek |
|
93 | debugwalk fenugreek | |
94 | touch new |
|
94 | touch new | |
95 | debugwalk new |
|
95 | debugwalk new | |
|
96 | ||||
|
97 | mkdir ignored | |||
|
98 | touch ignored/file | |||
|
99 | echo '^ignored$' > .hgignore | |||
|
100 | debugwalk ignored | |||
|
101 | debugwalk ignored/file | |||
|
102 | ||||
96 | chdir .. |
|
103 | chdir .. | |
97 | debugwalk -R t t/mammals/skunk |
|
104 | debugwalk -R t t/mammals/skunk | |
98 | mkdir t2 |
|
105 | mkdir t2 |
@@ -283,6 +283,11 b' m fenugreek fenugreek exact' | |||||
283 | hg debugwalk new |
|
283 | hg debugwalk new | |
284 | f new new exact |
|
284 | f new new exact | |
285 |
|
285 | |||
|
286 | hg debugwalk ignored | |||
|
287 | ||||
|
288 | hg debugwalk ignored/file | |||
|
289 | f ignored/file ignored/file exact | |||
|
290 | ||||
286 | cd .. |
|
291 | cd .. | |
287 |
|
292 | |||
288 | hg debugwalk -R t t/mammals/skunk |
|
293 | hg debugwalk -R t t/mammals/skunk |
General Comments 0
You need to be logged in to leave comments.
Login now