diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py --- a/mercurial/templatekw.py +++ b/mercurial/templatekw.py @@ -726,6 +726,11 @@ def showpredecessors(repo, ctx, **args): lambda x: {'ctx': repo[x], 'revcache': {}}, lambda x: scmutil.formatchangeid(repo[x])) +@templatekeyword('reporoot') +def showreporoot(repo, **args): + """String. The root directory of the current repository.""" + return repo.root + @templatekeyword("successorssets") def showsuccessorssets(repo, ctx, **args): """Returns a string of sets of successors for a changectx. Format used diff --git a/tests/test-basic.t b/tests/test-basic.t --- a/tests/test-basic.t +++ b/tests/test-basic.t @@ -87,6 +87,13 @@ Verify should succeed: checking files 1 files, 1 changesets, 1 total revisions +Repository root: + + $ hg root + $TESTTMP/t + $ hg log -l1 -T '{reporoot}\n' + $TESTTMP/t + At the end... $ cd ..