# HG changeset patch # User Anton Shestakov # Date 1582020658 -28800 # Node ID f8488bdc9e4bb883ab75e4718869c7ac019e405d # Parent 897b371cd0c5b400ef575324e614b6b5cb9b9d96 obslog: make note template property into notes diff -r 897b371cd0c5 -r f8488bdc9e4b hgext3rd/evolve/obshistory.py --- a/hgext3rd/evolve/obshistory.py Tue Feb 18 18:07:11 2020 +0800 +++ b/hgext3rd/evolve/obshistory.py Tue Feb 18 18:10:58 2020 +0800 @@ -118,17 +118,17 @@ 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_NOTE = b"""{if(note, "\n note: {label("evolve.note", note)}")}""" +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")}%(note)s{indent(descdiff, " ")}{indent("%(patch)s", " ")}\n"} +{markers %% " {separate(" ", "%(rewrite)s", "%(operations)s", "%(users)s", "%(date)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"note": TEMPLATE_NOTE, + b"notes": TEMPLATE_NOTES, b"patch": TEMPLATE_PATCH, } @@ -499,7 +499,6 @@ def _debugobshistorydisplaymarker(ui, fm, marker, node, repo, includediff=False): succnodes = marker[1] date = marker[4] - metadata = dict(marker[3]) fm.startitem() @@ -528,9 +527,10 @@ fm.data(date=date) - # initial support for showing note - if metadata.get(b'note'): - fm.data(note=metadata[b'note']) + # Notes + notes = _markersnotes([marker]) + if notes: + fm.data(notes=fm.formatlist(notes, name=b'note', sep=b'\n')) # Patch display if includediff is True: @@ -734,6 +734,11 @@ return (fate, successors) +def _markersnotes(markers): + markersmeta = [dict(m[3]) for m in markers] + notes = [meta.get(b'note') for meta in markersmeta] + return sorted(note for note in notes if note) + EFFECTMAPPING = util.sortdict([ (obsutil.DESCCHANGED, b'description'), (obsutil.METACHANGED, b'meta'), diff -r 897b371cd0c5 -r f8488bdc9e4b tests/test-evolve-obshistory-split.t --- a/tests/test-evolve-obshistory-split.t Tue Feb 18 18:07:11 2020 +0800 +++ b/tests/test-evolve-obshistory-split.t Tue Feb 18 18:10:58 2020 +0800 @@ -123,7 +123,9 @@ "parent", "content" ], - "note": "testing split", + "notes": [ + "testing split" + ], "operations": [ "split" ],