Mercurial > hg
changeset 13689:65399579da68
transplant: add "transplanted" keyword
$ hg log --template '{rev} {transplanted}\n'
7 a53251cdf717679d1907b289f991534be05c997a
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Thu, 17 Mar 2011 22:17:27 +0100 |
parents | f0a2aa60aea9 |
children | af331f557942 |
files | hgext/transplant.py tests/test-transplant.t |
diffstat | 2 files changed, 20 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/transplant.py Thu Mar 17 12:00:49 2011 -0500 +++ b/hgext/transplant.py Thu Mar 17 22:17:27 2011 +0100 @@ -17,7 +17,7 @@ import os, tempfile from mercurial import bundlerepo, cmdutil, hg, merge, match from mercurial import patch, revlog, util, error -from mercurial import revset +from mercurial import revset, templatekw class transplantentry(object): def __init__(self, lnode, rnode): @@ -608,8 +608,15 @@ cs.add(r) return [r for r in s if r in cs] +def kwtransplanted(repo, ctx, **args): + """:transplanted: String. The node identifier of the transplanted + changeset if any.""" + n = ctx.extra().get('transplant_source') + return n and revlog.hex(n) or '' + def extsetup(ui): revset.symbols['transplanted'] = revsettransplanted + templatekw.keywords['transplanted'] = kwtransplanted cmdtable = { "transplant":
--- a/tests/test-transplant.t Thu Mar 17 12:00:49 2011 -0500 +++ b/tests/test-transplant.t Thu Mar 17 22:17:27 2011 +0100 @@ -68,6 +68,18 @@ $ hg help revsets | grep transplanted "transplanted(set)" +test tranplanted keyword + + $ hg log --template '{rev} {transplanted}\n' + 7 a53251cdf717679d1907b289f991534be05c997a + 6 722f4667af767100cb15b6a79324bf8abbfe1ef4 + 5 37a1297eb21b3ef5c5d2ffac22121a0988ed9f21 + 4 + 3 + 2 + 1 + 0 + $ hg clone ../t ../prune updating to branch default 4 files updated, 0 files merged, 0 files removed, 0 files unresolved