# HG changeset patch # User Sean Farley # Date 2014-01-21 17:34:55 # 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 --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -63,13 +63,13 @@ class converter_source(object): 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 @@ class converter_source(object): """ 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 --git a/hgext/convert/git.py b/hgext/convert/git.py --- a/hgext/convert/git.py +++ b/hgext/convert/git.py @@ -297,7 +297,7 @@ class convert_git(converter_source): 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 --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -423,6 +423,6 @@ class mercurial_source(converter_source) 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 --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -454,13 +454,13 @@ class svn_source(converter_source): 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 = {}