##// END OF EJS Templates
patchbomb: extract 'getoutgoing' closure into its own function...
Pierre-Yves David -
r23486:1de21483 default
parent child Browse files
Show More
@@ -306,6 +306,22 b' def _getpatchmsgs(repo, sender, patches,'
306
306
307 return msgs
307 return msgs
308
308
309 def _getoutgoing(repo, dest, revs):
310 '''Return the revisions present locally but not in dest'''
311 ui = repo.ui
312 url = ui.expandpath(dest or 'default-push', dest or 'default')
313 url = hg.parseurl(url)[0]
314 ui.status(_('comparing with %s\n') % util.hidepassword(url))
315
316 revs = [r for r in scmutil.revrange(repo, revs) if r >= 0]
317 if not revs:
318 revs = [len(repo) - 1]
319 revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs)
320 if not revs:
321 ui.status(_("no changes found\n"))
322 return []
323 return [str(r) for r in revs]
324
309 emailopts = [
325 emailopts = [
310 ('', 'body', None, _('send patches as inline message text (default)')),
326 ('', 'body', None, _('send patches as inline message text (default)')),
311 ('a', 'attach', None, _('send patches as attachments')),
327 ('a', 'attach', None, _('send patches as attachments')),
@@ -430,21 +446,6 b' def patchbomb(ui, repo, *revs, **opts):'
430 # internal option used by pbranches
446 # internal option used by pbranches
431 patches = opts.get('patches')
447 patches = opts.get('patches')
432
448
433 def getoutgoing(dest, revs):
434 '''Return the revisions present locally but not in dest'''
435 url = ui.expandpath(dest or 'default-push', dest or 'default')
436 url = hg.parseurl(url)[0]
437 ui.status(_('comparing with %s\n') % util.hidepassword(url))
438
439 revs = [r for r in scmutil.revrange(repo, revs) if r >= 0]
440 if not revs:
441 revs = [len(repo) - 1]
442 revs = repo.revs('outgoing(%s) and ::%ld', dest or '', revs)
443 if not revs:
444 ui.status(_("no changes found\n"))
445 return []
446 return [str(r) for r in revs]
447
448 if not (opts.get('test') or mbox):
449 if not (opts.get('test') or mbox):
449 # really sending
450 # really sending
450 mail.validateconfig(ui)
451 mail.validateconfig(ui)
@@ -468,7 +469,7 b' def patchbomb(ui, repo, *revs, **opts):'
468 revs = rev
469 revs = rev
469
470
470 if outgoing:
471 if outgoing:
471 revs = getoutgoing(dest, rev)
472 revs = _getoutgoing(repo, dest, rev)
472 if bundle:
473 if bundle:
473 opts['revs'] = revs
474 opts['revs'] = revs
474
475
General Comments 0
You need to be logged in to leave comments. Login now