[PATCH 4 of 4] templater: add 'convert_source' keyword
Dan Villiom Podlaski Christiansen
danchr at gmail.com
Thu Sep 2 08:44:18 CDT 2010
# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr at gmail.com>
# Date 1283434242 -7200
# Node ID 5dea8cc1efcd6bf0272f7f956552c6306677426f
# Parent 76b7a9941a452216062b5775e6c1cf066244c72f
templater: add 'convert_source' keyword.
diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
--- a/mercurial/templatekw.py
+++ b/mercurial/templatekw.py
@@ -243,6 +243,10 @@ def showtransplantsource(**args):
src = args['ctx'].extra().get('transplant_source', None)
return showlist('transplant_source', src and [hex(src)] or [], **args)
+def showconvertsource(**args):
+ src = args['ctx'].extra().get('convert_revision', None)
+ return showlist('convert_source', src and [src] or [], **args)
+
# keywords are callables like:
# fn(repo, ctx, templ, cache, revcache, **args)
# with:
@@ -272,5 +276,6 @@ keywords = {
'rev': showrev,
'tags': showtags,
'transplant_source': showtransplantsource,
+ 'convert_source': showconvertsource,
}
diff --git a/tests/test-convert-hg-startrev.t b/tests/test-convert-hg-startrev.t
--- a/tests/test-convert-hg-startrev.t
+++ b/tests/test-convert-hg-startrev.t
@@ -9,7 +9,8 @@
$ glog()
> {
- > hg -R "$1" glog --template '{rev} "{desc}" files: {files}\n'
+ > hg -R "$1" glog --template \
+ > '{rev} "{desc}" files: {files}\nsource: {convert_source}\n'
> }
$ hg init source
@@ -73,7 +74,7 @@ Convert from zero revision
o | 1 "1: add c" files: c
|/
o 0 "0: add a b" files: a b
-
+ source: 83b9ec4abfaf46e22378d01514190ddb925f7b62
Convert from merge parent
$ hg convert --config convert.hg.startrev=1 source conv1
@@ -94,7 +95,7 @@ Convert from merge parent
o 1 "2: copy e from a, change b" files: b e
|
o 0 "1: add c" files: a b c
-
+ source: d67172394796a5665dee7ed219111c749c4b5135
$ cd conv1
Check copy preservation
@@ -140,7 +141,7 @@ Convert from merge
o 1 "5: change a" files: a
|
o 0 "4: merge 2 and 3, copy d from b" files: a b c d e
-
+ source: 20648c59b51f5195515b182aed3d4a36271b750a
$ cd conv4
$ hg up -C
5 files updated, 0 files merged, 0 files removed, 0 files unresolved
More information about the Mercurial-devel
mailing list