# HG changeset patch # User Sean Farley # Date 1390325695 21600 # Node ID e8203629371bd85b45179dce50936b1a9501933a # Parent 45562379ce4e663260ee4bd66605d2843da0ae76 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. diff -r 45562379ce4e -r e8203629371b hgext/convert/common.py --- 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. diff -r 45562379ce4e -r e8203629371b hgext/convert/git.py --- 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) diff -r 45562379ce4e -r e8203629371b hgext/convert/hg.py --- 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) diff -r 45562379ce4e -r e8203629371b hgext/convert/subversion.py --- 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 = {}