diff mercurial/commands.py @ 42419:69883775b27d

root: add template variables pointing to repository directories These paths are useful for GUI applications to detect changes. A GUI process typically monitors .hg and .hg/store directories so that it will be notified on lock/wlock deletion. Alternatively, maybe we can add debugpaths command if we don't want to extend the root command. I'm not sure which will be nicer.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 04 Jun 2019 21:13:35 +0900
parents 9803323048b6
children 1314c0bb6b24
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Jun 04 20:58:39 2019 +0900
+++ b/mercurial/commands.py	Tue Jun 04 21:13:35 2019 +0900
@@ -5232,12 +5232,23 @@
 
     Print the root directory of the current repository.
 
+    .. container:: verbose
+
+      Template:
+
+      The following keywords are supported in addition to the common template
+      keywords and functions. See also :hg:`help templates`.
+
+      :hgpath:    String. Path to the .hg directory.
+      :storepath: String. Path to the directory holding versioned data.
+
     Returns 0 on success.
     """
     opts = pycompat.byteskwargs(opts)
     with ui.formatter('root', opts) as fm:
         fm.startitem()
         fm.write('reporoot', '%s\n', repo.root)
+        fm.data(hgpath=repo.path, storepath=repo.spath)
 
 @command('serve',
     [('A', 'accesslog', '', _('name of access log file to write to'),