obslog: make {descdiff} not be indented and leave that to the template
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 15 Nov 2019 10:25:46 -0800
changeset 4953 5c41bb482867
parent 4952 b135591bec1a
child 4955 e5d92ac69a9c
obslog: make {descdiff} not be indented and leave that to the template Same idea as the previous patch and same explanation for changes to the test case.
hgext3rd/evolve/obshistory.py
tests/test-evolve-obshistory-amend.t
--- a/hgext3rd/evolve/obshistory.py	Fri Nov 15 09:53:42 2019 -0800
+++ b/hgext3rd/evolve/obshistory.py	Fri Nov 15 10:25:46 2019 -0800
@@ -161,7 +161,7 @@
 TEMPLATE_NOTE = b"""{if(note, "\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", "%(operation)s", "%(user)s", "%(date)s")}%(note)s{descdiff}{indent("%(patch)s", "    ")}\n"}
+{markers %% "  {separate(" ", "%(rewrite)s", "%(operation)s", "%(user)s", "%(date)s")}%(note)s{indent(descdiff, "    ")}{indent("%(patch)s", "    ")}\n"}
 """) % {
     b"firstline": TEMPLATE_FIRST_LINE,
     b"rewrite": TEMPLATE_REWRITE,
@@ -623,8 +623,6 @@
 
                 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())
 
--- a/tests/test-evolve-obshistory-amend.t	Fri Nov 15 09:53:42 2019 -0800
+++ b/tests/test-evolve-obshistory-amend.t	Fri Nov 15 10:25:46 2019 -0800
@@ -381,40 +381,40 @@
   x  4f1685185907 A2
   |  description diff:
   |  ```
-  |      [diff.diffline|diff -r 4f1685185907 -r 92210308515b changeset-description]
-  |      [diff.file_a|--- a/changeset-description]
-  |      [diff.file_b|+++ b/changeset-description]
-  |      [diff.hunk|@@ -1,3 +1,3 @@]
-  |      [diff.deleted|-A2]
-  |      [diff.inserted|+A3]
+  |  [diff.diffline|diff -r 4f1685185907 -r 92210308515b changeset-description]
+  |  [diff.file_a|--- a/changeset-description]
+  |  [diff.file_b|+++ b/changeset-description]
+  |  [diff.hunk|@@ -1,3 +1,3 @@]
+  |  [diff.deleted|-A2]
+  |  [diff.inserted|+A3]
   |
-  |      [diff.deleted|-Better better commit message]
-  |      [diff.inserted|+Better better better commit message]
+  |  [diff.deleted|-Better better commit message]
+  |  [diff.inserted|+Better better better commit message]
   |  ```
   x  4ae3a4151de9 A1
   |  description diff:
   |  ```
-  |      [diff.diffline|diff -r 4ae3a4151de9 -r 4f1685185907 changeset-description]
-  |      [diff.file_a|--- a/changeset-description]
-  |      [diff.file_b|+++ b/changeset-description]
-  |      [diff.hunk|@@ -1,3 +1,3 @@]
-  |      [diff.deleted|-A1]
-  |      [diff.inserted|+A2]
+  |  [diff.diffline|diff -r 4ae3a4151de9 -r 4f1685185907 changeset-description]
+  |  [diff.file_a|--- a/changeset-description]
+  |  [diff.file_b|+++ b/changeset-description]
+  |  [diff.hunk|@@ -1,3 +1,3 @@]
+  |  [diff.deleted|-A1]
+  |  [diff.inserted|+A2]
   |
-  |      [diff.deleted|-Better commit message]
-  |      [diff.inserted|+Better better commit message]
+  |  [diff.deleted|-Better commit message]
+  |  [diff.inserted|+Better better commit message]
   |  ```
   x  471f378eab4c A0
      description diff:
      ```
-         [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description]
-         [diff.file_a|--- a/changeset-description]
-         [diff.file_b|+++ b/changeset-description]
-         [diff.hunk|@@ -1,1 +1,3 @@]
-         [diff.deleted|-A0]
-         [diff.inserted|+A1]
-         [diff.inserted|+]
-         [diff.inserted|+Better commit message]
+     [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description]
+     [diff.file_a|--- a/changeset-description]
+     [diff.file_b|+++ b/changeset-description]
+     [diff.hunk|@@ -1,1 +1,3 @@]
+     [diff.deleted|-A0]
+     [diff.inserted|+A1]
+     [diff.inserted|+]
+     [diff.inserted|+Better commit message]
      ```
 
 Check the output on the server