Mercurial > hgrepos > DevTools > mercurial-extensions
diff extensions/revinfo.py @ 9:33899e714b14
Added a new option "-n/--name" for revinfo to print the canonical repository path
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Fri, 25 Sep 2015 23:37:22 +0200 |
| parents | fa5189869651 |
| children | b68762aad6ff |
line wrap: on
line diff
--- a/extensions/revinfo.py Fri Aug 21 20:54:48 2015 +0200 +++ b/extensions/revinfo.py Fri Sep 25 23:37:22 2015 +0200 @@ -21,6 +21,7 @@ @command("revinfo", [("r", "rev", "", _('revision to handle'), _('REV')), + ("n", "name", "default", _('the configured default path'), _('DEFAULTPATH')), ], _("hg revinfo [OPTION]... [DEST]")) def revinfo(ui, repo, dest=None, **opts): @@ -32,6 +33,11 @@ By default, the revision used is the parent of the working directory; use -r/--rev to specify a different revision. + Use -n/--name to specify the named path information from + :hg:`paths` as the canonical repository location. It will be + printed as "path:" item to the output. Disable this by providing + an empty DEFAULTPATH. + The printed information is the same as the :hg:`archive` command writes into ".hg_archival.txt". @@ -41,10 +47,14 @@ raise util.Abort(_('no working directory: please specify a revision')) msg = archival.buildmetadata(ctx) + canonicalpath = opts.get("name") + if canonicalpath: + for name, path in sorted(ui.paths.iteritems()): + if name == canonicalpath: + msg += "path: %s\n" % util.hidepassword(path.loc) + break if dest: with open(dest, "wb") as rfile: rfile.write(msg) else: ui.write(msg) - -
