Patchwork [2,of,3,two-rebase-fixes] rebase: loose the comparison to `nullmerge`

login
register
mail settings
Submitter Pierre-Yves David
Date Jan. 18, 2013, 10:50 p.m.
Message ID <124ad8551b284a700309.1358549458@yamac.lan>
Download mbox | patch
Permalink /patch/679/
State Superseded
Commit 26627c30735a610f59979a36885b327b25d8dbff
Headers show

Comments

Pierre-Yves David - Jan. 18, 2013, 10:50 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1358547692 -3600
# Node ID 124ad8551b284a700309b2c4cbcffb6b36385605
# Parent  b988bbf2c7783ff96aaef6a1a6dc025d140de975
rebase: loose 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.

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -290,11 +290,11 @@  def rebase(ui, repo, **opts):
             if collapsemsg:
                 commitmsg = collapsemsg
             else:
                 commitmsg = 'Collapsed revision'
                 for rebased in state:
-                    if rebased not in skipped and state[rebased] != nullmerge:
+                    if rebased not in skipped and state[rebased] > nullmerge:
                         commitmsg += '\n* %s' % repo[rebased].description()
                 commitmsg = ui.edit(commitmsg, repo.ui.username())
             newrev = concludenode(repo, rev, p1, external, commitmsg=commitmsg,
                                   extrafn=extrafn, editor=editor)
 
@@ -303,11 +303,11 @@  def rebase(ui, repo, **opts):
 
         if currentbookmarks:
             # Nodeids are needed to reset bookmarks
             nstate = {}
             for k, v in state.iteritems():
-                if v != nullmerge:
+                if v > nullmerge:
                     nstate[repo[k].node()] = repo[v].node()
 
         if not keepf:
             collapsedas = None
             if collapsef:
@@ -477,11 +477,11 @@  def updatemq(repo, state, skipped, **opt
 def updatebookmarks(repo, nstate, originalbookmarks, **opts):
     'Move bookmarks to their correct changesets'
     marks = repo._bookmarks
     for k, v in originalbookmarks.iteritems():
         if v in nstate:
-            if nstate[v] != nullmerge:
+            if nstate[v] > nullmerge:
                 # update the bookmarks for revs that have moved
                 marks[k] = nstate[v]
 
     marks.write()
 
@@ -495,11 +495,11 @@  def storestatus(repo, originalwd, target
     f.write('%d\n' % int(collapse))
     f.write('%d\n' % int(keep))
     f.write('%d\n' % int(keepbranches))
     for d, v in state.iteritems():
         oldrev = repo[d].hex()
-        if v != nullmerge:
+        if v > nullmerge:
             newrev = repo[v].hex()
         else:
             newrev = v
         f.write("%s:%s\n" % (oldrev, newrev))
     f.close()
@@ -677,11 +677,11 @@  def clearrebased(ui, repo, state, skippe
                     succs = (repo[newrev],)
                 markers.append((repo[rev], succs))
         if markers:
             obsolete.createmarkers(repo, markers)
     else:
-        rebased = [rev for rev in state if state[rev] != nullmerge]
+        rebased = [rev for rev in state if state[rev] > nullmerge]
         if rebased:
             stripped = []
             for root in repo.set('roots(%ld)', rebased):
                 if set(repo.changelog.descendants([root.rev()])) - set(state):
                     ui.warn(_("warning: new changesets detected "