# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1462812484 -3600
# Node ID 025e849d22f0a52844a9631981b817c0af07a278
# Parent  85981b27e740227c8e58c0911c21c25309e17256
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.

diff --git a/hgsubversion/maps.py b/hgsubversion/maps.py
--- 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: