Patchwork graft: log options adds username of person who did the graft

login
register
mail settings
Submitter Martin Rieser
Date Jan. 13, 2013, 9:29 a.m.
Message ID <4555fabe4d18e57c2ad8.1358069347@martin-Z68A-D3H-B3>
Download mbox | patch
Permalink /patch/575/
State Changes Requested
Delegated to: Bryan O'Sullivan
Headers show

Comments

Martin Rieser - Jan. 13, 2013, 9:29 a.m.
# HG changeset patch
# User Martin Rieser <martin.h.rieser@gmail.com>
# Date 1358068528 -3600
# Branch stable
# Node ID 4555fabe4d18e57c2ad85945f3439137249229df
# Parent  0f9013112ebae38ae07ad58501b64a38757aeea9
graft: log options adds username of person who did the graft

At the moment it is impossible to find out, who did the graft (and also when it
was done). 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 new --log option is used,
it is possilbe to document both persons who where involved in the graft.
Pierre-Yves David - Jan. 14, 2013, 2:40 p.m.
On 13 janv. 2013, at 10:29, martin.h.rieser@gmail.com wrote:

> # HG changeset patch
> # User Martin Rieser <martin.h.rieser@gmail.com>
> # Date 1358068528 -3600
> # Branch stable
> # Node ID 4555fabe4d18e57c2ad85945f3439137249229df
> # Parent  0f9013112ebae38ae07ad58501b64a38757aeea9
> graft: log options adds username of person who did the graft
> 
> At the moment it is impossible to find out, who did the graft (and also when it
> was done). 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 new --log option is used,
> it is possilbe to document both persons who where involved in the graft.

This patches looks good to me. Pusher will want to fixe the little details bellow

> diff -r 0f9013112eba -r 4555fabe4d18 mercurial/commands.py
> --- a/mercurial/commands.py	Fri Jan 04 19:06:42 2013 +0100
> +++ b/mercurial/commands.py	Sun Jan 13 10:15:28 2013 +0100
> @@ -2870,7 +2870,8 @@
>                 date = opts['date']
>             message = ctx.description()
>             if opts.get('log'):
> -                message += '\n(grafted from %s)' % ctx.hex()
> +                message += '\n(grafted from %s by %s)' % \
> +                (ctx.hex(),ui.username())

Details: we usually use parents instead of \ continuation
Bryan O'Sullivan - Jan. 14, 2013, 6:06 p.m.
On Sun, Jan 13, 2013 at 10:29:07AM +0100, martin.h.rieser@gmail.com wrote:
> graft: log options adds username of person who did the graft

Please rebase this so that it applies against recent crew.

Patch

diff -r 0f9013112eba -r 4555fabe4d18 mercurial/commands.py
--- a/mercurial/commands.py	Fri Jan 04 19:06:42 2013 +0100
+++ b/mercurial/commands.py	Sun Jan 13 10:15:28 2013 +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,8 @@ 
                 date = opts['date']
             message = ctx.description()
             if opts.get('log'):
-                message += '\n(grafted from %s)' % ctx.hex()
+                message += '\n(grafted from %s by %s)' % \
+                (ctx.hex(),ui.username())
             node = repo.commit(text=message, user=user,
                         date=date, extra=extra, editor=editor)
             if node is None:
diff -r 0f9013112eba -r 4555fabe4d18 tests/test-graft.t
--- a/tests/test-graft.t	Fri Jan 04 19:06:42 2013 +0100
+++ b/tests/test-graft.t	Sun Jan 13 10:15:28 2013 +0100
@@ -302,7 +302,7 @@ 
   warning: can't find ancestor for 'c' copied from 'b'!
   $ hg log --template '{rev} {parents} {desc}\n' -r tip
   14 1:5d205f8b35b6  3
-  (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8)
+  (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8 by test)
 
 Resolve conflicted graft
   $ hg up -q 0
@@ -438,7 +438,7 @@ 
   date:        Thu Jan 01 00:00:00 1970 +0000
   summary:     2
   
-  changeset:   14:f64defefacee
+  changeset:   14:c47f8d99bd12
   parent:      1:5d205f8b35b6
   user:        foo
   date:        Thu Jan 01 00:00:00 1970 +0000