##// END OF EJS Templates
backout: disallow across branches (issue655)
Matt Mackall -
r5568:de620356 default
parent child Browse files
Show More
@@ -194,6 +194,11 b' def backout(ui, repo, node=None, rev=Non'
194 if op2 != nullid:
194 if op2 != nullid:
195 raise util.Abort(_('outstanding uncommitted merge'))
195 raise util.Abort(_('outstanding uncommitted merge'))
196 node = repo.lookup(rev)
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 p1, p2 = repo.changelog.parents(node)
202 p1, p2 = repo.changelog.parents(node)
198 if p1 == nullid:
203 if p1 == nullid:
199 raise util.Abort(_('cannot back out a change with no parents'))
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 if opts['parent']:
215 if opts['parent']:
211 raise util.Abort(_('cannot use --parent on non-merge changeset'))
216 raise util.Abort(_('cannot use --parent on non-merge changeset'))
212 parent = p1
217 parent = p1
218
213 hg.clean(repo, node, show_stats=False)
219 hg.clean(repo, node, show_stats=False)
214 revert_opts = opts.copy()
220 revert_opts = opts.copy()
215 revert_opts['date'] = None
221 revert_opts['date'] = None
@@ -37,6 +37,22 b" echo '# backout of backout is as if noth"
37 hg backout -d '3 0' --merge tip
37 hg backout -d '3 0' --merge tip
38 cat a 2>/dev/null || echo cat: a: No such file or directory
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 echo '# backout with merge'
56 echo '# backout with merge'
41 cd ..
57 cd ..
42 hg init merge
58 hg init merge
@@ -15,6 +15,13 b' content'
15 removing a
15 removing a
16 changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d
16 changeset 3:7f6d0f120113 backs out changeset 2:de31bdc76c0d
17 cat: a: No such file or directory
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 # backout with merge
25 # backout with merge
19 adding a
26 adding a
20 reverting a
27 reverting a
General Comments 0
You need to be logged in to leave comments. Login now