Show More
@@ -215,6 +215,7 b' def backout(ui, repo, node=None, rev=Non' | |||
|
215 | 215 | revert_opts['date'] = None |
|
216 | 216 | revert_opts['all'] = True |
|
217 | 217 | revert_opts['rev'] = hex(parent) |
|
218 | revert_opts['no_backup'] = None | |
|
218 | 219 | revert(ui, repo, **revert_opts) |
|
219 | 220 | commit_opts = opts.copy() |
|
220 | 221 | commit_opts['addremove'] = False |
@@ -2327,7 +2328,6 b' def revert(ui, repo, *pats, **opts):' | |||
|
2327 | 2328 | # but not other. |
|
2328 | 2329 | |
|
2329 | 2330 | names = {} |
|
2330 | target_only = {} | |
|
2331 | 2331 | |
|
2332 | 2332 | wlock = repo.wlock() |
|
2333 | 2333 | try: |
@@ -2335,8 +2335,6 b' def revert(ui, repo, *pats, **opts):' | |||
|
2335 | 2335 | for src, abs, rel, exact in cmdutil.walk(repo, pats, opts, |
|
2336 | 2336 | badmatch=mf.has_key): |
|
2337 | 2337 | names[abs] = (rel, exact) |
|
2338 | if src == 'b': | |
|
2339 | target_only[abs] = True | |
|
2340 | 2338 | |
|
2341 | 2339 | # walk target manifest. |
|
2342 | 2340 | |
@@ -2354,10 +2352,9 b' def revert(ui, repo, *pats, **opts):' | |||
|
2354 | 2352 | if abs in names or src == 'b': |
|
2355 | 2353 | continue |
|
2356 | 2354 | names[abs] = (rel, exact) |
|
2357 | target_only[abs] = True | |
|
2358 | ||
|
2359 | changes = repo.status(match=names.has_key)[:5] | |
|
2360 | modified, added, removed, deleted, unknown = map(dict.fromkeys, changes) | |
|
2355 | ||
|
2356 | changes = repo.status(match=names.has_key)[:4] | |
|
2357 | modified, added, removed, deleted = map(dict.fromkeys, changes) | |
|
2361 | 2358 | |
|
2362 | 2359 | # if f is a rename, also revert the source |
|
2363 | 2360 | cwd = repo.getcwd() |
@@ -2385,8 +2382,6 b' def revert(ui, repo, *pats, **opts):' | |||
|
2385 | 2382 | (added, revert, forget, True, False), |
|
2386 | 2383 | (removed, undelete, None, False, False), |
|
2387 | 2384 | (deleted, revert, remove, False, False), |
|
2388 | (unknown, add, None, True, False), | |
|
2389 | (target_only, add, None, False, False), | |
|
2390 | 2385 | ) |
|
2391 | 2386 | |
|
2392 | 2387 | entries = names.items() |
@@ -2413,10 +2408,14 b' def revert(ui, repo, *pats, **opts):' | |||
|
2413 | 2408 | handle(hitlist, backuphit) |
|
2414 | 2409 | elif misslist is not None: |
|
2415 | 2410 | handle(misslist, backupmiss) |
|
2416 | else: | |
|
2417 | if exact: ui.warn(_('file not managed: %s\n') % rel) | |
|
2418 | 2411 | break |
|
2419 | 2412 | else: |
|
2413 | if abs not in repo.dirstate: | |
|
2414 | if mfentry: | |
|
2415 | handle(add, True) | |
|
2416 | elif exact: | |
|
2417 | ui.warn(_('file not managed: %s\n') % rel) | |
|
2418 | continue | |
|
2420 | 2419 | # file has not changed in dirstate |
|
2421 | 2420 | if node == parent: |
|
2422 | 2421 | if exact: ui.warn(_('no changes needed to %s\n') % rel) |
@@ -1,6 +1,7 b'' | |||
|
1 | 1 | #!/bin/sh |
|
2 | 2 | |
|
3 | hg init | |
|
3 | hg init repo | |
|
4 | cd repo | |
|
4 | 5 | echo 123 > a |
|
5 | 6 | echo 123 > c |
|
6 | 7 | echo 123 > e |
@@ -40,19 +41,26 b' hg revert q' | |||
|
40 | 41 | rm q |
|
41 | 42 | echo %% should say file not found |
|
42 | 43 | hg revert notfound |
|
44 | touch d | |
|
45 | hg add d | |
|
43 | 46 | hg rm a |
|
44 | 47 | hg commit -m "second" -d "1000000 0" |
|
45 | 48 | echo z > z |
|
46 | 49 | hg add z |
|
47 | 50 | hg st |
|
48 | echo %% should add a, forget z | |
|
51 | echo %% should add a, remove d, forget z | |
|
49 | 52 | hg revert --all -r0 |
|
50 | echo %% should forget a | |
|
53 | echo %% should forget a, undelete d | |
|
51 | 54 | hg revert --all -rtip |
|
52 | 55 | rm a *.orig |
|
53 | 56 | echo %% should silently add a |
|
54 | 57 | hg revert -r0 a |
|
55 | 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 | 65 | hg update -C |
|
58 | 66 | chmod +x c |
@@ -68,6 +76,8 b' hg revert --all' | |||
|
68 | 76 | echo %% should print executable |
|
69 | 77 | test -x c && echo executable |
|
70 | 78 | |
|
79 | cd .. | |
|
80 | ||
|
71 | 81 | echo %% issue 241 |
|
72 | 82 | hg init a |
|
73 | 83 | cd a |
@@ -100,3 +110,33 b' hg mv a newa' | |||
|
100 | 110 | hg revert newa |
|
101 | 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 | 37 | A z |
|
38 | 38 | ? b |
|
39 | 39 | ? e.orig |
|
40 | %% should add a, forget z | |
|
40 | %% should add a, remove d, forget z | |
|
41 | 41 | adding a |
|
42 | removing d | |
|
42 | 43 | forgetting z |
|
43 | %% should forget a | |
|
44 | %% should forget a, undelete d | |
|
44 | 45 | forgetting a |
|
46 | undeleting d | |
|
45 | 47 | %% should silently add a |
|
46 | 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 | 53 | reverting c |
|
49 | 54 | %% should print non-executable |
|
50 | 55 | non-executable |
@@ -65,3 +70,14 b' forgetting newdir/newfile' | |||
|
65 | 70 | reverting b/b |
|
66 | 71 | % reverting a rename target should revert the source |
|
67 | 72 | ? newa |
|
73 | %% 4 ignored files (we will add/commit everything) | |
|
74 | ? ignoreddir/file | |
|
75 | ? ignoreddir/removed | |
|
76 | I ignored | |
|
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 |
General Comments 0
You need to be logged in to leave comments.
Login now