changeset 20373:e8203629371b

convert: add mapname parameter to checkrevformat Upcoming patches will add new map files so we change the calling sequence of checkrevformat so that error messages will let the user know which file has the wrong rev format.
author Sean Farley <sean.michael.farley@gmail.com>
date Tue, 21 Jan 2014 11:34:55 -0600
parents 45562379ce4e
children a3545c3104aa
files hgext/convert/common.py hgext/convert/git.py hgext/convert/hg.py hgext/convert/subversion.py
diffstat 4 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/common.py	Thu Apr 18 10:05:50 2013 -0500
+++ b/hgext/convert/common.py	Tue Jan 21 11:34:55 2014 -0600
@@ -63,13 +63,13 @@
 
         self.encoding = 'utf-8'
 
-    def checkhexformat(self, revstr):
+    def checkhexformat(self, revstr, mapname='splicemap'):
         """ fails if revstr is not a 40 byte hex. mercurial and git both uses
             such format for their revision numbering
         """
         if not re.match(r'[0-9a-fA-F]{40,40}$', revstr):
-            raise util.Abort(_('splicemap entry %s is not a valid revision'
-                               ' identifier') % revstr)
+            raise util.Abort(_('%s entry %s is not a valid revision'
+                               ' identifier') % (mapname, revstr))
 
     def before(self):
         pass
@@ -172,7 +172,7 @@
         """
         return {}
 
-    def checkrevformat(self, revstr):
+    def checkrevformat(self, revstr, mapname='splicemap'):
         """revstr is a string that describes a revision in the given
            source control system.  Return true if revstr has correct
            format.
--- a/hgext/convert/git.py	Thu Apr 18 10:05:50 2013 -0500
+++ b/hgext/convert/git.py	Tue Jan 21 11:34:55 2014 -0600
@@ -297,7 +297,7 @@
 
         return bookmarks
 
-    def checkrevformat(self, revstr):
+    def checkrevformat(self, revstr, mapname='splicemap'):
         """ git revision string is a 40 byte hex """
-        self.checkhexformat(revstr)
+        self.checkhexformat(revstr, mapname)
 
--- a/hgext/convert/hg.py	Thu Apr 18 10:05:50 2013 -0500
+++ b/hgext/convert/hg.py	Tue Jan 21 11:34:55 2014 -0600
@@ -423,6 +423,6 @@
     def getbookmarks(self):
         return bookmarks.listbookmarks(self.repo)
 
-    def checkrevformat(self, revstr):
+    def checkrevformat(self, revstr, mapname='splicemap'):
         """ Mercurial, revision string is a 40 byte hex """
-        self.checkhexformat(revstr)
+        self.checkhexformat(revstr, mapname)
--- a/hgext/convert/subversion.py	Thu Apr 18 10:05:50 2013 -0500
+++ b/hgext/convert/subversion.py	Tue Jan 21 11:34:55 2014 -0600
@@ -454,13 +454,13 @@
         del self.commits[rev]
         return commit
 
-    def checkrevformat(self, revstr):
+    def checkrevformat(self, revstr, mapname='splicemap'):
         """ fails if revision format does not match the correct format"""
         if not re.match(r'svn:[0-9a-f]{8,8}-[0-9a-f]{4,4}-'
                               '[0-9a-f]{4,4}-[0-9a-f]{4,4}-[0-9a-f]'
                               '{12,12}(.*)\@[0-9]+$',revstr):
-            raise util.Abort(_('splicemap entry %s is not a valid revision'
-                               ' identifier') % revstr)
+            raise util.Abort(_('%s entry %s is not a valid revision'
+                               ' identifier') % (mapname, revstr))
 
     def gettags(self):
         tags = {}