diff hgext/convert/bzr.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 56b2bcea2529
line wrap: on
line diff
--- a/hgext/convert/bzr.py	Mon Jul 06 01:38:37 2015 +0800
+++ b/hgext/convert/bzr.py	Wed Jul 08 10:27:43 2015 -0700
@@ -33,8 +33,8 @@
 class bzr_source(converter_source):
     """Reads Bazaar repositories by using the Bazaar Python libraries"""
 
-    def __init__(self, ui, path, rev=None):
-        super(bzr_source, self).__init__(ui, path, rev=rev)
+    def __init__(self, ui, path, revs=None):
+        super(bzr_source, self).__init__(ui, path, revs=revs)
 
         if not os.path.exists(os.path.join(path, '.bzr')):
             raise NoRepo(_('%s does not look like a Bazaar repository')
@@ -95,20 +95,20 @@
         return self.sourcerepo.find_branches(using=True)
 
     def getheads(self):
-        if not self.rev:
+        if not self.revs:
             # Set using=True to avoid nested repositories (see issue3254)
             heads = sorted([b.last_revision() for b in self._bzrbranches()])
         else:
             revid = None
             for branch in self._bzrbranches():
                 try:
-                    r = RevisionSpec.from_string(self.rev)
+                    r = RevisionSpec.from_string(self.revs[0])
                     info = r.in_history(branch)
                 except errors.BzrError:
                     pass
                 revid = info.rev_id
             if revid is None:
-                raise util.Abort(_('%s is not a valid revision') % self.rev)
+                raise util.Abort(_('%s is not a valid revision') % self.revs[0])
             heads = [revid]
         # Empty repositories return 'null:', which cannot be retrieved
         heads = [h for h in heads if h != 'null:']