[PATCH 1 of 3] store: add a __contains__ method to basicstore which checks if the supplied path exists in the store
S Muralidhar
smuralid at yahoo.com
Thu Sep 13 12:41:26 CDT 2012
# HG changeset patch
# User smuralid
# Date 1347510230 25200
# Node ID d6d5af14c18dcc7f483d1fc069660255d16d034a
# Parent 8fea378242e317d2311c86436ed45e95821513e4
store: add a __contains__ method to basicstore which checks if the supplied path exists in the store
diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -286,6 +286,10 @@
def write(self):
pass
+ def __contains__(self, path):
+ '''Checks if this path exists in the store'''
+ return self.opener.exists(path)
+
class encodedstore(basicstore):
def __init__(self, path, openertype):
self.path = path + '/store'
More information about the Mercurial-devel
mailing list