diff hgext/convert/monotone.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/monotone.py	Mon Jul 06 01:38:37 2015 +0800
+++ b/hgext/convert/monotone.py	Wed Jul 08 10:27:43 2015 -0700
@@ -13,14 +13,17 @@
 from mercurial.i18n import _
 
 class monotone_source(converter_source, commandline):
-    def __init__(self, ui, path=None, rev=None):
-        converter_source.__init__(self, ui, path, rev)
+    def __init__(self, ui, path=None, revs=None):
+        converter_source.__init__(self, ui, path, revs)
+        if revs and len(revs) > 1:
+            raise util.Abort(_('monotone source does not support specifying '
+                               'multiple revs'))
         commandline.__init__(self, ui, 'mtn')
 
         self.ui = ui
         self.path = path
         self.automatestdio = False
-        self.rev = rev
+        self.revs = revs
 
         norepo = NoRepo(_("%s does not look like a monotone repository")
                         % path)
@@ -219,10 +222,10 @@
     # implement the converter_source interface:
 
     def getheads(self):
-        if not self.rev:
+        if not self.revs:
             return self.mtnrun("leaves").splitlines()
         else:
-            return [self.rev]
+            return self.revs
 
     def getchanges(self, rev, full):
         if full: