comparison hgext/patchbomb.py @ 24568:2e5f6cdf01f6

patchbomb: factor out scmutil.revrange() calls This allows us to access the calculated revs in patchbomb() function.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 30 Mar 2015 23:25:55 +0900
parents 13f0af2a5a4c
children 80c5b2666a96
comparison
equal deleted inserted replaced
24567:13f0af2a5a4c 24568:2e5f6cdf01f6
184 184
185 Each patch in the list is itself a list of lines. 185 Each patch in the list is itself a list of lines.
186 """ 186 """
187 ui = repo.ui 187 ui = repo.ui
188 prev = repo['.'].rev() 188 prev = repo['.'].rev()
189 for r in scmutil.revrange(repo, revs): 189 for r in revs:
190 if r == prev and (repo[None].files() or repo[None].deleted()): 190 if r == prev and (repo[None].files() or repo[None].deleted()):
191 ui.warn(_('warning: working directory has ' 191 ui.warn(_('warning: working directory has '
192 'uncommitted changes\n')) 192 'uncommitted changes\n'))
193 output = cStringIO.StringIO() 193 output = cStringIO.StringIO()
194 cmdutil.export(repo, [r], fp=output, 194 cmdutil.export(repo, [r], fp=output,
337 ui = repo.ui 337 ui = repo.ui
338 url = ui.expandpath(dest or 'default-push', dest or 'default') 338 url = ui.expandpath(dest or 'default-push', dest or 'default')
339 url = hg.parseurl(url)[0] 339 url = hg.parseurl(url)[0]
340 ui.status(_('comparing with %s\n') % util.hidepassword(url)) 340 ui.status(_('comparing with %s\n') % util.hidepassword(url))
341 341
342 revs = [r for r in scmutil.revrange(repo, revs) if r >= 0] 342 revs = [r for r in revs if r >= 0]
343 if not revs: 343 if not revs:
344 revs = [len(repo) - 1] 344 revs = [len(repo) - 1]
345 revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs) 345 revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs)
346 if not revs: 346 if not revs:
347 ui.status(_("no changes found\n")) 347 ui.status(_("no changes found\n"))
497 if rev: 497 if rev:
498 if revs: 498 if revs:
499 raise util.Abort(_('use only one form to specify the revision')) 499 raise util.Abort(_('use only one form to specify the revision'))
500 revs = rev 500 revs = rev
501 501
502 revs = scmutil.revrange(repo, revs)
502 if outgoing: 503 if outgoing:
503 revs = _getoutgoing(repo, dest, rev) 504 revs = _getoutgoing(repo, dest, revs)
504 if bundle: 505 if bundle:
505 opts['revs'] = [str(r) for r in revs] 506 opts['revs'] = [str(r) for r in revs]
506 507
507 # start 508 # start
508 if date: 509 if date:
524 bundledata = _getbundle(repo, dest, **opts) 525 bundledata = _getbundle(repo, dest, **opts)
525 bundleopts = opts.copy() 526 bundleopts = opts.copy()
526 bundleopts.pop('bundle', None) # already processed 527 bundleopts.pop('bundle', None) # already processed
527 msgs = _getbundlemsgs(repo, sender, bundledata, **bundleopts) 528 msgs = _getbundlemsgs(repo, sender, bundledata, **bundleopts)
528 else: 529 else:
529 revs = [str(r) for r in revs]
530 _patches = list(_getpatches(repo, revs, **opts)) 530 _patches = list(_getpatches(repo, revs, **opts))
531 msgs = _getpatchmsgs(repo, sender, _patches, **opts) 531 msgs = _getpatchmsgs(repo, sender, _patches, **opts)
532 532
533 showaddrs = [] 533 showaddrs = []
534 534