hgext/patchbomb.py
changeset 43117 8ff1ecfadcd1
parent 43099 f1c5358f0d65
child 43157 3460eee570f7
equal deleted inserted replaced
43116:defabf63e969 43117:8ff1ecfadcd1
   160     # experimental config: patchbomb.publicurl
   160     # experimental config: patchbomb.publicurl
   161     # waiting for some logic that check that the changeset are available on the
   161     # waiting for some logic that check that the changeset are available on the
   162     # destination before patchbombing anything.
   162     # destination before patchbombing anything.
   163     publicurl = repo.ui.config(b'patchbomb', b'publicurl')
   163     publicurl = repo.ui.config(b'patchbomb', b'publicurl')
   164     if publicurl:
   164     if publicurl:
   165         return b'Available At %s\n' b'#              hg pull %s -r %s' % (
   165         return b'Available At %s\n#              hg pull %s -r %s' % (
   166             publicurl,
   166             publicurl,
   167             publicurl,
   167             publicurl,
   168             ctx,
   168             ctx,
   169         )
   169         )
   170     return None
   170     return None
   341     """
   341     """
   342     ui = repo.ui
   342     ui = repo.ui
   343     prev = repo[b'.'].rev()
   343     prev = repo[b'.'].rev()
   344     for r in revs:
   344     for r in revs:
   345         if r == prev and (repo[None].files() or repo[None].deleted()):
   345         if r == prev and (repo[None].files() or repo[None].deleted()):
   346             ui.warn(
   346             ui.warn(_(b'warning: working directory has uncommitted changes\n'))
   347                 _(b'warning: working directory has ' b'uncommitted changes\n')
       
   348             )
       
   349         output = stringio()
   347         output = stringio()
   350         cmdutil.exportfile(
   348         cmdutil.exportfile(
   351             repo, [r], output, opts=patch.difffeatureopts(ui, opts, git=True)
   349             repo, [r], output, opts=patch.difffeatureopts(ui, opts, git=True)
   352         )
   350         )
   353         yield output.getvalue().split(b'\n')
   351         yield output.getvalue().split(b'\n')
   389     ui = repo.ui
   387     ui = repo.ui
   390     if opts.get(r'desc'):
   388     if opts.get(r'desc'):
   391         body = open(opts.get(r'desc')).read()
   389         body = open(opts.get(r'desc')).read()
   392     else:
   390     else:
   393         ui.write(
   391         ui.write(
   394             _(b'\nWrite the introductory message for the ' b'patch series.\n\n')
   392             _(b'\nWrite the introductory message for the patch series.\n\n')
   395         )
   393         )
   396         body = ui.edit(
   394         body = ui.edit(
   397             defaultbody, sender, repopath=repo.path, action=b'patchbombbody'
   395             defaultbody, sender, repopath=repo.path, action=b'patchbombbody'
   398         )
   396         )
   399         # Save series description in case sendmail fails
   397         # Save series description in case sendmail fails
   909             ui.write((b'Subject: %s\n' % subj), label=b'patchbomb.subject')
   907             ui.write((b'Subject: %s\n' % subj), label=b'patchbomb.subject')
   910             if ds:
   908             if ds:
   911                 ui.write(ds, label=b'patchbomb.diffstats')
   909                 ui.write(ds, label=b'patchbomb.diffstats')
   912         ui.write(b'\n')
   910         ui.write(b'\n')
   913         if ui.promptchoice(
   911         if ui.promptchoice(
   914             _(b'are you sure you want to send (yn)?' b'$$ &Yes $$ &No')
   912             _(b'are you sure you want to send (yn)?$$ &Yes $$ &No')
   915         ):
   913         ):
   916             raise error.Abort(_(b'patchbomb canceled'))
   914             raise error.Abort(_(b'patchbomb canceled'))
   917 
   915 
   918     ui.write(b'\n')
   916     ui.write(b'\n')
   919 
   917