changeset 1472:cf79525f507c

maps: change branchedits to accept revnum directly This makes tests easier to write.
author Jun Wu <quark@fb.com>
date Wed, 15 Jun 2016 13:28:40 +0100
parents 6bc2a2f61923
children 623af04c6e06
files hgsubversion/maps.py hgsubversion/replay.py hgsubversion/stupid.py
diffstat 3 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/maps.py
+++ b/hgsubversion/maps.py
@@ -370,8 +370,8 @@ class RevMap(dict):
             self._hashes = dict((v, k) for (k, v) in self._origiteritems())
         return self._hashes
 
-    def branchedits(self, branch, rev):
-        check = lambda x: x[0][1] == branch and x[0][0] < rev.revnum
+    def branchedits(self, branch, revnum):
+        check = lambda x: x[0][1] == branch and x[0][0] < revnum
         return sorted(filter(check, self._origiteritems()), reverse=True)
 
     def branchmaxrevnum(self, branch, maxrevnum):
@@ -579,12 +579,12 @@ class SqliteRevMap(collections.MutableMa
             self._hashes = self.ReverseRevMap(self)
         return self._hashes
 
-    def branchedits(self, branch, rev):
+    def branchedits(self, branch, revnum):
         return [((r[0], r[1] or None), bytes(r[2])) for r in
                 self._query('SELECT rev, branch, hash FROM revmap ' +
                                 'WHERE rev < ? AND branch = ? ' +
                                 'ORDER BY rev DESC, branch DESC',
-                                (rev.revnum, branch or ''))]
+                                (revnum, branch or ''))]
 
     def branchmaxrevnum(self, branch, maxrev):
         for row in self._query('SELECT rev FROM revmap ' +
--- a/hgsubversion/replay.py
+++ b/hgsubversion/replay.py
@@ -103,7 +103,7 @@ def _convert_rev(ui, meta, svn, r, tbdel
 
     closebranches = {}
     for branch in tbdelta['branches'][1]:
-        branchedits = meta.revmap.branchedits(branch, rev)
+        branchedits = meta.revmap.branchedits(branch, rev.revnum)
         if len(branchedits) < 1:
             # can't close a branch that never existed
             continue
--- a/hgsubversion/stupid.py
+++ b/hgsubversion/stupid.py
@@ -568,7 +568,7 @@ def fetch_branchrev(svn, meta, branch, b
     return files, filectxfn
 
 def checkbranch(meta, r, branch):
-    branchedits = meta.revmap.branchedits(branch, r)
+    branchedits = meta.revmap.branchedits(branch, r.revnum)
     if not branchedits:
         return None
     branchtip = branchedits[0][1]