changeset 4774:d305852a5ec8

convert: svn: add revnum() to convert rev to revnum
author Brendan Cully <brendan@kublai.com>
date Mon, 02 Jul 2007 07:28:54 -0700
parents cfbce076f2de
children 739fd34f5d66
files hgext/convert/subversion.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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]