revlog: add hasnode helper method
authorMatt Mackall <mpm@selenic.com>
Sat, 07 Apr 2012 15:43:18 -0500
changeset 16374 29c2ff719715
parent 16373 329887a7074c
child 16375 d7d64b89a65c
revlog: add hasnode helper method
mercurial/revlog.py
--- a/mercurial/revlog.py	Fri Apr 06 15:18:14 2012 -0500
+++ b/mercurial/revlog.py	Sat Apr 07 15:43:18 2012 -0500
@@ -288,6 +288,13 @@
         self.rev(self.node(0))
         return self._nodecache
 
+    def hasnode(self, node):
+        try:
+            self.rev(node)
+            return True
+        except KeyError:
+            return False
+
     def rev(self, node):
         try:
             return self._nodecache[node]