diff tests/test-evolve-obshistory-amend.t @ 4946:bd992b1d4426

obslog: make content and description patches available to templater The code was repeatedly calling fm.write() with the same field ("patch" and "descdiff"). I think that led to the value constantly getting replaced, so when it was used in a template (as {patch} or {descdiff}), it would only get the last value, which was always an empty string. This patch fixes it by writing the full patch to a temporary buffer and then assigning the whole patch to the formatter field.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 07 Nov 2019 16:34:01 -0800
parents bd50608f54d8
children 069cfc5301fb
line wrap: on
line diff
--- a/tests/test-evolve-obshistory-amend.t	Thu Nov 07 17:22:44 2019 -0800
+++ b/tests/test-evolve-obshistory-amend.t	Thu Nov 07 16:34:01 2019 -0800
@@ -112,14 +112,20 @@
       
 
 Test that content diff works with templating
-BROKEN: should show content diff
   $ hg obslog --color=debug --patch 4ae3a4151de9 \
   > -T '{node} {desc|firstline}\n{markers % "patch:\n```{patch}```\n"}'
   @  4ae3a4151de9 A1
   |
   x  471f378eab4c A0
      patch:
-     ``````
+     ```
+         [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 A0]
+         [diff.file_a|--- a/A0	Thu Jan 01 00:00:00 1970 +0000]
+         [diff.file_b|+++ b/A0	Thu Jan 01 00:00:00 1970 +0000]
+         [diff.hunk|@@ -1,1 +1,2 @@]
+          A0
+         [diff.inserted|+42]
+         ```
 
   $ hg obslog 4ae3a4151de9 --graph -T'{label("log.summary", desc|firstline)} {if(markers, join(markers % "at {date|hgdate} by {user|person} ", " also "))}'
   @  A1
@@ -362,20 +368,48 @@
   
   
 Test that description diff works with templating
-BROKEN: should show description diff
   $ hg obslog --color=debug --patch 92210308515b \
   > -T '{node} {desc|firstline}\n{markers % "description diff:\n```{descdiff}```\n"}'
   @  92210308515b A3
   |
-  x  4f1685185907
+  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.deleted|-Better better commit message]
+  |      [diff.inserted|+Better better better commit message]
+  |  ```
   x  4ae3a4151de9 A1
   |  description diff:
-  |  ``````
-  x  471f378eab4c
+  |  ```
+  |      [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]
+  |  ```
+  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]
+     ```
 
 Check the output on the server
 ------------------------------