hgext/patchbomb.py
changeset 23486 1de214837f5e
parent 23450 a074eeeabe32
child 23487 c14af817ab76
equal deleted inserted replaced
23485:ccb93e9affc1 23486:1de214837f5e
   304                         len(patches), numbered, name)
   304                         len(patches), numbered, name)
   305         msgs.append(msg)
   305         msgs.append(msg)
   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')),
   312     ('i', 'inline', None, _('send patches as inline attachments')),
   328     ('i', 'inline', None, _('send patches as inline attachments')),
   313     ('', 'bcc', [], _('email addresses of blind carbon copy recipients')),
   329     ('', 'bcc', [], _('email addresses of blind carbon copy recipients')),
   428     outgoing = opts.get('outgoing')
   444     outgoing = opts.get('outgoing')
   429     rev = opts.get('rev')
   445     rev = opts.get('rev')
   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)
   451 
   452 
   452     if not (revs or rev or outgoing or bundle or patches):
   453     if not (revs or rev or outgoing or bundle or patches):
   466         if revs:
   467         if revs:
   467             raise util.Abort(_('use only one form to specify the revision'))
   468             raise util.Abort(_('use only one form to specify the revision'))
   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 
   475     # start
   476     # start
   476     if date:
   477     if date: