Mercurial > hgsubversion
changeset 1414:99bc6003ac56
maps: add the "exists" method to RevMap
This is a part of the bigger plan to get rid of reading or writing rev_map
directly without going through the RevMap class.
Before this patch, there is no easy way to know if the RevMap file exists
or not, so the revset functions "fromsvn" and "svnrev" choose to read the
rev_map file directly, and throw an exception if the file does not exist.
This patch adds the "exists" method that will be used in svnmeta next patch,
so these revset functions can test if the file exists without reading the
rev_map file directly.
author | Jun Wu <quark@fb.com> |
---|---|
date | Fri, 13 May 2016 23:19:15 +0100 |
parents | 951a87f2f2bd |
children | d6cec13b4bb0 |
files | hgsubversion/maps.py |
diffstat | 1 files changed, 4 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgsubversion/maps.py +++ b/hgsubversion/maps.py @@ -391,6 +391,10 @@ class RevMap(dict): raise hgutil.Abort('revmap too new -- please upgrade') return f + @classmethod + def exists(cls, meta): + return os.path.exists(meta.revmap_file) + @util.gcdisable def _load(self): lastpulled = self.meta.lastpulled