Mercurial > hg
diff hgext/convert/git.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 | 5c97a4ecbdd4 |
children | f2748cc43b2a |
line wrap: on
line diff
--- a/hgext/convert/git.py Mon Jul 06 01:38:37 2015 +0800 +++ b/hgext/convert/git.py Wed Jul 08 10:27:43 2015 -0700 @@ -86,8 +86,12 @@ data = fh.read() return data, fh.close() - def __init__(self, ui, path, rev=None): - super(convert_git, self).__init__(ui, path, rev=rev) + def __init__(self, ui, path, revs=None): + super(convert_git, self).__init__(ui, path, revs=revs) + + if revs and len(revs) > 1: + raise util.Abort(_("git source does not support specifying " + "multiple revs")) if os.path.isdir(path + "/.git"): path += "/.git" @@ -119,11 +123,12 @@ f.close() def getheads(self): - if not self.rev: + if not self.revs: heads, ret = self.gitread('git rev-parse --branches --remotes') heads = heads.splitlines() else: - heads, ret = self.gitread("git rev-parse --verify %s" % self.rev) + heads, ret = self.gitread("git rev-parse --verify %s" % + self.revs[0]) heads = [heads[:-1]] if ret: raise util.Abort(_('cannot retrieve git heads'))