##// END OF EJS Templates
rebase: fix --collapse with --keepbranches (issue2100)...
Patrick Mezard -
r10762:129e96f7 stable
parent child Browse files
Show More
@@ -161,10 +161,7 b' def rebase(ui, repo, **opts):'
161 'resolve then run hg rebase --continue'))
161 'resolve then run hg rebase --continue'))
162 updatedirstate(repo, rev, target, p2)
162 updatedirstate(repo, rev, target, p2)
163 if not collapsef:
163 if not collapsef:
164 extra = {'rebase_source': repo[rev].hex()}
164 newrev = concludenode(repo, rev, p1, p2, extrafn=extrafn)
165 if extrafn:
166 extrafn(repo[rev], extra)
167 newrev = concludenode(repo, rev, p1, p2, extra=extra)
168 else:
165 else:
169 # Skip commit if we are collapsing
166 # Skip commit if we are collapsing
170 repo.dirstate.setparents(repo[p1].node())
167 repo.dirstate.setparents(repo[p1].node())
@@ -190,7 +187,7 b' def rebase(ui, repo, **opts):'
190 commitmsg += '\n* %s' % repo[rebased].description()
187 commitmsg += '\n* %s' % repo[rebased].description()
191 commitmsg = ui.edit(commitmsg, repo.ui.username())
188 commitmsg = ui.edit(commitmsg, repo.ui.username())
192 newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
189 newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
193 extra=extrafn)
190 extrafn=extrafn)
194
191
195 if 'qtip' in repo.tags():
192 if 'qtip' in repo.tags():
196 updatemq(repo, state, skipped, **opts)
193 updatemq(repo, state, skipped, **opts)
@@ -266,17 +263,19 b' def updatedirstate(repo, rev, p1, p2):'
266 if v in m2 and v not in m1:
263 if v in m2 and v not in m1:
267 repo.dirstate.remove(v)
264 repo.dirstate.remove(v)
268
265
269 def concludenode(repo, rev, p1, p2, commitmsg=None, extra=None):
266 def concludenode(repo, rev, p1, p2, commitmsg=None, extrafn=None):
270 'Commit the changes and store useful information in extra'
267 'Commit the changes and store useful information in extra'
271 try:
268 try:
272 repo.dirstate.setparents(repo[p1].node(), repo[p2].node())
269 repo.dirstate.setparents(repo[p1].node(), repo[p2].node())
273 if commitmsg is None:
270 if commitmsg is None:
274 commitmsg = repo[rev].description()
271 commitmsg = repo[rev].description()
275 if extra is None:
272 ctx = repo[rev]
276 extra = {}
273 extra = {'rebase_source': ctx.hex()}
274 if extrafn:
275 extrafn(ctx, extra)
277 # Commit might fail if unresolved files exist
276 # Commit might fail if unresolved files exist
278 newrev = repo.commit(text=commitmsg, user=repo[rev].user(),
277 newrev = repo.commit(text=commitmsg, user=ctx.user(),
279 date=repo[rev].date(), extra=extra)
278 date=ctx.date(), extra=extra)
280 repo.dirstate.setbranch(repo[newrev].branch())
279 repo.dirstate.setbranch(repo[newrev].branch())
281 return newrev
280 return newrev
282 except util.Abort:
281 except util.Abort:
@@ -43,7 +43,7 b' createrepo > /dev/null 2>&1'
43 hg glog --template '{rev}: {desc}\n'
43 hg glog --template '{rev}: {desc}\n'
44 echo '% Rebasing B onto H'
44 echo '% Rebasing B onto H'
45 hg up -C 3
45 hg up -C 3
46 hg rebase --collapse 2>&1 | sed 's/\(saving bundle to \).*/\1/'
46 hg rebase --collapse --keepbranches 2>&1 | sed 's/\(saving bundle to \).*/\1/'
47 hg glog --template '{rev}: {desc}\n'
47 hg glog --template '{rev}: {desc}\n'
48 echo "Expected A, B, C, D, F, H"
48 echo "Expected A, B, C, D, F, H"
49 hg manifest
49 hg manifest
General Comments 0
You need to be logged in to leave comments. Login now