Mercurial > hgrepos > DevTools > mercurial-extensions
changeset 40:fe48ca312f92
Use "." if the current repository root is to be assumed as path information
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Sun, 12 Nov 2017 09:24:27 +0100 |
| parents | 84398f899f8e |
| children | c05d8dcb4bb0 |
| files | extensions/revinfo.py |
| diffstat | 1 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/revinfo.py Sun Nov 12 00:53:18 2017 +0100 +++ b/extensions/revinfo.py Sun Nov 12 09:24:27 2017 +0100 @@ -38,16 +38,18 @@ By default, the revision used is the parent of the working directory; use -r/--rev to specify a different revision. - Use -p/--path to specify the named path information from - :hg:`paths` as the canonical repository location. It will be - printed as "path" item to the output. If no path is given then - "default" is assumed. Disable this by providing an empty SOURCE. + Use -p/--path to specify named path information from :hg:`paths` + as the canonical repository location. It will be printed as "path" + item to the output. If no path is given then "default" is + assumed. Use "." to use the current workspace root. + Disable this by providing an empty SOURCE. Use --amend to extend a given file with a "path" item. Can also be used to put more than one path item into the file. The printed information is the same as the :hg:`archive` command writes into ".hg_archival.txt". The "path" info is an extra item. + """ if opts.get("amend") and opts.get("rev"): raise util.Abort(_("cannot use -r/--rev together with --amend")) @@ -81,12 +83,15 @@ paths = ["default"] for canonicalpath in paths: if canonicalpath: - for name, path in sorted(ui.paths.iteritems()): - if name == canonicalpath: - msg += "path: %s\n" % util.hidepassword(path.loc) - break + if canonicalpath == ".": + msg += "path: %s\n" % repo.root else: - msg += "path: %s\n" % canonicalpath + for name, path in sorted(ui.paths.iteritems()): + if name == canonicalpath: + msg += "path: %s\n" % util.hidepassword(path.loc) + break + else: + msg += "path: %s\n" % canonicalpath if dest: with open(dest, "wb") as rfile: rfile.write(msg)
