changeset 1411:025e849d22f0

maps: add the "clear" 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. The "clear" method is used in rebuildmeta.
author Jun Wu <quark@fb.com>
date Mon, 09 May 2016 17:48:04 +0100
parents 85981b27e740
children 7e98352a37db
files hgsubversion/maps.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/maps.py
+++ b/hgsubversion/maps.py
@@ -355,6 +355,11 @@ class RevMap(dict):
         check = lambda x: x[0][1] == branch and x[0][0] < rev.revnum
         return sorted(filter(check, self.iteritems()), reverse=True)
 
+    def clear(self):
+        self._write()
+        dict.clear(self)
+        self._hashes = None
+
     @classmethod
     def readmapfile(cls, path, missingok=True):
         try: