mercurial@30008: 2 new changesets
2 new changesets in mercurial: http://selenic.com/repo/hg//rev/aca0954d3739 changeset: 30007:aca0954d3739 user:Xidorn Quandate:Sat Sep 17 17:02:56 2016 +1000 summary: rebase: rebase changesets in topo order (issue5370) (BC) http://selenic.com/repo/hg//rev/e83f89d3b1f7 changeset: 30008:e83f89d3b1f7 bookmark:@ tag: tip user:Hannes Oldenburg date:Fri Sep 23 08:15:05 2016 + summary: templates: add built-in files() function -- Repository URL: http://selenic.com/repo/hg/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 5] extdata: add revset support for extdata
On Sat, 2016-09-24 at 00:22 +0200, Pierre-Yves David wrote: > > On 09/23/2016 07:34 PM, Matt Mackall wrote: > > > > On Fri, 2016-09-23 at 19:49 +0900, FUJIWARA Katsunori wrote: > > > > > > At Thu, 22 Sep 2016 13:21:36 -0500, > > > Matt Mackall wrote: > > > > > > > > > > > > > > > > # HG changeset patch > > > > # User Matt Mackall> > > > # Date 1474293900 18000 > > > > # Mon Sep 19 09:05:00 2016 -0500 > > > > # Node ID 9c8847df32a0c5045e60aded2e03a9c97507f909 > > > > # Parent 19bf2776dfe39befdc479253e1e7d030b41c08f9 > > > > extdata: add revset support for extdata > > > > > > > > This inserts extdata into the revset function support. Planned > > > > extensions of extdata support arguments, so this is the most > > > > appropriate place for it. > > > > > > > > Unfortunately, the registrar framework is not a good fit here. First, > > > > setting an appropriate load point is still an unsolved problem (we > > > > want the code to live in revset.py, but that module may never be > > > > loaded). > > > > Second, registered methods become global and the data sources are likely > > > > to > > > > be > > > > repo-specific. This won't work well in a context like hgwebdir. > > > Is there any reason not to define extdata() revset predicate (or > > > template function), which requires external data source name like as > > > extdata('filedata') ? (for convenience ?) > > It's mostly convenience. But I also plan to add support for arguments. > I think I really like foozy idea about using a generic 'extdata("key")' > predicate. That will probably be okay for many case and prevent > unexpected collision with other revsets. If needed, the user can easily > define a revset alias for the sources in needs easy access to. As > configuration of the source is needed anyway, this does seems like a > bearable burden. > > If I remember correctly, it does not seems to have limitation in the > current implementation of revset that would prevent use to do > 'extdata("key", arg1, arg2)' You get to implement this version, because I think it's an awful idea. -- Mathematics is the supreme nostalgia of our time. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V3] templates: add built-in files() function
On Sat, 24 Sep 2016 09:08:23 +, Hannes Oldenburg wrote: > # HG changeset patch > # User Hannes Oldenburg> # Date 1474618505 0 > # Fri Sep 23 08:15:05 2016 + > # Node ID 427d035e61a8a98b23f4b6248220b4d24db90cba > # Parent b19c2679289cc5e9b51eac84b63c304bda0096dc > templates: add built-in files() function LGTM, queued this, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH V3] templates: add built-in files() function
# HG changeset patch # User Hannes Oldenburg# Date 1474618505 0 # Fri Sep 23 08:15:05 2016 + # Node ID 427d035e61a8a98b23f4b6248220b4d24db90cba # Parent b19c2679289cc5e9b51eac84b63c304bda0096dc templates: add built-in files() function We already support multiple primitive for listing files, which were affected by the current changeset. This patch adds files() which returns files of the current changeset matching a given pattern or fileset query via the "set:" prefix. diff -r b19c2679289c -r 427d035e61a8 mercurial/help/templates.txt --- a/mercurial/help/templates.txt Thu Sep 22 12:36:30 2016 -0700 +++ b/mercurial/help/templates.txt Fri Sep 23 08:15:05 2016 + @@ -95,6 +95,10 @@ $ hg log -r 0 --template "files: {join(files, ', ')}\n" +- Join the list of files ending with ".py" with a ", ":: + + $ hg log -r 0 --template "pythonfiles: {join(files('**.py'), ', ')}\n" + - Separate non-empty arguments by a " ":: $ hg log -r 0 --template "{separate(' ', node, bookmarks, tags}\n" diff -r b19c2679289c -r 427d035e61a8 mercurial/templater.py --- a/mercurial/templater.pyThu Sep 22 12:36:30 2016 -0700 +++ b/mercurial/templater.pyFri Sep 23 08:15:05 2016 + @@ -480,6 +480,20 @@ return ''.join(chunks) +@templatefunc('files(pattern)') +def files(context, mapping, args): +"""All files of the current changeset matching the pattern. See +:hg:`help patterns`.""" +if not len(args) == 1: +# i18n: "files" is a keyword +raise error.ParseError(_("files expects one argument")) + +raw = evalstring(context, mapping, args[0]) +ctx = mapping['ctx'] +m = ctx.match([raw]) +files = list(ctx.matches(m)) +return templatekw.showlist("file", files, **mapping) + @templatefunc('fill(text[, width[, initialident[, hangindent]]])') def fill(context, mapping, args): """Fill many diff -r b19c2679289c -r 427d035e61a8 tests/test-command-template.t --- a/tests/test-command-template.t Thu Sep 22 12:36:30 2016 -0700 +++ b/tests/test-command-template.t Fri Sep 23 08:15:05 2016 + @@ -3501,6 +3501,26 @@ 5:13207e5a10d9fd28ec424934298e176197f2c67f, 4:bbe44766e73d5f11ed2177f1838de10c53ef3e74 +Test files function + + $ hg log -T "{rev}\n{join(files('*'), '\n')}\n" + 2 + a + aa + b + 1 + a + 0 + a + + $ hg log -T "{rev}\n{join(files('aa'), '\n')}\n" + 2 + aa + 1 + + 0 + + Test active bookmark templating $ hg book foo diff -r b19c2679289c -r 427d035e61a8 tests/test-help.t --- a/tests/test-help.t Thu Sep 22 12:36:30 2016 -0700 +++ b/tests/test-help.t Fri Sep 23 08:15:05 2016 + @@ -1551,6 +1551,9 @@ $ hg help template.files files List of strings. All files modified, added, or removed by this changeset. + files(pattern) +All files of the current changeset matching the pattern. See +'hg help patterns'. Test section lookup by translated message ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel