diff hgext/evolve.py @ 1598:2a08ef812b84

evolve: make split respect rev args passed without --rev or -r Currently, if one runs `hg split .` or `hg split`, it will fail with an exception. This happens becuase we only expect revision args to be passed as --rev/-r ones and don't treat unnamed args properly or add default values if no args are provided.
author Kostia Balytskyi <ikostia@fb.com>
date Thu, 04 Feb 2016 02:46:40 -0800
parents 7876ed4fceb7
children 9e93ddf03704
line wrap: on
line diff
--- a/hgext/evolve.py	Thu Feb 04 01:19:14 2016 +0000
+++ b/hgext/evolve.py	Thu Feb 04 02:46:40 2016 -0800
@@ -2723,16 +2723,13 @@
     tr = wlock = lock = None
     newcommits = []
 
-    revopt = opts.get('rev')
-    if revopt:
-        revs = scmutil.revrange(repo, revopt)
-        if len(revs) != 1:
-            raise error.Abort(_("you can only specify one revision to split"))
-        else:
-            rev = list(revs)[0]
-    else:
-        rev = '.'
-
+    revarg = (list(revs) + opts.get('rev')) or ['.']
+    if len(revarg) != 1:
+        msg = _("more than one revset is given")
+        hnt = _("use either `hg split <rs>` or `hg split --rev <rs>`, not both")
+        raise error.Abort(msg, hint=hnt)
+
+    rev = scmutil.revsingle(repo, revarg[0])
     try:
         wlock = repo.wlock()
         lock = repo.lock()