[PATCH 3 of 3] patchbomb: make --git-format-patch imply --plain

Henning Schild henning at hennsch.de
Wed Nov 30 13:30:14 EST 2016


Am Thu, 24 Nov 2016 15:42:58 +0000
schrieb Jun Wu <quark at fb.com>:

> What do you think about Sean's idea mentioned earlier? Implement the
> logic in the hg-git extension. And let the hg-git extension check if
> the repo is a hg-git repo or not. We can also have a boolean
> repo-level config option.

That sounds like a good idea but i am afraid it would be very hard to
hook into "hg email" from hg-git. As far as i understand hg-git, it
deals only with the conversion of changesets or objects. And it does
not really hook into core hg, like hg email.
I guess if email was using templates it would be easy to ship another
template with hg-git and pick it when on git.

Please correct me if i am wrong and suggest a minimal intrusive/hacky
way to implement the changes in hg-git.

> It seems to me that hg-git is a better place (than hg core) to
> implement all these features.

Agreed, and maybe it can be moved out again once templating is
implemented for email.
Aiming at generating mails that look exactly like the ones from git
would require even more changes. So you are right when not wanting to
start with "all these features".

Still i would like to see "git-am" support in hg with hg-git, not
caring too much where it is implemented.

> Excerpts from Henning Schild's message of 2016-11-17 21:47:58 +0100:
> > # HG changeset patch
> > # User Henning Schild <henning at hennsch.de>
> > # Date 1479415557 -3600
> > #      Thu Nov 17 21:45:57 2016 +0100
> > # Node ID de2b03a509491020f728f1955e39e2bfb9a77426
> > # Parent  a9be53e26cb1ac19d1c0156062e8ae23f8366d8b
> > patchbomb: make --git-format-patch imply --plain
> > 
> > Not using --plain would generate mails with the hg header in the
> > git commit message. Since --git-format-patch already caters for
> > git, might as well make sure users do not forget --plain.
> > 
> > diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
> > --- a/hgext/patchbomb.py
> > +++ b/hgext/patchbomb.py
> > @@ -418,7 +418,7 @@
> >  @command('email',
> >      [('g', 'git', None, _('use git extended diff format')),
> >      ('', 'git-format-patch', None, _('use git-format-patch email
> > format '
> > -       '(implies --git)')),
> > +       '(implies --git and --plain)')),
> >      ('', 'plain', None, _('omit hg patch header')),
> >      ('o', 'outgoing', None,
> >       _('send changes not found in the target repository')),
> > @@ -527,6 +527,7 @@
> >  
> >      if (opts.get('git_format_patch')):
> >          opts['git'] = True
> > +        opts['plain'] = True
> >  
> >      if not (opts.get('test') or mbox):
> >          # really sending
> > diff --git a/tests/test-patchbomb.t b/tests/test-patchbomb.t
> > --- a/tests/test-patchbomb.t
> > +++ b/tests/test-patchbomb.t
> > @@ -755,13 +755,6 @@
> >    To: foo
> >    Cc: bar
> >    
> > -  # HG changeset patch
> > -  # User test
> > -  # Date 3 0
> > -  #      Thu Jan 01 00:00:03 1970 +0000
> > -  # Node ID ff2c9fa2018b15fa74b33363bda9527323e2a99f
> > -  # Parent  97d72e5f12c7e84f85064aa72e5a297142c36ed9
> > -  c
> >    ---
> >     c |  1 +
> >     1 files changed, 1 insertions(+), 0 deletions(-)
> > @@ -953,13 +946,6 @@
> >    To: foo
> >    Cc: bar
> >    
> > -  # HG changeset patch
> > -  # User test
> > -  # Date 1 0
> > -  #      Thu Jan 01 00:00:01 1970 +0000
> > -  # Node ID 8580ff50825a50c8f716709acdf8de0deddcd6ab
> > -  # Parent  0000000000000000000000000000000000000000
> > -  a
> >    ---
> >     a |  1 +
> >     1 files changed, 1 insertions(+), 0 deletions(-)
> > @@ -989,13 +975,6 @@
> >    To: foo
> >    Cc: bar
> >    
> > -  # HG changeset patch
> > -  # User test
> > -  # Date 2 0
> > -  #      Thu Jan 01 00:00:02 1970 +0000
> > -  # Node ID 97d72e5f12c7e84f85064aa72e5a297142c36ed9
> > -  # Parent  8580ff50825a50c8f716709acdf8de0deddcd6ab
> > -  b
> >    ---
> >     b |  1 +
> >     1 files changed, 1 insertions(+), 0 deletions(-)  
> 



More information about the Mercurial-devel mailing list