diff mercurial/scmutil.py @ 38136:e32dfff71529

revset: use revsymbol() for checking if a symbol is valid Differential Revision: https://phab.mercurial-scm.org/D3078
author Martin von Zweigbergk <martinvonz@google.com>
date Sun, 01 Apr 2018 22:48:32 -0700 (2018-04-02)
parents 6942c73f0733
children d0d55980ffa7
line wrap: on
line diff
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -433,6 +433,13 @@
         hexfunc = short
     return '%d:%s' % (rev, hexfunc(node))
 
+def isrevsymbol(repo, symbol):
+    try:
+        revsymbol(repo, symbol)
+        return True
+    except error.RepoLookupError:
+        return False
+
 def revsymbol(repo, symbol):
     """Returns a context given a single revision symbol (as string).