hgext3rd/evolve/obshistory.py
changeset 5173 dbbb48d93f18
parent 5172 52301aff269e
child 5181 c979d64a2589
--- 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 = []