# HG changeset patch # User Jun Wu # Date 1463177955 -3600 # Node ID 99bc6003ac56d7c37e6d424acffebe0c2e5ecbf0 # Parent 951a87f2f2bdfe36e1f2860af25e3a87bb56c168 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. diff --git a/hgsubversion/maps.py b/hgsubversion/maps.py --- 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