[PATCH] Graft: 'log' options adds username of person who did the graft
Martin Rieser
martin.h.rieser at gmail.com
Fri Dec 28 17:43:16 UTC 2012
# HG changeset patch
# User Martin Rieser
# Date 1356716579 -3600
# Branch stable
# Node ID 53017f423f2a7d0b3d78909fe5b12116386107c1
# Parent 777084ac84167e3bdea45b5c00de1106cca36eef
Graft: 'log' options adds username of person who did the graft.
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 53017f423f2a mercurial/commands.py
--- a/mercurial/commands.py Don Nov 29 08:44:54 2012 -0500
+++ b/mercurial/commands.py Fre Dez 28 18:42: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 53017f423f2a tests/test-graft.t
--- a/tests/test-graft.t Don Nov 29 08:44:54 2012 -0500
+++ b/tests/test-graft.t Fre Dez 28 18:42:59 2012 +0100
@@ -297,12 +297,19 @@
Graft with --log
$ hg up -Cq 1
- $ hg graft 3 --log -u foo
+ $ hg graft 3 --log
grafting revision 3
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)
+
+ $ hg up -Cq 1
+ $ hg graft 4 --log -u foo
+ grafting revision 4
+ $ hg log --template '{rev} {parents} {desc}\n' -r tip
+ 15 1:5d205f8b35b6 4
+ (grafted from 9c233e8e184d39ccaaae9bb17d7b1074d73c9e15, by test)
Resolve conflicted graft
$ hg up -q 0
@@ -438,23 +445,29 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: 2
- changeset: 14:f64defefacee
+ changeset: 14:b46d0e19816b
+ parent: 1:5d205f8b35b6
+ user: baz
+ date: Thu Jan 01 00:00:00 1970 +0000
+ summary: 3
+
+ changeset: 15:29591bf255cf
parent: 1:5d205f8b35b6
user: foo
date: Thu Jan 01 00:00:00 1970 +0000
- summary: 3
+ summary: 4
- changeset: 17:64ecd9071ce8
+ changeset: 18:64ecd9071ce8
user: bar
date: Thu Jan 01 00:00:00 1970 +0000
summary: 1
- changeset: 19:2e80e1351d6e
+ changeset: 20:2e80e1351d6e
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: 2
- changeset: 21:7e61b508e709
+ changeset: 22:7e61b508e709
branch: dev
tag: tip
user: foo
@@ -473,12 +486,12 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: 2
- changeset: 19:2e80e1351d6e
+ changeset: 20:2e80e1351d6e
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: 2
- changeset: 21:7e61b508e709
+ changeset: 22:7e61b508e709
branch: dev
tag: tip
user: foo
@@ -487,7 +500,7 @@
Transplants of grafts can find a destination...
$ hg log -r 'destination(7)'
- changeset: 21:7e61b508e709
+ changeset: 22:7e61b508e709
branch: dev
tag: tip
user: foo
@@ -515,18 +528,18 @@
date: Thu Jan 01 00:00:00 1970 +0000
summary: 2
- changeset: 19:2e80e1351d6e
+ changeset: 20:2e80e1351d6e
user: test
date: Thu Jan 01 00:00:00 1970 +0000
summary: 2
- changeset: 21:7e61b508e709
+ changeset: 22:7e61b508e709
branch: dev
user: foo
date: Thu Jan 01 00:00:00 1970 +0000
summary: 2
- changeset: 22:1313d0a825e2
+ changeset: 23:1313d0a825e2
branch: dev
tag: tip
user: foo
More information about the Mercurial-devel
mailing list