patchbomb: factor out scmutil.revrange() calls
authorYuya Nishihara <yuya@tcha.org>
Mon, 30 Mar 2015 23:25:55 +0900
changeset 24568 2e5f6cdf01f6
parent 24567 13f0af2a5a4c
child 24569 5491248e148a
patchbomb: factor out scmutil.revrange() calls This allows us to access the calculated revs in patchbomb() function.
hgext/patchbomb.py
--- a/hgext/patchbomb.py	Tue Mar 31 00:52:17 2015 +0900
+++ b/hgext/patchbomb.py	Mon Mar 30 23:25:55 2015 +0900
@@ -186,7 +186,7 @@
     """
     ui = repo.ui
     prev = repo['.'].rev()
-    for r in scmutil.revrange(repo, revs):
+    for r in revs:
         if r == prev and (repo[None].files() or repo[None].deleted()):
             ui.warn(_('warning: working directory has '
                       'uncommitted changes\n'))
@@ -339,7 +339,7 @@
     url = hg.parseurl(url)[0]
     ui.status(_('comparing with %s\n') % util.hidepassword(url))
 
-    revs = [r for r in scmutil.revrange(repo, revs) if r >= 0]
+    revs = [r for r in revs if r >= 0]
     if not revs:
         revs = [len(repo) - 1]
     revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs)
@@ -499,8 +499,9 @@
             raise util.Abort(_('use only one form to specify the revision'))
         revs = rev
 
+    revs = scmutil.revrange(repo, revs)
     if outgoing:
-        revs = _getoutgoing(repo, dest, rev)
+        revs = _getoutgoing(repo, dest, revs)
     if bundle:
         opts['revs'] = [str(r) for r in revs]
 
@@ -526,7 +527,6 @@
         bundleopts.pop('bundle', None)  # already processed
         msgs = _getbundlemsgs(repo, sender, bundledata, **bundleopts)
     else:
-        revs = [str(r) for r in revs]
         _patches = list(_getpatches(repo, revs, **opts))
         msgs = _getpatchmsgs(repo, sender, _patches, **opts)