Mercurial > evolve
changeset 5171:7f7f40cc6c9b
obslog: make date template property into dates
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 18 Feb 2020 18:16:11 +0800 |
parents | f8488bdc9e4b |
children | 52301aff269e |
files | hgext3rd/evolve/obshistory.py tests/test-evolve-cycles.t tests/test-evolve-obshistory-amend-then-fold.t tests/test-evolve-obshistory-amend.t tests/test-evolve-obshistory-content-divergent.t tests/test-evolve-obshistory-fold.t tests/test-evolve-obshistory-lots-of-splits.t tests/test-evolve-obshistory-phase-divergent.t tests/test-evolve-obshistory-prune.t tests/test-evolve-obshistory-split.t |
diffstat | 10 files changed, 126 insertions(+), 74 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py Tue Feb 18 18:10:58 2020 +0800 +++ b/hgext3rd/evolve/obshistory.py Tue Feb 18 18:16:11 2020 +0800 @@ -117,17 +117,22 @@ } TEMPLATE_OPERATIONS = b"""{if(operations, "using {label("evolve.operation", join(operations, ", "))}")}""" TEMPLATE_USERS = b"""by {label("evolve.user", join(users, ", "))}""" -TEMPLATE_DATE = b"""{label("evolve.date", "({date(date, "%a %b %d %H:%M:%S %Y %1%2")})")}""" +TEMPLATE_ONE_DATE = b"""({date(max(dates), "%a %b %d %H:%M:%S %Y %1%2")})""" +TEMPLATE_MANY_DATES = b"""(between {date(min(dates), "%a %b %d %H:%M:%S %Y %1%2")} and {date(max(dates), "%a %b %d %H:%M:%S %Y %1%2")})""" +TEMPLATE_DATES = b"""{label("evolve.date", ifeq(min(dates), max(dates), "%(onedate)s", "%(manydates)s"))}""" % { + b"onedate": TEMPLATE_ONE_DATE, + b"manydates": TEMPLATE_MANY_DATES +} TEMPLATE_NOTES = b"""{if(notes, notes % "\n note: {label("evolve.note", note)}")}""" TEMPLATE_PATCH = b"""{if(patch, "{patch}")}{if(nopatchreason, "\n(No patch available, {nopatchreason})")}""" DEFAULT_TEMPLATE = (b"""%(firstline)s -{markers %% " {separate(" ", "%(rewrite)s", "%(operations)s", "%(users)s", "%(date)s")}%(notes)s{indent(descdiff, " ")}{indent("%(patch)s", " ")}\n"} +{markers %% " {separate(" ", "%(rewrite)s", "%(operations)s", "%(users)s", "%(dates)s")}%(notes)s{indent(descdiff, " ")}{indent("%(patch)s", " ")}\n"} """) % { b"firstline": TEMPLATE_FIRST_LINE, b"rewrite": TEMPLATE_REWRITE, b"operations": TEMPLATE_OPERATIONS, b"users": TEMPLATE_USERS, - b"date": TEMPLATE_DATE, + b"dates": TEMPLATE_DATES, b"notes": TEMPLATE_NOTES, b"patch": TEMPLATE_PATCH, } @@ -498,7 +503,6 @@ def _debugobshistorydisplaymarker(ui, fm, marker, node, repo, includediff=False): succnodes = marker[1] - date = marker[4] fm.startitem() @@ -525,7 +529,9 @@ users = obsutil.markersusers([marker]) fm.data(users=fm.formatlist(users, name=b'user', sep=b', ')) - fm.data(date=date) + # Dates + dates = obsutil.markersdates([marker]) + fm.data(dates=fm.formatlist(dates, name=b'date')) # Notes notes = _markersnotes([marker])
--- a/tests/test-evolve-cycles.t Tue Feb 18 18:10:58 2020 +0800 +++ b/tests/test-evolve-cycles.t Tue Feb 18 18:16:11 2020 +0800 @@ -296,9 +296,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description", @@ -323,9 +325,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description", @@ -350,9 +354,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description", @@ -377,9 +383,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description", @@ -405,9 +413,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description", @@ -432,9 +442,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description",
--- a/tests/test-evolve-obshistory-amend-then-fold.t Tue Feb 18 18:10:58 2020 +0800 +++ b/tests/test-evolve-obshistory-amend-then-fold.t Tue Feb 18 18:16:11 2020 +0800 @@ -158,9 +158,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ *, (glob) @@ -185,9 +187,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description" @@ -210,9 +214,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description",
--- a/tests/test-evolve-obshistory-amend.t Tue Feb 18 18:10:58 2020 +0800 +++ b/tests/test-evolve-obshistory-amend.t Tue Feb 18 18:16:11 2020 +0800 @@ -151,9 +151,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description", @@ -200,9 +202,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ *, (glob)
--- a/tests/test-evolve-obshistory-content-divergent.t Tue Feb 18 18:10:58 2020 +0800 +++ b/tests/test-evolve-obshistory-content-divergent.t Tue Feb 18 18:16:11 2020 +0800 @@ -129,9 +129,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description" @@ -148,9 +150,11 @@ "verb": "reworded" }, { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description" @@ -301,9 +305,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description" @@ -320,9 +326,11 @@ "verb": "reworded" }, { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description"
--- a/tests/test-evolve-obshistory-fold.t Tue Feb 18 18:10:58 2020 +0800 +++ b/tests/test-evolve-obshistory-fold.t Tue Feb 18 18:16:11 2020 +0800 @@ -178,9 +178,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description", @@ -204,9 +206,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description",
--- a/tests/test-evolve-obshistory-lots-of-splits.t Tue Feb 18 18:10:58 2020 +0800 +++ b/tests/test-evolve-obshistory-lots-of-splits.t Tue Feb 18 18:16:11 2020 +0800 @@ -197,9 +197,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "parent", @@ -241,9 +243,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "parent",
--- a/tests/test-evolve-obshistory-phase-divergent.t Tue Feb 18 18:10:58 2020 +0800 +++ b/tests/test-evolve-obshistory-phase-divergent.t Tue Feb 18 18:16:11 2020 +0800 @@ -98,9 +98,11 @@ { "markers": [ { - "date": [ - *, (glob) - 0 + "dates": [ + [ + *, (glob) + 0 + ] ], "effects": [ "description" @@ -205,9 +207,11 @@ { "markers": [ { - "date": [ - 0.0, - 0 + "dates": [ + [ + 0.0, + 0 + ] ], "effects": [ "description"