changeset 1413:951a87f2f2bd

maps: add the "revhashes" 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 "revhashes" method will be used in revset_svnrev.
author Jun Wu <quark@fb.com>
date Fri, 13 May 2016 19:48:13 +0100
parents 7e98352a37db
children 99bc6003ac56
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 revhashes(self, revnum):
+        for key, value in self.iteritems():
+            if key[0] == revnum:
+                yield value
+
     def clear(self):
         self._write()
         dict.clear(self)