##// END OF EJS Templates
rebase: return early when source is descendant of destination...
Sune Foldager -
r9578:341182ac default
parent child Browse files
Show More
@@ -401,6 +401,10 b' def buildstate(repo, dest, src, base, co'
401 return None
401 return None
402
402
403 cwdancestors = set(repo.changelog.ancestors(cwd))
403 cwdancestors = set(repo.changelog.ancestors(cwd))
404 if dest in cwdancestors:
405 repo.ui.debug('source is descendant of destination\n')
406 return None
407
404 cwdancestors.add(cwd)
408 cwdancestors.add(cwd)
405 rebasingbranch = cwdancestors - targetancestors
409 rebasingbranch = cwdancestors - targetancestors
406 source = min(rebasingbranch)
410 source = min(rebasingbranch)
@@ -70,7 +70,7 b" echo '% D onto B - E maintains C as pare"
70 hg rebase -s 3 -d 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
70 hg rebase -s 3 -d 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
71 hg glog --template '{rev}: {desc}\n'
71 hg glog --template '{rev}: {desc}\n'
72
72
73 echo '% These will fail'
73 echo '% These will fail (using --source)'
74 createrepo > /dev/null 2>&1
74 createrepo > /dev/null 2>&1
75 echo '% E onto D - rebase onto an ancestor'
75 echo '% E onto D - rebase onto an ancestor'
76 hg rebase -s 4 -d 3
76 hg rebase -s 4 -d 3
@@ -79,4 +79,13 b' hg rebase -s 3 -d 4'
79 echo '% E onto B - merge revision with both parents not in ancestors of target'
79 echo '% E onto B - merge revision with both parents not in ancestors of target'
80 hg rebase -s 4 -d 1
80 hg rebase -s 4 -d 1
81
81
82 echo
83 echo '% These will abort gracefully (using --base)'
84 echo '% E onto E - rebase onto same changeset'
85 hg rebase -b 4 -d 4
86 echo '% E onto D - rebase onto an ancestor'
87 hg rebase -b 4 -d 3
88 echo '% D onto E - rebase onto a descendant'
89 hg rebase -b 3 -d 4
90
82 exit 0
91 exit 0
@@ -127,10 +127,18 b' o | 1: B'
127 |/
127 |/
128 o 0: A
128 o 0: A
129
129
130 % These will fail
130 % These will fail (using --source)
131 % E onto D - rebase onto an ancestor
131 % E onto D - rebase onto an ancestor
132 abort: source is descendant of destination
132 abort: source is descendant of destination
133 % D onto E - rebase onto a descendant
133 % D onto E - rebase onto a descendant
134 abort: source is ancestor of destination
134 abort: source is ancestor of destination
135 % E onto B - merge revision with both parents not in ancestors of target
135 % E onto B - merge revision with both parents not in ancestors of target
136 abort: cannot use revision 4 as base, result would have 3 parents
136 abort: cannot use revision 4 as base, result would have 3 parents
137
138 % These will abort gracefully (using --base)
139 % E onto E - rebase onto same changeset
140 nothing to rebase
141 % E onto D - rebase onto an ancestor
142 nothing to rebase
143 % D onto E - rebase onto a descendant
144 nothing to rebase
General Comments 0
You need to be logged in to leave comments. Login now