Mercurial > evolve
changeset 5173:dbbb48d93f18
obslog: remove the separate "obslog -f" implementation and use the common one
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Tue, 25 Feb 2020 18:07:30 +0700 |
parents | 52301aff269e |
children | 9b8d4403b735 |
files | hgext3rd/evolve/obshistory.py tests/test-evolve-obshistory-fold.t tests/test-evolve-obshistory-prune.t tests/test-evolve-obshistory.t |
diffstat | 4 files changed, 10 insertions(+), 124 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py Tue Feb 25 17:47:54 2020 +0700 +++ b/hgext3rd/evolve/obshistory.py Tue Feb 25 18:07:30 2020 +0700 @@ -90,11 +90,8 @@ revs = [b'.'] revs = scmutil.revrange(repo, revs) - # Use the default template unless the user provided one, but not if - # -f was given, because that doesn't work with templates yet. Note - # that --no-graph doesn't support -f (it ignores it), so we also - # don't use templating with --no-graph. - if not opts['template'] and not (opts['filternonlocal'] and opts['graph']): + # Use the default template unless the user provided one. + if not opts['template']: opts['template'] = DEFAULT_TEMPLATE if opts['graph']: @@ -195,7 +192,10 @@ if not markers: continue successors = succset[b"successors"] - _debugobshistorydisplaysuccsandmarkers(self.ui, markerfm, successors, markers, ctx.node(), self.repo, self._includediff) + _debugobshistorydisplaymarker(self.ui, markerfm, + successors, markers, + ctx.node(), self.repo, + self._includediff) markerfm.end() @@ -588,120 +588,6 @@ else: fm.data(nopatchreason=_patchavailable[1]) -def _debugobshistorydisplaysuccsandmarkers(ui, fm, succnodes, markers, node, repo, includediff=False): - """ - This function is a duplication of _debugobshistorydisplaymarker modified - to accept multiple markers as input. - """ - fm.startitem() - fm.plain(b' ') - - verb = _successorsetverb(succnodes, markers)[b"verb"] - - fm.write(b'verb', b'%s', verb, - label=b"evolve.verb") - - effects = _markerseffects(markers) - if effects: - fmteffect = fm.formatlist(effects, b'effect', sep=b', ') - fm.write(b'effects', b'(%s)', fmteffect) - - if len(succnodes) > 0: - fm.plain(b' as ') - - shortsnodes = (nodemod.short(succnode) for succnode in sorted(succnodes)) - nodes = fm.formatlist(shortsnodes, b'succnode', sep=b', ') - fm.write(b'succnodes', b'%s', nodes, - label=b"evolve.node") - - # Operations - operations = obsutil.markersoperations(markers) - if operations: - fm.plain(b' using ') - fm.write(b'operation', b'%s', b", ".join(operations), label=b"evolve.operation") - - fm.plain(b' by ') - - # Users - users = obsutil.markersusers(markers) - fm.write(b'user', b'%s', b", ".join(users), - label=b"evolve.user") - fm.plain(b' ') - - # Dates - dates = obsutil.markersdates(markers) - if dates: - min_date = min(dates) - max_date = max(dates) - - if min_date == max_date: - fm.write(b"date", b"(at %s)", fm.formatdate(min_date), label=b"evolve.date") - else: - fm.write(b"date", b"(between %s and %s)", fm.formatdate(min_date), - fm.formatdate(max_date), label=b"evolve.date") - - # initial support for showing note - # if metadata.get('note'): - # fm.plain('\n note: ') - # fm.write('note', "%s", metadata['note'], label="evolve.note") - - # Patch display - if includediff is True: - _patchavailable = patchavailable(node, repo, succnodes) - - if _patchavailable[0] is True: - succ = _patchavailable[1] - - basectx = repo[node] - succctx = repo[succ] - # Description patch - descriptionpatch = getmarkerdescriptionpatch(repo, - basectx.description(), - succctx.description()) - - if descriptionpatch: - # add the diffheader - diffheader = b"diff -r %s -r %s changeset-description\n" %\ - (basectx, succctx) - descriptionpatch = diffheader + descriptionpatch - - def tolist(text): - return [text] - - ui.pushbuffer(labeled=True) - ui.write(b"\n") - - for chunk, label in patch.difflabel(tolist, descriptionpatch): - chunk = chunk.strip(b'\t') - if chunk and chunk != b'\n': - ui.write(b' ') - ui.write(chunk, label=label) - fm.write(b'descdiff', b'%s', ui.popbuffer()) - - # Content patch - ui.pushbuffer(labeled=True) - diffopts = patch.diffallopts(repo.ui, {}) - matchfn = scmutil.matchall(repo) - firstline = True - linestart = True - for chunk, label in patch.diffui(repo, node, succ, matchfn, - opts=diffopts): - if firstline: - ui.write(b'\n') - firstline = False - if linestart: - ui.write(b' ') - linestart = False - if chunk == b'\n': - linestart = True - ui.write(chunk, label=label) - fm.write(b'patch', b'%s', ui.popbuffer()) - else: - fm.write(b'nopatchreason', b"\n (No patch available, %s)", - _patchavailable[1]) - - fm.plain(b"\n") - def _prepare_hunk(hunk): """Drop all information but the username and patch""" cleanunk = []
--- a/tests/test-evolve-obshistory-fold.t Tue Feb 25 17:47:54 2020 +0700 +++ b/tests/test-evolve-obshistory-fold.t Tue Feb 25 18:07:30 2020 +0700 @@ -284,7 +284,7 @@ o eb5a0daa2192 (2) C0 | x 471f378eab4c (1) A0 - folded(description, content) as eb5a0daa2192 using fold by test (at Thu Jan 01 00:00:00 1970 +0000) + folded(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000) diff -r 471f378eab4c -r eb5a0daa2192 changeset-description --- a/changeset-description +++ b/changeset-description @@ -327,7 +327,7 @@ o eb5a0daa2192 (2) C0 | x 471f378eab4c (1) A0 - folded(description, content) as eb5a0daa2192 using fold by test (at Thu Jan 01 00:00:00 1970 +0000) + folded(description, content) as eb5a0daa2192 using fold by test (Thu Jan 01 00:00:00 1970 +0000) diff -r 471f378eab4c -r eb5a0daa2192 changeset-description --- a/changeset-description +++ b/changeset-description
--- a/tests/test-evolve-obshistory-prune.t Tue Feb 25 17:47:54 2020 +0700 +++ b/tests/test-evolve-obshistory-prune.t Tue Feb 25 18:07:30 2020 +0700 @@ -121,7 +121,7 @@ $ hg obslog -f -R $TESTTMP/server --patch 0dec01379d3b --hidden x 0dec01379d3b (2) B0 - pruned using prune by test (at Thu Jan 01 00:00:00 1970 +0000) + pruned using prune by test (Thu Jan 01 00:00:00 1970 +0000) (No patch available, no successors) # TODO ADD amend + prune
--- a/tests/test-evolve-obshistory.t Tue Feb 25 17:47:54 2020 +0700 +++ b/tests/test-evolve-obshistory.t Tue Feb 25 18:07:30 2020 +0700 @@ -148,7 +148,7 @@ o 7a230b46bf61 (2) A2 | @ 471f378eab4c (1) A0 - reworded(description) as 7a230b46bf61 using amend by test (at Thu Jan 01 00:00:00 1970 +0000) + reworded(description) as 7a230b46bf61 using amend by test (Thu Jan 01 00:00:00 1970 +0000) diff -r 471f378eab4c -r 7a230b46bf61 changeset-description --- a/changeset-description +++ b/changeset-description