Patchwork D3193: scmutil: handle full hex nodeids in revsymbol()

login
register
mail settings
Submitter phabricator
Date April 11, 2018, 12:32 p.m.
Message ID <cc97bfeeaf4f23a02bec2f70011db61c@localhost.localdomain>
Download mbox | patch
Permalink /patch/30688/
State Not Applicable
Headers show

Comments

phabricator - April 11, 2018, 12:32 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd2b484eed1ec: scmutil: handle full hex nodeids in revsymbol() (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3193?vs=7885&id=7974

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -18,6 +18,7 @@ 
 
 from .i18n import _
 from .node import (
+    bin,
     hex,
     nullid,
     short,
@@ -479,8 +480,20 @@ 
         except (ValueError, OverflowError, IndexError):
             pass
 
+        if len(symbol) == 40:
+            try:
+                node = bin(symbol)
+                rev = repo.changelog.rev(node)
+                return repo[rev]
+            except error.FilteredLookupError:
+                raise
+            except (TypeError, LookupError):
+                pass
+
         return repo[symbol]
 
+    except error.WdirUnsupported:
+        return repo[None]
     except (error.FilteredIndexError, error.FilteredLookupError,
             error.FilteredRepoLookupError):
         raise _filterederror(repo, symbol)