Patchwork D3139: rebase: convert "oldrev" to revnum earlier

login
register
mail settings
Submitter phabricator
Date April 5, 2018, 5:47 p.m.
Message ID <differential-rev-PHID-DREV-hhormrkqr46mawveasvx-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30393/
State Superseded
Headers show

Comments

phabricator - April 5, 2018, 5:47 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  It was done in 3 places before, now just 1.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3139

AFFECTED FILES
  hgext/rebase.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - April 5, 2018, 5:57 p.m.
quark accepted this revision.
quark added a comment.


  Nice catch. I guess my initial consideration was `oldrev` was not always a valid node. But it seems no longer a concern.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3139

To: martinvonz, #hg-reviewers, quark
Cc: quark, mercurial-devel

Patch

diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -243,20 +243,20 @@ 
                     activebookmark = l
                 else:
                     args = l.split(':')
-                    oldrev = args[0]
+                    oldrev = repo[args[0]].rev()
                     newrev = args[1]
                     if newrev in legacystates:
                         continue
                     if len(args) > 2:
                         destrev = repo[args[2]].rev()
                     else:
                         destrev = legacydest
-                    destmap[repo[oldrev].rev()] = destrev
+                    destmap[oldrev] = destrev
                     if newrev in (nullid, revtodostr):
-                        state[repo[oldrev].rev()] = revtodo
+                        state[oldrev] = revtodo
                         # Legacy compat special case
                     else:
-                        state[repo[oldrev].rev()] = repo[newrev].rev()
+                        state[oldrev] = repo[newrev].rev()
 
         except IOError as err:
             if err.errno != errno.ENOENT: