templatekw: add obsorigin keyword draft
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 15 Jan 2020 16:28:35 +0700
changeset 5255 939ff6ea1e7d
parent 5254 78bdd1fabe25
child 5256 0eba17d734ca
templatekw: add obsorigin keyword
hgext3rd/evolve/obshistory.py
hgext3rd/evolve/templatekw.py
tests/test-evolve-templates.t
--- a/hgext3rd/evolve/obshistory.py	Tue Jan 14 20:58:26 2020 +0700
+++ b/hgext3rd/evolve/obshistory.py	Wed Jan 15 16:28:35 2020 +0700
@@ -822,3 +822,73 @@
 @eh.wrapfunction(obsutil, 'obsfateverb')
 def obsfateverb(orig, *args, **kwargs):
     return _successorsetverb(*args, **kwargs)[b'verb']
+
+def obsoriginverb(predecessors, markers):
+    verb = None
+    if not predecessors:
+        return None
+    elif len(predecessors) == 1:
+        verb = _markerspreciseverb(markers)
+        if verb is None:
+            verb = b'rewritten'
+    else:
+        verb = b'folded'
+    return verb
+
+def obsoriginprinter(ui, repo, predecessors, markers):
+    """ Build an obsorigin string for a single set of predecessors.
+    """
+    quiet = ui.quiet
+    verbose = ui.verbose
+    normal = not verbose and not quiet
+
+    line = []
+
+    # Verb
+    line.append(obsoriginverb(predecessors, markers))
+
+    # Operations
+    operations = obsutil.markersoperations(markers)
+    if operations:
+        line.append(b" using %s" % b", ".join(operations))
+
+    # Predecessors
+    if predecessors:
+        unfi = repo.unfiltered()
+
+        def formatnode(node):
+            if node in unfi:
+                return scmutil.formatchangeid(unfi[node])
+            return nodemod.short(node)
+
+        fmtpredecessors = [formatnode(pred) for pred in predecessors]
+        line.append(b" from %s" % b", ".join(sorted(fmtpredecessors)))
+
+    # Users
+    users = obsutil.markersusers(markers)
+    # Filter out current user in not verbose mode to reduce amount of
+    # information
+    if not verbose:
+        currentuser = ui.username(acceptempty=True)
+        if len(users) == 1 and currentuser in users:
+            users = None
+
+    if (verbose or normal) and users:
+        line.append(b" by %s" % b", ".join(users))
+
+    # Dates
+    dates = obsutil.markersdates(markers)
+
+    if dates and verbose:
+        min_date = min(dates)
+        max_date = max(dates)
+
+        if min_date == max_date:
+            fmtmin_date = compat.datestr(min_date, b'%Y-%m-%d %H:%M %1%2')
+            line.append(b" (at %s)" % fmtmin_date)
+        else:
+            fmtmin_date = compat.datestr(min_date, b'%Y-%m-%d %H:%M %1%2')
+            fmtmax_date = compat.datestr(max_date, b'%Y-%m-%d %H:%M %1%2')
+            line.append(b" (between %s and %s)" % (fmtmin_date, fmtmax_date))
+
+    return b"".join(line)
--- a/hgext3rd/evolve/templatekw.py	Tue Jan 14 20:58:26 2020 +0700
+++ b/hgext3rd/evolve/templatekw.py	Wed Jan 15 16:28:35 2020 +0700
@@ -11,6 +11,7 @@
 from . import (
     error,
     exthelper,
+    obshistory,
 )
 
 from mercurial import (
@@ -37,6 +38,19 @@
         ctx = context.resource(mapping, b'ctx')
         return templatekw.compatlist(context, mapping, b'trouble',
                                      ctx.instabilities(), plural=b'troubles')
+
+    @eh.templatekeyword(b'obsorigin', requires={b'ui', b'repo', b'ctx'})
+    def showobsorigin(context, mapping):
+        ui = context.resource(mapping, b'ui')
+        repo = context.resource(mapping, b'repo')
+        ctx = context.resource(mapping, b'ctx')
+        values = []
+        for x in obshistory.predecessorsandmarkers(repo, ctx):
+            if not x[b'predecessors']:
+                continue
+            v = obshistory.obsoriginprinter(ui, repo, x[b'predecessors'], x[b'markers'])
+            values.append(v)
+        return templatekw.compatlist(context, mapping, b'origin', values)
 else:
     # older template API in hg < 4.6
     @eh.templatekeyword(b'instabilities')
--- a/tests/test-evolve-templates.t	Tue Jan 14 20:58:26 2020 +0700
+++ b/tests/test-evolve-templates.t	Wed Jan 15 16:28:35 2020 +0700
@@ -19,7 +19,8 @@
   >     {if(predecessors, "\n  semi-colon: {join(predecessors, "; ")}")}\
   >     {if(successors, "\n  Successors: {successors}")}\
   >     {if(successors, "\n  semi-colon: {join(successors, "; ")}")}\
-  >     {if(obsfate, "\n  Fate: {join(obsfate, "\n  Fate: ")}\n")}\n'
+  >     {if(obsfate, "{obsfate % "\n  Fate: {fate}"}")}\
+  >     {if(obsorigin, "{obsorigin % "\n  Origin: {origin}"}")}\n\n'
   > fatelog = log -G -T '{node|short}\n{if(obsfate, "  Obsfate: {join(obsfate, "; ")}\n\n")}'
   > EOF
 
@@ -85,6 +86,8 @@
   o  d004c8f274b9
   |    Predecessors: 1:471f378eab4c
   |    semi-colon: 1:471f378eab4c
+  |    Origin: rewritten using amend from 2:a468dc9b3633 by test, test2
+  |
   | @  471f378eab4c
   |/     Successors: 3:d004c8f274b9
   |      semi-colon: 3:d004c8f274b9
@@ -169,10 +172,13 @@
   o  d004c8f274b9
   |    Predecessors: 2:a468dc9b3633
   |    semi-colon: 2:a468dc9b3633
+  |    Origin: rewritten using amend from 2:a468dc9b3633 by test, test2
+  |
   | @  a468dc9b3633
   |/     Successors: 3:d004c8f274b9
   |      semi-colon: 3:d004c8f274b9
   |      Fate: reworded using amend as 3:d004c8f274b9 by test2
+  |      Origin: rewritten using amend from 1:471f378eab4c
   |
   o  ea207398892e
   
@@ -182,12 +188,15 @@
   o  d004c8f274b9
   |    Predecessors: 2:a468dc9b3633
   |    semi-colon: 2:a468dc9b3633
+  |    Origin: rewritten using amend from 2:a468dc9b3633 by test, test2
+  |
   | @  a468dc9b3633
   |/     Predecessors: 1:471f378eab4c
   |      semi-colon: 1:471f378eab4c
   |      Successors: 3:d004c8f274b9
   |      semi-colon: 3:d004c8f274b9
   |      Fate: reworded using amend as 3:d004c8f274b9 by test2
+  |      Origin: rewritten using amend from 1:471f378eab4c
   |
   | x  471f378eab4c
   |/     Successors: 2:a468dc9b3633
@@ -208,6 +217,7 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg tlog
   @  d004c8f274b9
+  |    Origin: rewritten using amend from 2:a468dc9b3633 by test, test2
   |
   o  ea207398892e
   
@@ -215,12 +225,15 @@
   @  d004c8f274b9
   |    Predecessors: 2:a468dc9b3633
   |    semi-colon: 2:a468dc9b3633
+  |    Origin: rewritten using amend from 2:a468dc9b3633 by test, test2
+  |
   | x  a468dc9b3633
   |/     Predecessors: 1:471f378eab4c
   |      semi-colon: 1:471f378eab4c
   |      Successors: 3:d004c8f274b9
   |      semi-colon: 3:d004c8f274b9
   |      Fate: reworded using amend as 3:d004c8f274b9 by test2
+  |      Origin: rewritten using amend from 1:471f378eab4c
   |
   | x  471f378eab4c
   |/     Successors: 2:a468dc9b3633
@@ -350,9 +363,13 @@
   o  f257fde29c7a
   |    Predecessors: 1:471597cad322
   |    semi-colon: 1:471597cad322
+  |    Origin: rewritten using split from 1:471597cad322
+  |
   o  337fec4d2edc
   |    Predecessors: 1:471597cad322
   |    semi-colon: 1:471597cad322
+  |    Origin: rewritten using split from 1:471597cad322
+  |
   | @  471597cad322
   |/     Successors: 2:337fec4d2edc 3:f257fde29c7a
   |      semi-colon: 2:337fec4d2edc 3:f257fde29c7a
@@ -378,8 +395,10 @@
 log
   $ hg tlog
   @  f257fde29c7a
+  |    Origin: rewritten using split from 1:471597cad322
   |
   o  337fec4d2edc
+  |    Origin: rewritten using split from 1:471597cad322
   |
   o  ea207398892e
   
@@ -389,9 +408,13 @@
   @  f257fde29c7a
   |    Predecessors: 1:471597cad322
   |    semi-colon: 1:471597cad322
+  |    Origin: rewritten using split from 1:471597cad322
+  |
   o  337fec4d2edc
   |    Predecessors: 1:471597cad322
   |    semi-colon: 1:471597cad322
+  |    Origin: rewritten using split from 1:471597cad322
+  |
   | x  471597cad322
   |/     Successors: 2:337fec4d2edc 3:f257fde29c7a
   |      semi-colon: 2:337fec4d2edc 3:f257fde29c7a
@@ -481,6 +504,8 @@
   o  eb5a0daa2192
   |    Predecessors: 1:471f378eab4c
   |    semi-colon: 1:471f378eab4c
+  |    Origin: folded using fold from 1:471f378eab4c, 2:0dec01379d3b
+  |
   | @  471f378eab4c
   |/     Successors: 3:eb5a0daa2192
   |      semi-colon: 3:eb5a0daa2192
@@ -509,6 +534,8 @@
   o  eb5a0daa2192
   |    Predecessors: 2:0dec01379d3b 1:471f378eab4c
   |    semi-colon: 2:0dec01379d3b; 1:471f378eab4c
+  |    Origin: folded using fold from 1:471f378eab4c, 2:0dec01379d3b
+  |
   | @  0dec01379d3b
   | |    Successors: 3:eb5a0daa2192
   | |    semi-colon: 3:eb5a0daa2192
@@ -540,6 +567,7 @@
 log
   $ hg tlog
   @  eb5a0daa2192
+  |    Origin: folded using fold from 1:471f378eab4c, 2:0dec01379d3b
   |
   o  ea207398892e
   
@@ -549,6 +577,8 @@
   @  eb5a0daa2192
   |    Predecessors: 2:0dec01379d3b 1:471f378eab4c
   |    semi-colon: 2:0dec01379d3b; 1:471f378eab4c
+  |    Origin: folded using fold from 1:471f378eab4c, 2:0dec01379d3b
+  |
   | x  0dec01379d3b
   | |    Successors: 3:eb5a0daa2192
   | |    semi-colon: 3:eb5a0daa2192
@@ -656,9 +686,13 @@
   *  019fadeab383
   |    Predecessors: 1:471f378eab4c
   |    semi-colon: 1:471f378eab4c
+  |    Origin: reworded using amend from 3:65b757b745b9
+  |
   | *  fdf9bde5129a
   |/     Predecessors: 1:471f378eab4c
   |      semi-colon: 1:471f378eab4c
+  |      Origin: reworded using amend from 1:471f378eab4c
+  |
   | @  471f378eab4c
   |/     Successors: 2:fdf9bde5129a; 4:019fadeab383
   |      semi-colon: 2:fdf9bde5129a; 4:019fadeab383
@@ -684,9 +718,11 @@
 log
   $ hg tlog
   *  019fadeab383
+  |    Origin: reworded using amend from 3:65b757b745b9
   |
   | @  fdf9bde5129a
-  |/
+  |/     Origin: reworded using amend from 1:471f378eab4c
+  |
   o  ea207398892e
   
 
@@ -702,16 +738,21 @@
   *  019fadeab383
   |    Predecessors: 3:65b757b745b9
   |    semi-colon: 3:65b757b745b9
+  |    Origin: reworded using amend from 3:65b757b745b9
+  |
   | x  65b757b745b9
   |/     Predecessors: 1:471f378eab4c
   |      semi-colon: 1:471f378eab4c
   |      Successors: 4:019fadeab383
   |      semi-colon: 4:019fadeab383
   |      Fate: reworded using amend as 4:019fadeab383
+  |      Origin: reworded using amend from 1:471f378eab4c
   |
   | @  fdf9bde5129a
   |/     Predecessors: 1:471f378eab4c
   |      semi-colon: 1:471f378eab4c
+  |      Origin: reworded using amend from 1:471f378eab4c
+  |
   | x  471f378eab4c
   |/     Successors: 2:fdf9bde5129a; 3:65b757b745b9
   |      semi-colon: 2:fdf9bde5129a; 3:65b757b745b9
@@ -818,6 +859,8 @@
   o  eb5a0daa2192
   |    Predecessors: 1:471f378eab4c
   |    semi-colon: 1:471f378eab4c
+  |    Origin: folded using amend, fold from 1:471f378eab4c, 3:b7ea6d14e664
+  |
   | @  471f378eab4c
   |/     Successors: 4:eb5a0daa2192
   |      semi-colon: 4:eb5a0daa2192
@@ -843,6 +886,8 @@
   o  eb5a0daa2192
   |    Predecessors: 2:0dec01379d3b 1:471f378eab4c
   |    semi-colon: 2:0dec01379d3b; 1:471f378eab4c
+  |    Origin: folded using amend, fold from 1:471f378eab4c, 3:b7ea6d14e664
+  |
   | @  0dec01379d3b
   | |    Successors: 4:eb5a0daa2192
   | |    semi-colon: 4:eb5a0daa2192
@@ -877,10 +922,13 @@
   o  eb5a0daa2192
   |    Predecessors: 1:471f378eab4c 3:b7ea6d14e664
   |    semi-colon: 1:471f378eab4c; 3:b7ea6d14e664
+  |    Origin: folded using amend, fold from 1:471f378eab4c, 3:b7ea6d14e664
+  |
   | @  b7ea6d14e664
   | |    Successors: 4:eb5a0daa2192
   | |    semi-colon: 4:eb5a0daa2192
   | |    Fate: folded using fold as 4:eb5a0daa2192
+  | |    Origin: reworded using amend from 2:0dec01379d3b
   | |
   | x  471f378eab4c
   |/     Successors: 4:eb5a0daa2192
@@ -905,6 +953,7 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg tlog
   @  eb5a0daa2192
+  |    Origin: folded using amend, fold from 1:471f378eab4c, 3:b7ea6d14e664
   |
   o  ea207398892e
   
@@ -912,12 +961,15 @@
   @  eb5a0daa2192
   |    Predecessors: 1:471f378eab4c 3:b7ea6d14e664
   |    semi-colon: 1:471f378eab4c; 3:b7ea6d14e664
+  |    Origin: folded using amend, fold from 1:471f378eab4c, 3:b7ea6d14e664
+  |
   | x  b7ea6d14e664
   | |    Predecessors: 2:0dec01379d3b
   | |    semi-colon: 2:0dec01379d3b
   | |    Successors: 4:eb5a0daa2192
   | |    semi-colon: 4:eb5a0daa2192
   | |    Fate: folded using fold as 4:eb5a0daa2192
+  | |    Origin: reworded using amend from 2:0dec01379d3b
   | |
   | | x  0dec01379d3b
   | |/     Successors: 3:b7ea6d14e664
@@ -1041,6 +1093,8 @@
   o  7a230b46bf61
   |    Predecessors: 1:471f378eab4c
   |    semi-colon: 1:471f378eab4c
+  |    Origin: reworded using amend from fdf9bde5129a
+  |
   | @  471f378eab4c
   |/     Successors: 2:7a230b46bf61
   |      semi-colon: 2:7a230b46bf61
@@ -1060,6 +1114,7 @@
   0 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg tlog
   @  7a230b46bf61
+  |    Origin: reworded using amend from fdf9bde5129a
   |
   o  ea207398892e
   
@@ -1072,6 +1127,8 @@
   @  7a230b46bf61
   |    Predecessors: 1:471f378eab4c
   |    semi-colon: 1:471f378eab4c
+  |    Origin: reworded using amend from fdf9bde5129a
+  |
   | x  471f378eab4c
   |/     Successors: 2:7a230b46bf61
   |      semi-colon: 2:7a230b46bf61
@@ -1121,6 +1178,7 @@
 
   $ hg tlog
   @  f897c6137566
+  |    Origin: rewritten from 2:0dec01379d3b
   |
   o  ea207398892e
   
@@ -1139,6 +1197,8 @@
   o  f897c6137566
   |    Predecessors: 2:0dec01379d3b
   |    semi-colon: 2:0dec01379d3b
+  |    Origin: rewritten from 2:0dec01379d3b
+  |
   | @  0dec01379d3b
   | |    Predecessors: 1:471f378eab4c
   | |    semi-colon: 1:471f378eab4c
@@ -1146,6 +1206,7 @@
   | |    semi-colon: 3:f897c6137566; 1:471f378eab4c
   | |    Fate: rewritten as 3:f897c6137566
   | |    Fate: rewritten as 1:471f378eab4c
+  | |    Origin: rewritten from 1:471f378eab4c
   | |
   | x  471f378eab4c
   |/     Predecessors: 2:0dec01379d3b
@@ -1153,6 +1214,7 @@
   |      Successors: 2:0dec01379d3b
   |      semi-colon: 2:0dec01379d3b
   |      Fate: rewritten as 2:0dec01379d3b
+  |      Origin: rewritten from 2:0dec01379d3b
   |
   o  ea207398892e
   
@@ -1175,8 +1237,11 @@
   o  f897c6137566
   |    Predecessors: 1:471f378eab4c
   |    semi-colon: 1:471f378eab4c
+  |    Origin: rewritten from 2:0dec01379d3b
+  |
   | @  471f378eab4c
   |/     Fate: pruned
+  |      Origin: rewritten from 2:0dec01379d3b
   |
   o  ea207398892e
   
@@ -1193,6 +1258,7 @@
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg tlog
   o  f897c6137566
+  |    Origin: rewritten from 2:0dec01379d3b
   |
   @  ea207398892e
   
@@ -1205,6 +1271,8 @@
   o  f897c6137566
   |    Predecessors: 2:0dec01379d3b
   |    semi-colon: 2:0dec01379d3b
+  |    Origin: rewritten from 2:0dec01379d3b
+  |
   | x  0dec01379d3b
   | |    Predecessors: 1:471f378eab4c
   | |    semi-colon: 1:471f378eab4c
@@ -1212,6 +1280,7 @@
   | |    semi-colon: 3:f897c6137566; 1:471f378eab4c
   | |    Fate: rewritten as 3:f897c6137566
   | |    Fate: rewritten as 1:471f378eab4c
+  | |    Origin: rewritten from 1:471f378eab4c
   | |
   | x  471f378eab4c
   |/     Predecessors: 2:0dec01379d3b
@@ -1219,6 +1288,7 @@
   |      Successors: 2:0dec01379d3b
   |      semi-colon: 2:0dec01379d3b
   |      Fate: rewritten as 2:0dec01379d3b
+  |      Origin: rewritten from 2:0dec01379d3b
   |
   @  ea207398892e
   
@@ -1392,20 +1462,28 @@
   @  0b997eb7ceee
   |    Predecessors: 6:4a004186e638
   |    semi-colon: 6:4a004186e638
+  |    Origin: rewritten using amend from 6:4a004186e638
+  |
   | *  b18bc8331526
   |/     Predecessors: 6:4a004186e638
   |      semi-colon: 6:4a004186e638
+  |      Origin: rewritten using amend from 6:4a004186e638
+  |
   | *  ba2ed02b0c9a
+  | |    Origin: rewritten from 4:9bd10a0775e4
   | |
   | x  4a004186e638
   |/     Successors: 8:b18bc8331526; 9:0b997eb7ceee
   |      semi-colon: 8:b18bc8331526; 9:0b997eb7ceee
   |      Fate: reworded using amend as 8:b18bc8331526
   |      Fate: reworded using amend as 9:0b997eb7ceee
+  |      Origin: rewritten from 4:9bd10a0775e4
   |
   *  dd800401bd8c
+  |    Origin: rewritten from 4:9bd10a0775e4
   |
   o  f897c6137566
+  |    Origin: rewritten from 2:0dec01379d3b
   |
   o  ea207398892e
   
@@ -1429,12 +1507,18 @@
   @  0b997eb7ceee
   |    Predecessors: 6:4a004186e638
   |    semi-colon: 6:4a004186e638
+  |    Origin: rewritten using amend from 6:4a004186e638
+  |
   | *  b18bc8331526
   |/     Predecessors: 6:4a004186e638
   |      semi-colon: 6:4a004186e638
+  |      Origin: rewritten using amend from 6:4a004186e638
+  |
   | *  ba2ed02b0c9a
   | |    Predecessors: 4:9bd10a0775e4
   | |    semi-colon: 4:9bd10a0775e4
+  | |    Origin: rewritten from 4:9bd10a0775e4
+  | |
   | x  4a004186e638
   |/     Predecessors: 4:9bd10a0775e4
   |      semi-colon: 4:9bd10a0775e4
@@ -1442,10 +1526,13 @@
   |      semi-colon: 8:b18bc8331526; 9:0b997eb7ceee
   |      Fate: reworded using amend as 8:b18bc8331526
   |      Fate: reworded using amend as 9:0b997eb7ceee
+  |      Origin: rewritten from 4:9bd10a0775e4
   |
   *  dd800401bd8c
   |    Predecessors: 4:9bd10a0775e4
   |    semi-colon: 4:9bd10a0775e4
+  |    Origin: rewritten from 4:9bd10a0775e4
+  |
   | x  9bd10a0775e4
   |/     Successors: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
   |      semi-colon: 5:dd800401bd8c 6:4a004186e638 7:ba2ed02b0c9a
@@ -1454,6 +1541,8 @@
   o  f897c6137566
   |    Predecessors: 2:0dec01379d3b
   |    semi-colon: 2:0dec01379d3b
+  |    Origin: rewritten from 2:0dec01379d3b
+  |
   | x  0dec01379d3b
   | |    Predecessors: 1:471f378eab4c
   | |    semi-colon: 1:471f378eab4c
@@ -1461,6 +1550,7 @@
   | |    semi-colon: 3:f897c6137566; 1:471f378eab4c
   | |    Fate: rewritten as 3:f897c6137566
   | |    Fate: rewritten as 1:471f378eab4c
+  | |    Origin: rewritten from 1:471f378eab4c
   | |
   | x  471f378eab4c
   |/     Predecessors: 2:0dec01379d3b
@@ -1468,6 +1558,7 @@
   |      Successors: 2:0dec01379d3b
   |      semi-colon: 2:0dec01379d3b
   |      Fate: rewritten as 2:0dec01379d3b
+  |      Origin: rewritten from 2:0dec01379d3b
   |
   o  ea207398892e
   
@@ -1508,15 +1599,23 @@
   *  eceed8f98ffc
   |    Predecessors: 4:9bd10a0775e4
   |    semi-colon: 4:9bd10a0775e4
+  |    Origin: rewritten using rebase from 7:ba2ed02b0c9a
+  |
   | *  0b997eb7ceee
   | |    Predecessors: 4:9bd10a0775e4
   | |    semi-colon: 4:9bd10a0775e4
+  | |    Origin: rewritten using amend from 6:4a004186e638
+  | |
   * |  b18bc8331526
   |/     Predecessors: 4:9bd10a0775e4
   |      semi-colon: 4:9bd10a0775e4
+  |      Origin: rewritten using amend from 6:4a004186e638
+  |
   *  dd800401bd8c
   |    Predecessors: 4:9bd10a0775e4
   |    semi-colon: 4:9bd10a0775e4
+  |    Origin: rewritten from 4:9bd10a0775e4
+  |
   | @  9bd10a0775e4
   |/     Successors: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc; 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
   |      semi-colon: 5:dd800401bd8c 9:0b997eb7ceee 10:eceed8f98ffc; 5:dd800401bd8c 8:b18bc8331526 10:eceed8f98ffc
@@ -1524,6 +1623,7 @@
   |      Fate: split using amend, rebase as 5:dd800401bd8c, 8:b18bc8331526, 10:eceed8f98ffc
   |
   o  f897c6137566
+  |    Origin: rewritten from 2:0dec01379d3b
   |
   o  ea207398892e