[PATCH 2 of 3] graft: preserve original source in subsequent grafts
Stefano Tortarolo
stefano.tortarolo at gmail.com
Sat Nov 12 07:05:01 CST 2011
# HG changeset patch
# User Stefano Tortarolo <stefano.tortarolo at gmail.com>
# Date 1321100140 -3600
# Node ID b7644d5507d26bc84c8d171d4a6a13883021b2d3
# Parent 211d35717f64f723be889a6016c529d244f702ef
graft: preserve original source in subsequent grafts
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2613,7 +2613,10 @@
cont = False
# commit
- extra = {'source': ctx.hex()}
+ source = ctx.extra().get('source')
+ if not source:
+ source = ctx.hex()
+ extra = {'source': source}
user = ctx.user()
if opts.get('user'):
user = opts['user']
diff --git a/tests/test-graft.t b/tests/test-graft.t
--- a/tests/test-graft.t
+++ b/tests/test-graft.t
@@ -225,3 +225,33 @@
|/
o test at 0: 0
+Graft again onto another branch should preserve the original source
+ $ hg up -q 0
+ $ echo 'g'>g
+ $ hg add g
+ $ hg ci -m 7
+ created new head
+ $ hg graft 7
+ grafting revision 7
+
+ $ hg log -r 7 --template '{rev}:{node}\n'
+ 7:d2e44c99fd3f31c176ea4efb9eca9f6306c81756
+ $ hg log -r 2 --template '{rev}:{node}\n'
+ 2:5c095ad7e90f871700f02dd1fa5012cb4498a2d4
+
+ $ hg log --debug -r tip
+ changeset: 13:39bb1d13572759bd1e6fc874fed1b12ece047a18
+ tag: tip
+ parent: 12:b592ea63bb0c19a6c5c44685ee29a2284f9f1b8f
+ parent: -1:0000000000000000000000000000000000000000
+ manifest: 13:0780e055d8f4cd12eadd5a2719481648f336f7a9
+ user: foo
+ date: Thu Jan 01 00:00:00 1970 +0000
+ files+: b
+ files-: a
+ extra: branch=default
+ extra: source=5c095ad7e90f871700f02dd1fa5012cb4498a2d4
+ description:
+ 2
+
+
More information about the Mercurial-devel
mailing list