[PATCH 3 of 4] templater: add 'transplant_source' keyword
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Thu Sep 2 08:44:17 CDT 2010
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1283432861 -7200
# Node ID 76b7a9941a452216062b5775e6c1cf066244c72f
# Parent a2494b78a65356d12d533dab936f0423358689f8
templater: add 'transplant_source' keyword.
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -239,6 +239,10 @@ def showrev(repo, ctx, templ, **args):
def showtags(**args):
return showlist('tag', args['ctx'].tags(), **args)
+def showtransplantsource(**args):
+ src = args['ctx'].extra().get('transplant_source', None)
+ return showlist('transplant_source', src and [hex(src)] or [], **args)
+
# keywords are callables like:
# fn(repo, ctx, templ, cache, revcache, **args)
# with:
@@ -267,5 +271,6 @@ keywords = {
'node': shownode,
'rev': showrev,
'tags': showtags,
+ 'transplant_source': showtransplantsource,
}
diff --git a/tests/test-transplant.t b/tests/test-transplant.t
--- a/tests/test-transplant.t
+++ b/tests/test-transplant.t
@@ -25,12 +25,12 @@
$ hg ci -Amb3 -d '2 0'
adding b3
- $ hg log --template '{rev} {parents} {desc}\n'
- 4 b3
- 3 b2
- 2 0:17ab29e464c6 b1
- 1 r2
- 0 r1
+ $ hg log --template '{rev} {transplant_source|stringify|short} {parents} {desc}\n'
+ 4 b3
+ 3 b2
+ 2 0:17ab29e464c6 b1
+ 1 r2
+ 0 r1
$ hg clone . ../rebase
updating to branch default
@@ -49,15 +49,15 @@ rebase b onto r1
722f4667af76 transplanted to 539f377d78df
applying a53251cdf717
a53251cdf717 transplanted to ffd6818a3975
- $ hg log --template '{rev} {parents} {desc}\n'
- 7 b3
- 6 b2
- 5 1:d11e3596cc1a b1
- 4 b3
- 3 b2
- 2 0:17ab29e464c6 b1
- 1 r2
- 0 r1
+ $ hg log --template '{rev} {transplant_source|stringify|short} {parents} {desc}\n'
+ 7 a53251cdf717 b3
+ 6 722f4667af76 b2
+ 5 37a1297eb21b 1:d11e3596cc1a b1
+ 4 b3
+ 3 b2
+ 2 0:17ab29e464c6 b1
+ 1 r2
+ 0 r1
$ hg clone ../t ../prune
updating to branch default
@@ -74,14 +74,14 @@ rebase b onto r1, skipping b2
37a1297eb21b transplanted to e234d668f844
applying a53251cdf717
a53251cdf717 transplanted to 7275fda4d04f
- $ hg log --template '{rev} {parents} {desc}\n'
- 6 b3
- 5 1:d11e3596cc1a b1
- 4 b3
- 3 b2
- 2 0:17ab29e464c6 b1
- 1 r2
- 0 r1
+ $ hg log --template '{rev} {transplant_source|stringify|short} {parents} {desc}\n'
+ 6 a53251cdf717 b3
+ 5 37a1297eb21b 1:d11e3596cc1a b1
+ 4 b3
+ 3 b2
+ 2 0:17ab29e464c6 b1
+ 1 r2
+ 0 r1
remote transplant
@@ -101,13 +101,13 @@ remote transplant
37a1297eb21b transplanted to c19cf0ccb069
applying a53251cdf717
a53251cdf717 transplanted to f7fe5bf98525
- $ hg log --template '{rev} {parents} {desc}\n'
- 3 b3
+ $ hg log --template '{rev} {transplant_source|stringify|short} {parents} {desc}\n'
+ 3 a53251cdf717 b3
(transplanted from a53251cdf717679d1907b289f991534be05c997a)
- 2 b1
+ 2 37a1297eb21b b1
(transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
- 1 r2
- 0 r1
+ 1 r2
+ 0 r1
skip previous transplants
@@ -115,14 +115,14 @@ skip previous transplants
searching for changes
applying 722f4667af76
722f4667af76 transplanted to 47156cd86c0b
- $ hg log --template '{rev} {parents} {desc}\n'
- 4 b2
- 3 b3
+ $ hg log --template '{rev} {transplant_source|stringify|short} {parents} {desc}\n'
+ 4 722f4667af76 b2
+ 3 a53251cdf717 b3
(transplanted from a53251cdf717679d1907b289f991534be05c997a)
- 2 b1
+ 2 37a1297eb21b b1
(transplanted from 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21)
- 1 r2
- 0 r1
+ 1 r2
+ 0 r1
skip local changes transplanted to the source
@@ -162,10 +162,10 @@ remote transplant with pull
added 1 changesets with 1 changes to 1 files
applying a53251cdf717
a53251cdf717 transplanted to 8d9279348abb
- $ hg log --template '{rev} {parents} {desc}\n'
- 2 b3
- 1 b1
- 0 r1
+ $ hg log --template '{rev} {transplant_source|stringify|short} {parents} {desc}\n'
+ 2 a53251cdf717 b3
+ 1 b1
+ 0 r1
transplant --continue
@@ -295,11 +295,11 @@ test filter
filtering .*
applying a53251cdf717
a53251cdf717 transplanted to 14f8512272b5
- $ hg log --template '{rev} {parents} {desc}\n'
- 3 b3
- 2 b2
- 1 b1
- 0 r2
+ $ hg log --template '{rev} {transplant_source|stringify|short} {parents} {desc}\n'
+ 3 a53251cdf717 b3
+ 2 722f4667af76 b2
+ 1 37a1297eb21b b1
+ 0 17ab29e464c6 r2
$ cd ..
More information about the Mercurial-devel
mailing list