changeset 16374:29c2ff719715

revlog: add hasnode helper method
author Matt Mackall <mpm@selenic.com>
date Sat, 07 Apr 2012 15:43:18 -0500
parents 329887a7074c
children d7d64b89a65c
files mercurial/revlog.py
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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]