[PATCH] log-style: show the style list when I try to use a wrong one
Kevin Bullock
kbullock+mercurial at ringworld.org
Thu Apr 18 13:51:08 CDT 2013
On 18 Apr 2013, at 1:13 PM, Iulian Stana wrote:
> # HG changeset patch
> # User Iulian Stana <julian.stana at gmail.com>
> # Date 1366228237 -10800
> # Wed Apr 17 22:50:37 2013 +0300
> # Node ID cacb96e80ea80ef623589c171e81911205777265
> # Parent 186c1300c10d40b4d6871e851b57d8d44368dcb0
> log-style: show the style list when I try to use a wrong one
Getting closer. This will also affect hgweb, so 'templater' is probably the right topic keyword here.
Also see inline comments below.
When you re-send, you can use the --flag option to patchbomb to mark the re-sent patch as 'V2' (or similar).
> When someone try to use a wrong style, a list with sugestions will appear.
>
> In the test-log.t file it's a test that prove this thing.
>
> diff -r 186c1300c10d -r cacb96e80ea8 mercurial/templater.py
> --- a/mercurial/templater.py Tue Apr 16 22:09:28 2013 +0300
> +++ b/mercurial/templater.py Wed Apr 17 22:50:37 2013 +0300
> @@ -391,6 +391,21 @@
>
> engines = {'default': engine}
>
> +def stylelist():
> + path = templatepath()[0]
> + dirlist = os.listdir(path)
> + stylelist = ''
> + notfirst = False
> + for file in dirlist:
> + split = file.split(".")
> + if split[0] == "map-cmdline":
> + if notfirst == True:
> + stylelist = stylelist + ','
> + else:
> + notfirst = True
> + stylelist = stylelist + ' ' + split[1]
> + return stylelist
> +
> class templater(object):
>
> def __init__(self, mapfile, filters={}, defaults={}, cache={},
> @@ -412,7 +427,7 @@
> if not mapfile:
> return
> if not os.path.exists(mapfile):
> - raise util.Abort(_('style not found: %s') % mapfile)
> + raise util.Abort(_("style '%s' not found \n(available styles:%s)") % (mapfile,stylelist()))
Not quite what I meant. See mercurial.error.Abort(): 'hint' is a keyword argument.
>
> conf = config.config()
> conf.read(mapfile)
> diff -r 186c1300c10d -r cacb96e80ea8 tests/test-log.t
> --- a/tests/test-log.t Tue Apr 16 22:09:28 2013 +0300
> +++ b/tests/test-log.t Wed Apr 17 22:50:37 2013 +0300
> @@ -67,7 +67,7 @@
> abort: cannot follow file not in parent revision: "dir"
> [255]
>
> --f, one
> +-f, phases style
Still an unrelated change.
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130418/76082310/attachment.html>
More information about the Mercurial-devel
mailing list