Show More
@@ -194,6 +194,11 b' def backout(ui, repo, node=None, rev=Non' | |||
|
194 | 194 | if op2 != nullid: |
|
195 | 195 | raise util.Abort(_('outstanding uncommitted merge')) |
|
196 | 196 | node = repo.lookup(rev) |
|
197 | ||
|
198 | a = repo.changelog.ancestor(op1, node) | |
|
199 | if a != node: | |
|
200 | raise util.Abort(_('cannot back out change on a different branch')) | |
|
201 | ||
|
197 | 202 | p1, p2 = repo.changelog.parents(node) |
|
198 | 203 | if p1 == nullid: |
|
199 | 204 | raise util.Abort(_('cannot back out a change with no parents')) |
@@ -210,6 +215,7 b' def backout(ui, repo, node=None, rev=Non' | |||
|
210 | 215 | if opts['parent']: |
|
211 | 216 | raise util.Abort(_('cannot use --parent on non-merge changeset')) |
|
212 | 217 | parent = p1 |
|
218 | ||
|
213 | 219 | hg.clean(repo, node, show_stats=False) |
|
214 | 220 | revert_opts = opts.copy() |
|
215 | 221 | revert_opts['date'] = None |
@@ -37,6 +37,22 b" echo '# backout of backout is as if noth" | |||
|
37 | 37 | hg backout -d '3 0' --merge tip |
|
38 | 38 | cat a 2>/dev/null || echo cat: a: No such file or directory |
|
39 | 39 | |
|
40 | echo '# across branch' | |
|
41 | cd .. | |
|
42 | hg init branch | |
|
43 | cd branch | |
|
44 | echo a > a | |
|
45 | hg ci -Am0 -d '0 0' | |
|
46 | echo b > b | |
|
47 | hg ci -Am1 -d '0 0' | |
|
48 | hg co -C 0 | |
|
49 | # should fail | |
|
50 | hg backout -d '0 0' 1 | |
|
51 | echo c > c | |
|
52 | hg ci -Am2 -d '0 0' | |
|
53 | # should fail | |
|
54 | hg backout -d '0 0' 1 | |
|
55 | ||
|
40 | 56 | echo '# backout with merge' |
|
41 | 57 | cd .. |
|
42 | 58 | hg init merge |
@@ -15,6 +15,13 b' content' | |||
|
15 | 15 | removing a |
|
16 | 16 | changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d |
|
17 | 17 | cat: a: No such file or directory |
|
18 | # across branch | |
|
19 | adding a | |
|
20 | adding b | |
|
21 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
22 | abort: cannot back out change on a different branch | |
|
23 | adding c | |
|
24 | abort: cannot back out change on a different branch | |
|
18 | 25 | # backout with merge |
|
19 | 26 | adding a |
|
20 | 27 | reverting a |
General Comments 0
You need to be logged in to leave comments.
Login now