Patchwork D3451: context: clarify that only one attempt is made to interpret changeid

login
register
mail settings
Submitter phabricator
Date May 7, 2018, 12:54 p.m.
Message ID <3b952015bda769f51a44629271cbfde5@localhost.localdomain>
Download mbox | patch
Permalink /patch/31297/
State Not Applicable
Headers show

Comments

phabricator - May 7, 2018, 12:54 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbb8e93b332a7: context: clarify that only one attempt is made to interpret changeid (authored by martinvonz, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D3451?vs=8468&id=8477#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3451?vs=8468&id=8477

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

AFFECTED FILES
  mercurial/context.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -389,22 +389,22 @@ 
                 self._node = repo.changelog.node(changeid)
                 self._rev = changeid
                 return
-            if changeid == 'null':
+            elif changeid == 'null':
                 self._node = nullid
                 self._rev = nullrev
                 return
-            if changeid == 'tip':
+            elif changeid == 'tip':
                 self._node = repo.changelog.tip()
                 self._rev = repo.changelog.rev(self._node)
                 return
-            if (changeid == '.'
-                or repo.local() and changeid == repo.dirstate.p1()):
+            elif (changeid == '.'
+                  or repo.local() and changeid == repo.dirstate.p1()):
                 # this is a hack to delay/avoid loading obsmarkers
                 # when we know that '.' won't be hidden
                 self._node = repo.dirstate.p1()
                 self._rev = repo.unfiltered().changelog.rev(self._node)
                 return
-            if len(changeid) == 20:
+            elif len(changeid) == 20:
                 try:
                     self._node = changeid
                     self._rev = repo.changelog.rev(changeid)
@@ -421,7 +421,7 @@ 
                         msg = _("working directory has unknown parent '%s'!")
                         raise error.Abort(msg % short(changeid))
 
-            if len(changeid) == 40:
+            elif len(changeid) == 40:
                 try:
                     self._node = bin(changeid)
                     self._rev = repo.changelog.rev(self._node)