comparison hgext/rebase.py @ 18446:c83d36b81df1

rebase: lose the comparison to `nullmerge` For a proper behavior of the `--rev` revision we will need another possible state for revision ignored by rebase. We alter the comparison to `nullmerge` to match this future lower state too.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 18 Jan 2013 23:21:32 +0100
parents 55aff0c2b73c
children 7159426c8d13
comparison
equal deleted inserted replaced
18445:4d92e2d75cff 18446:c83d36b81df1
290 if collapsemsg: 290 if collapsemsg:
291 commitmsg = collapsemsg 291 commitmsg = collapsemsg
292 else: 292 else:
293 commitmsg = 'Collapsed revision' 293 commitmsg = 'Collapsed revision'
294 for rebased in state: 294 for rebased in state:
295 if rebased not in skipped and state[rebased] != nullmerge: 295 if rebased not in skipped and state[rebased] > nullmerge:
296 commitmsg += '\n* %s' % repo[rebased].description() 296 commitmsg += '\n* %s' % repo[rebased].description()
297 commitmsg = ui.edit(commitmsg, repo.ui.username()) 297 commitmsg = ui.edit(commitmsg, repo.ui.username())
298 newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg, 298 newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
299 extrafn=extrafn, editor=editor) 299 extrafn=extrafn, editor=editor)
300 300
303 303
304 if currentbookmarks: 304 if currentbookmarks:
305 # Nodeids are needed to reset bookmarks 305 # Nodeids are needed to reset bookmarks
306 nstate = {} 306 nstate = {}
307 for k, v in state.iteritems(): 307 for k, v in state.iteritems():
308 if v != nullmerge: 308 if v > nullmerge:
309 nstate[repo[k].node()] = repo[v].node() 309 nstate[repo[k].node()] = repo[v].node()
310 310
311 if not keepf: 311 if not keepf:
312 collapsedas = None 312 collapsedas = None
313 if collapsef: 313 if collapsef:
477 def updatebookmarks(repo, nstate, originalbookmarks, **opts): 477 def updatebookmarks(repo, nstate, originalbookmarks, **opts):
478 'Move bookmarks to their correct changesets' 478 'Move bookmarks to their correct changesets'
479 marks = repo._bookmarks 479 marks = repo._bookmarks
480 for k, v in originalbookmarks.iteritems(): 480 for k, v in originalbookmarks.iteritems():
481 if v in nstate: 481 if v in nstate:
482 if nstate[v] != nullmerge: 482 if nstate[v] > nullmerge:
483 # update the bookmarks for revs that have moved 483 # update the bookmarks for revs that have moved
484 marks[k] = nstate[v] 484 marks[k] = nstate[v]
485 485
486 marks.write() 486 marks.write()
487 487
495 f.write('%d\n' % int(collapse)) 495 f.write('%d\n' % int(collapse))
496 f.write('%d\n' % int(keep)) 496 f.write('%d\n' % int(keep))
497 f.write('%d\n' % int(keepbranches)) 497 f.write('%d\n' % int(keepbranches))
498 for d, v in state.iteritems(): 498 for d, v in state.iteritems():
499 oldrev = repo[d].hex() 499 oldrev = repo[d].hex()
500 if v != nullmerge: 500 if v > nullmerge:
501 newrev = repo[v].hex() 501 newrev = repo[v].hex()
502 else: 502 else:
503 newrev = v 503 newrev = v
504 f.write("%s:%s\n" % (oldrev, newrev)) 504 f.write("%s:%s\n" % (oldrev, newrev))
505 f.close() 505 f.close()
677 succs = (repo[newrev],) 677 succs = (repo[newrev],)
678 markers.append((repo[rev], succs)) 678 markers.append((repo[rev], succs))
679 if markers: 679 if markers:
680 obsolete.createmarkers(repo, markers) 680 obsolete.createmarkers(repo, markers)
681 else: 681 else:
682 rebased = [rev for rev in state if state[rev] != nullmerge] 682 rebased = [rev for rev in state if state[rev] > nullmerge]
683 if rebased: 683 if rebased:
684 stripped = [] 684 stripped = []
685 for root in repo.set('roots(%ld)', rebased): 685 for root in repo.set('roots(%ld)', rebased):
686 if set(repo.changelog.descendants([root.rev()])) - set(state): 686 if set(repo.changelog.descendants([root.rev()])) - set(state):
687 ui.warn(_("warning: new changesets detected " 687 ui.warn(_("warning: new changesets detected "