Mercurial > evolve
changeset 2630:8503ba8b82e3
merge: get stable change back into default
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 19 Jun 2017 18:44:17 +0200 |
parents | 42abd3bd30ee (current diff) 9c0f6b85c28f (diff) |
children | bdc53285781f |
files | README tests/test-evolve-templates.t |
diffstat | 4 files changed, 38 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/README Mon Jun 19 03:13:35 2017 +0530 +++ b/README Mon Jun 19 18:44:17 2017 +0200 @@ -128,6 +128,11 @@ - stack: properly abort when and unknown topic is requested, - topic: fix issue5441 in the linear case, +6.4.1 - in progress +------------------- + + - obsfate: improve support for advanced template reformating + 6.4.0 -- 2017-06-16 -------------------
--- a/hgext3rd/evolve/metadata.py Mon Jun 19 03:13:35 2017 +0530 +++ b/hgext3rd/evolve/metadata.py Mon Jun 19 18:44:17 2017 +0200 @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -__version__ = '6.4.0' +__version__ = '6.4.1.dev' testedwith = '3.8.4 3.9.2 4.0.2 4.1.2 4.2' minimumhgversion = '3.8' buglink = 'https://bz.mercurial-scm.org/'
--- a/hgext3rd/evolve/templatekw.py Mon Jun 19 03:13:35 2017 +0530 +++ b/hgext3rd/evolve/templatekw.py Mon Jun 19 18:44:17 2017 +0200 @@ -126,7 +126,6 @@ datetempleq = ' (at {min_date|isodate})' datetemplnoteq = ' (between {min_date|isodate} and {max_date|isodate})' datetempl = '{if(max_date, "{ifeq(min_date, max_date, "%s", "%s")}")}' % (datetempleq, datetemplnoteq) - newline = '\n' optionalusertempl = usertempl username = _getusername(ui) @@ -136,9 +135,9 @@ # Assemble them return { - 'obsfate_quiet': verbtempl + succtempl + newline, - 'obsfate': verbtempl + optionalusertempl + succtempl + newline, - 'obsfate_verbose': verbtempl + usertempl + succtempl + datetempl + newline + 'obsfate_quiet': verbtempl + succtempl, + 'obsfate': verbtempl + optionalusertempl + succtempl, + 'obsfate_verbose': verbtempl + usertempl + succtempl + datetempl, } @eh.templatekw("obsfate") @@ -198,7 +197,29 @@ else: name = "obsfate" - return templatekw.showlist(name, values, args, separator=' + ') + # Format a single value + def fmt(d): + nargs = args.copy() + nargs.update(d[name]) + return args['templ'](name, **nargs) + + # Generate a good enough string representation using templater + gen = [] + for d in values: + chunk = fmt({name: d}) + chunkstr = [] + + # Empty the generator + try: + while True: + chunkstr.append(chunk.next()) + except StopIteration: + pass + + gen.append("".join(chunkstr)) + gen = "; ".join(gen) + + return templatekw._hybrid(gen, values, lambda x: {name: x}, fmt) # copy from mercurial.obsolete with a small change to stop at first known changeset.
--- a/tests/test-evolve-templates.t Mon Jun 19 03:13:35 2017 +0530 +++ b/tests/test-evolve-templates.t Mon Jun 19 18:44:17 2017 +0200 @@ -17,8 +17,8 @@ > {if(precursors, "\n semi-colon: {join(precursors, "; ")}")}\ > {if(successors, "\n Successors: {successors}")}\ > {if(successors, "\n semi-colon: {join(successors, "; ")}")}\ - > {if(obsfate, "\n Fate: {obsfate}")}\n' - > fatelog = log -G -T '{node|short}\n{if(obsfate, " Obsfate: {obsfate}\n")}' + > {if(obsfate, "\n Fate: {join(obsfate, "\n Fate: ")}\n")}\n' + > fatelog = log -G -T '{node|short}\n{if(obsfate, " Obsfate: {join(obsfate, "; ")}\n\n")}' > fatelogjson = log -G -T '{node|short} {obsfate|json}\n' > EOF @@ -660,7 +660,7 @@ |/ Successors: [fdf9bde5129a], [019fadeab383] | semi-colon: [fdf9bde5129a]; [019fadeab383] | Fate: rewritten as fdf9bde5129a - | rewritten as 019fadeab383 + | Fate: rewritten as 019fadeab383 | o ea207398892e @@ -670,8 +670,7 @@ | o fdf9bde5129a |/ | @ 471f378eab4c - |/ Obsfate: rewritten as fdf9bde5129a - | rewritten as 019fadeab383 + |/ Obsfate: rewritten as fdf9bde5129a; rewritten as 019fadeab383 | o ea207398892e @@ -714,7 +713,7 @@ |/ Successors: [fdf9bde5129a], [65b757b745b9] | semi-colon: [fdf9bde5129a]; [65b757b745b9] | Fate: rewritten as fdf9bde5129a - | rewritten as 65b757b745b9 + | Fate: rewritten as 65b757b745b9 | o ea207398892e @@ -727,8 +726,7 @@ | @ fdf9bde5129a |/ | x 471f378eab4c - |/ Obsfate: rewritten as fdf9bde5129a - | rewritten as 65b757b745b9 + |/ Obsfate: rewritten as fdf9bde5129a; rewritten as 65b757b745b9 | o ea207398892e