convert: svn: add revnum() to convert rev to revnum
authorBrendan Cully <brendan@kublai.com>
Mon, 02 Jul 2007 07:28:54 -0700
changeset 4774 d305852a5ec8
parent 4773 cfbce076f2de
child 4775 739fd34f5d66
convert: svn: add revnum() to convert rev to revnum
hgext/convert/subversion.py
--- a/hgext/convert/subversion.py	Mon Jul 02 07:22:11 2007 -0700
+++ b/hgext/convert/subversion.py	Mon Jul 02 07:28:54 2007 -0700
@@ -131,6 +131,9 @@
 
     def rev(self, revnum):
         return (u"svn:%s%s@%s" % (self.uuid, self.module, revnum)).decode(self.encoding)
+
+    def revnum(self, rev):
+        return int(rev.split('@')[-1])
             
     def get_blacklist(self):
         """Avoid certain revision numbers.
@@ -428,7 +431,7 @@
         # TODO: ra.get_file transmits the whole file instead of diffs.
         mode = ''
         try:
-            revnum = int(rev.split("@")[-1])
+            revnum = self.revnum(rev)
             if self.module != self.modulemap[revnum]:
                 self.module = self.modulemap[revnum]
                 self.reparent(self.module)
@@ -467,7 +470,7 @@
 
     def getcommit(self, rev):
         if rev not in self.commits:
-            revnum = int(rev.split('@')[-1])
+            revnum = self.revnum(rev)
             minrev = revnum - LOG_BATCH_SIZE > 0 and revnum - LOG_BATCH_SIZE or 0
             self._fetch_revisions(from_revnum=revnum, to_revnum=minrev)
         return self.commits[rev]