Patchwork [3,of,5] patchbomb: factor out scmutil.revrange() calls

login
register
mail settings
Submitter Yuya Nishihara
Date April 1, 2015, 1:25 p.m.
Message ID <79696ed77d0e958b4291.1427894752@mimosa>
Download mbox | patch
Permalink /patch/8412/
State Accepted
Headers show

Comments

Yuya Nishihara - April 1, 2015, 1:25 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1427725555 -32400
#      Mon Mar 30 23:25:55 2015 +0900
# Node ID 79696ed77d0e958b4291900a831981211e6d6bfe
# Parent  1783b7e927eb2e83541d88b364312dd6c3919d66
patchbomb: factor out scmutil.revrange() calls

This allows us to access the calculated revs in patchbomb() function.
Matt Mackall - April 1, 2015, 10:05 p.m.
On Wed, 2015-04-01 at 22:25 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1427725555 -32400
> #      Mon Mar 30 23:25:55 2015 +0900
> # Node ID 79696ed77d0e958b4291900a831981211e6d6bfe
> # Parent  1783b7e927eb2e83541d88b364312dd6c3919d66
> patchbomb: factor out scmutil.revrange() calls

First three are queued for default, thanks.

Patch

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -186,7 +186,7 @@  def _getpatches(repo, revs, **opts):
     """
     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 @@  def _getoutgoing(repo, dest, revs):
     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 @@  def patchbomb(ui, repo, *revs, **opts):
             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 @@  def patchbomb(ui, repo, *revs, **opts):
         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)