Commits

Yuya Nishihara  committed 85f34af

hglib: split function to look up first revision label for ctx (refs #3339)

  • Participants
  • Parent commits 07bb966
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/util/hglib.py

     _maxdiff = maxdiff * 1024
     return _maxdiff
 
-def getrevisionlabel(repo, rev):
-    """Return symbolic name for the specified revision or stringfy it"""
-    if rev is None:
-        return None  # no symbol for working revision
-
+def _getfirstrevisionlabel(repo, ctx):
     # see context.changectx for look-up order of labels
-    ctx = repo[rev]
 
     bookmarks = ctx.bookmarks()
     if ctx in repo.parents():
     if repo.branchtip(branch) == ctx.node():
         return branch
 
+def getrevisionlabel(repo, rev):
+    """Return symbolic name for the specified revision or stringfy it"""
+    if rev is None:
+        return None  # no symbol for working revision
+
+    ctx = repo[rev]
+    label = _getfirstrevisionlabel(repo, ctx)
+    if label:
+        return label
+
     return str(rev)
 
 _deadbranch = None