Mercurial > hg
changeset 17783:df55ce6854c3
store: add new _exists helper function on fncachestore
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Fri, 12 Oct 2012 10:52:32 +0200 |
parents | 8095306c1fb2 |
children | 73e1ab39792c |
files | mercurial/store.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/store.py Fri Oct 12 10:40:09 2012 +0200 +++ b/mercurial/store.py Fri Oct 12 10:52:32 2012 +0200 @@ -512,6 +512,17 @@ def write(self): self.fncache.write() + def _exists(self, f): + ef = self.encode(f) + try: + self.getsize(ef) + return True + except OSError, err: + if err.errno != errno.ENOENT: + raise + # nonexistent entry + return False + def __contains__(self, path): '''Checks if the store contains path''' path = "/".join(("data", path))