Mercurial > hgrepos > DevTools > mercurial-extensions
changeset 20:8ca89d70b44c
Make the "-p/--path" option an option that can be repeated.
The behaviour is fully backward compatible.
| author | Franz Glasner <hg@dom66.de> |
|---|---|
| date | Mon, 12 Oct 2015 08:56:52 +0200 |
| parents | 5ac4608c5109 |
| children | ecb1bea11468 |
| files | extensions/revinfo.py |
| diffstat | 1 files changed, 14 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/extensions/revinfo.py Sun Sep 27 15:15:11 2015 +0200 +++ b/extensions/revinfo.py Mon Oct 12 08:56:52 2015 +0200 @@ -21,7 +21,7 @@ @command("revinfo", [("r", "rev", "", _('revision to handle'), _('REV')), ("", "amend", None, _('amend a given file with path information')), - ("p", "path", "default", _('the configured default path'), _('SOURCE')), + ("p", "path", [], _('the configured default path'), _('SOURCE')), ], _("hg revinfo [OPTION]... [DEST]")) def revinfo(ui, repo, dest=None, **opts): @@ -35,8 +35,8 @@ 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. Disable this by providing - an empty SOURCE. + printed as "path" item to the output. If no path is given then + "default" is assumed. 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. @@ -58,14 +58,17 @@ raise util.Abort(_("no working directory: please specify a revision")) msg = archival.buildmetadata(ctx) - canonicalpath = opts.get("path") - if 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 + paths = opts.get("path") + if not paths: + 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 + else: + msg += "path: %s\n" % canonicalpath if dest: with open(dest, "wb") as rfile: rfile.write(msg)
