[PATCH 1 of 2] localrepo: support 'revhash' in repo syntax

Alexander Solovyov piranha at piranha.org.ua
Tue Nov 24 07:43:56 CST 2009


# HG changeset patch
# User Alexander Solovyov <piranha at piranha.org.ua>
# Date 1259065939 -7200
# Node ID 58f9a9b56889ade2eff4a570851d19824e3766fc
# Parent  6f92997dbdca1cec58eea2b43d86f238cae00471
localrepo: support 'revhash' in repo syntax

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -128,6 +128,12 @@ class localrepository(repo.repository):
             return context.workingctx(self)
         return context.changectx(self, changeid)
 
+    def __contains__(self, changeid):
+        try:
+            return bool(self.lookup(changeid))
+        except error.RepoLookupError:
+            return False
+
     def __nonzero__(self):
         return True
 


More information about the Mercurial-devel mailing list