D7651: nodetree: simplify a conditionnal in shortesthexnodeidprefix

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Thu Dec 19 13:10:03 EST 2019


marmoute updated this revision to Diff 18886.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7651?vs=18806&id=18886

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7651/new/

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -545,12 +545,10 @@
             if cache is not None:
                 nodetree = cache.get(b'disambiguationnodetree')
             if not nodetree:
-                try:
+                if util.safehasattr(parsers, 'nodetree'):
+                    # The CExt is the only implementation to provide a nodetree
+                    # class so far.
                     nodetree = parsers.nodetree(cl.index, len(revs))
-                except AttributeError:
-                    # no native nodetree
-                    pass
-                else:
                     for r in revs:
                         nodetree.insert(r)
                     if cache is not None:



To: marmoute, #hg-reviewers, pulkit
Cc: mercurial-devel


More information about the Mercurial-devel mailing list