[PATCH] Graft: (V2) '--log' options adds username of person who did the graft

Kevin Bullock kbullock+mercurial at ringworld.org
Sun Dec 30 22:26:57 CST 2012


On 30 Dec 2012, at 4:19 AM, Martin Rieser wrote:

> # HG changeset patch
> # User Martin Rieser
> # Date 1356862619 -3600
> # Branch stable
> # Node ID aaaf4bc76340c1aaa9c76a45498f9dfa922df08a
> # Parent  777084ac84167e3bdea45b5c00de1106cca36eef
> Graft: (V2) '--log' options adds username of person who did the graft.

The 'V2' belongs in a --flag option to patchbomb, not in the commit message. And as others have pointed out, we have a defined format for the first line of a commit message.

> At the moment it is impossible to find out, who did the graft. Per default,
> the username of the person, who made the code change is also set as author to
> the grafted version. But there is no trace about the person, who executed
> the 'hg graft...' command. If the --log option is used, it is possilbe to
> document both persons who where involved in the graft.
> 
> diff -r 777084ac8416 -r aaaf4bc76340 mercurial/commands.py
> --- a/mercurial/commands.py	Don Nov 29 08:44:54 2012 -0500
> +++ b/mercurial/commands.py	Son Dez 30 11:16:59 2012 +0100
> @@ -2713,7 +2713,7 @@
>     If --log is specified, log messages will have a comment appended
>     of the form::
> 
> -      (grafted from CHANGESETHASH)
> +      (grafted from CHANGESETHASH by USERNAME)
> 
>     If a graft merge results in conflicts, the graft process is
>     interrupted so that the current merge can be manually resolved.
> @@ -2870,7 +2870,11 @@
>                 date = opts['date']
>             message = ctx.description()
>             if opts.get('log'):
> -                message += '\n(grafted from %s)' % ctx.hex()
> +                message += '\n(grafted from %s ' % ctx.hex()
> +                if ui.username():
> +                    message += 'by %s)' % ui.username()
> +                else:
> +                    message += ')'
>             node = repo.commit(text=message, user=user,
>                         date=date, extra=extra, editor=editor)
>             if node is None:
> diff -r 777084ac8416 -r aaaf4bc76340 tests/test-graft.t
> --- a/tests/test-graft.t	Don Nov 29 08:44:54 2012 -0500
> +++ b/tests/test-graft.t	Son Dez 30 11:16:59 2012 +0100
> @@ -297,12 +297,19 @@
> Graft with --log
> 
>   $ hg up -Cq 1
> -  $ hg graft 3 --log -u foo
> +  $ hg graft 3 --log

The extra graft isn't necessary to test this feature.

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock



More information about the Mercurial-devel mailing list