Mercurial > hg
diff hgext/convert/p4.py @ 25748:baea47cafe75
convert: add support for specifying multiple revs
Previously convert could only take one '--rev'. This change allows the user to
specify multiple --rev entries. For instance, this could allow converting
multiple branches (but not all branches) at once from git.
In this first patch, we disable support for this for all sources. Future
patches will enable it for select sources (like git).
author | Durham Goode <durham@fb.com> |
---|---|
date | Wed, 08 Jul 2015 10:27:43 -0700 |
parents | 216fa1ba9993 |
children | 17a9da909186 |
line wrap: on
line diff
--- a/hgext/convert/p4.py Mon Jul 06 01:38:37 2015 +0800 +++ b/hgext/convert/p4.py Wed Jul 08 10:27:43 2015 -0700 @@ -24,8 +24,8 @@ pass class p4_source(converter_source): - def __init__(self, ui, path, rev=None): - super(p4_source, self).__init__(ui, path, rev=rev) + def __init__(self, ui, path, revs=None): + super(p4_source, self).__init__(ui, path, revs=revs) if "/" in path and not path.startswith('//'): raise NoRepo(_('%s does not look like a P4 repository') % path) @@ -49,6 +49,9 @@ r":[^$\n]*\$") self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$") + if revs and len(revs) > 1: + raise util.Abort(_("p4 source does not support specifying " + "multiple revisions")) self._parse(ui, path) def _parse_view(self, path): @@ -99,7 +102,7 @@ startrev = self.ui.config('convert', 'p4.startrev', default=0) self.p4changes = [x for x in self.p4changes if ((not startrev or int(x) >= int(startrev)) and - (not self.rev or int(x) <= int(self.rev)))] + (not self.revs or int(x) <= int(self.revs[0])))] # now read the full changelists to get the list of file revisions ui.status(_('collecting p4 changelists\n'))