changeset 3519:2823c82ad8a4

obslog: add the operation to the Obslog output The operation is helpful when debugging a case where we don't know how we ended up in this case while effect-flag are useful to understand what semantic changes happens to a changeset. Add the operation when displaying an obs-marker in the following form: `rewritten as X using amend` The other proposal is interesting but seems harder to internationalize and might requires update each time we introduce new operation: `Amended as X` Let's use the first proposal right now.
author Boris Feld <boris.feld@octobus.net>
date Sun, 04 Mar 2018 11:34:49 -0500
parents d938808e31bc
children 1f0c88a9dd1c
files hgext3rd/evolve/obshistory.py tests/test-evolve-obshistory.t tests/test-obsolete.t tests/test-topic-stack.t
diffstat 4 files changed, 42 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/obshistory.py	Tue Dec 19 13:15:00 2017 -0600
+++ b/hgext3rd/evolve/obshistory.py	Sun Mar 04 11:34:49 2018 -0500
@@ -471,6 +471,11 @@
         fm.write('succnodes', '%s', nodes,
                  label="evolve.node")
 
+    operation = metadata.get('operation')
+    if operation:
+        fm.plain(' using ')
+        fm.write('operation', '%s', operation, label="evolve.operation")
+
     fm.plain(' by ')
 
     fm.write('user', '%s', metadata['user'],
--- a/tests/test-evolve-obshistory.t	Tue Dec 19 13:15:00 2017 -0600
+++ b/tests/test-evolve-obshistory.t	Sun Mar 04 11:34:49 2018 -0500
@@ -55,7 +55,7 @@
   @  4ae3a4151de9 (2) A1
   |
   x  471f378eab4c (1) A0
-       rewritten(description, content) as 4ae3a4151de9 by test (*) (glob)
+       rewritten(description, content) as 4ae3a4151de9 using amend by test (*) (glob)
          diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -77,7 +77,7 @@
   @  [evolve.node|4ae3a4151de9] [evolve.rev|(2)] [evolve.short_description|A1]
   |
   x  [evolve.node|471f378eab4c] [evolve.rev|(1)] [evolve.short_description|A0]
-       [evolve.verb|rewritten](description, content) as [evolve.node|4ae3a4151de9] by [evolve.user|test] [evolve.date|(Thu Jan 01 00:00:00 1970 +0000)]
+       [evolve.verb|rewritten](description, content) as [evolve.node|4ae3a4151de9] using [evolve.operation|amend] by [evolve.user|test] [evolve.date|(Thu Jan 01 00:00:00 1970 +0000)]
          [diff.diffline|diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description]
          [diff.file_a|--- a/changeset-description]
          [diff.file_b|+++ b/changeset-description]
@@ -99,7 +99,7 @@
   $ hg obslog --no-graph --patch 4ae3a4151de9
   4ae3a4151de9 (2) A1
   471f378eab4c (1) A0
-    rewritten(description, content) as 4ae3a4151de9 by test (Thu Jan 01 00:00:00 1970 +0000)
+    rewritten(description, content) as 4ae3a4151de9 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
       diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
       --- a/changeset-description
       +++ b/changeset-description
@@ -141,6 +141,7 @@
                       "description",
                       "content"
                   ],
+                  "operation": "amend",
                   "succnodes": [
                       "4ae3a4151de9"
                   ],
@@ -155,7 +156,7 @@
   ]
   $ hg obslog --hidden --patch 471f378eab4c
   x  471f378eab4c (1) A0
-       rewritten(description, content) as 4ae3a4151de9 by test (*) (glob)
+       rewritten(description, content) as 4ae3a4151de9 using amend by test (*) (glob)
          diff -r 471f378eab4c -r 4ae3a4151de9 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -186,6 +187,7 @@
                       *, (glob)
                       "content"
                   ],
+                  "operation": "amend",
                   "succnodes": [
                       "4ae3a4151de9"
                   ],
@@ -1093,7 +1095,7 @@
 Check that debugobshistory on the divergent revision show both destinations
   $ hg obslog --hidden 471f378eab4c --patch
   x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 by test (*) (glob)
+       rewritten(description) as 65b757b745b9 using amend by test (*) (glob)
          diff -r 471f378eab4c -r 65b757b745b9 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1101,7 +1103,7 @@
          -A0
          +A2
   
-       rewritten(description) as fdf9bde5129a by test (*) (glob)
+       rewritten(description) as fdf9bde5129a using amend by test (*) (glob)
          diff -r 471f378eab4c -r fdf9bde5129a changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1118,7 +1120,7 @@
   | *  fdf9bde5129a (2) A1
   |/
   x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 by test (*) (glob)
+       rewritten(description) as 65b757b745b9 using amend by test (*) (glob)
          diff -r 471f378eab4c -r 65b757b745b9 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1126,7 +1128,7 @@
          -A0
          +A2
   
-       rewritten(description) as fdf9bde5129a by test (*) (glob)
+       rewritten(description) as fdf9bde5129a using amend by test (*) (glob)
          diff -r 471f378eab4c -r fdf9bde5129a changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1147,6 +1149,7 @@
                   "effect": [
                       "description"
                   ],
+                  "operation": "amend",
                   "succnodes": [
                       "65b757b745b9"
                   ],
@@ -1161,6 +1164,7 @@
                   "effect": [
                       "description"
                   ],
+                  "operation": "amend",
                   "succnodes": [
                       "fdf9bde5129a"
                   ],
@@ -1179,7 +1183,7 @@
   *  fdf9bde5129a (2) A1
   |
   x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 by test (*) (glob)
+       rewritten(description) as 65b757b745b9 using amend by test (*) (glob)
          diff -r 471f378eab4c -r 65b757b745b9 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1187,7 +1191,7 @@
          -A0
          +A2
   
-       rewritten(description) as fdf9bde5129a by test (*) (glob)
+       rewritten(description) as fdf9bde5129a using amend by test (*) (glob)
          diff -r 471f378eab4c -r fdf9bde5129a changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1204,7 +1208,7 @@
   | *  fdf9bde5129a (2) A1
   |/
   x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 by test (*) (glob)
+       rewritten(description) as 65b757b745b9 using amend by test (*) (glob)
          diff -r 471f378eab4c -r 65b757b745b9 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1212,7 +1216,7 @@
          -A0
          +A2
   
-       rewritten(description) as fdf9bde5129a by test (*) (glob)
+       rewritten(description) as fdf9bde5129a using amend by test (*) (glob)
          diff -r 471f378eab4c -r fdf9bde5129a changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1227,7 +1231,7 @@
   @  65b757b745b9 (3) A2
   |
   x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 by test (*) (glob)
+       rewritten(description) as 65b757b745b9 using amend by test (*) (glob)
          diff -r 471f378eab4c -r 65b757b745b9 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1235,7 +1239,7 @@
          -A0
          +A2
   
-       rewritten(description) as fdf9bde5129a by test (*) (glob)
+       rewritten(description) as fdf9bde5129a using amend by test (*) (glob)
          diff -r 471f378eab4c -r fdf9bde5129a changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1251,7 +1255,7 @@
   | *  fdf9bde5129a (2) A1
   |/
   x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 by test (*) (glob)
+       rewritten(description) as 65b757b745b9 using amend by test (*) (glob)
          diff -r 471f378eab4c -r 65b757b745b9 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1259,7 +1263,7 @@
          -A0
          +A2
   
-       rewritten(description) as fdf9bde5129a by test (*) (glob)
+       rewritten(description) as fdf9bde5129a using amend by test (*) (glob)
          diff -r 471f378eab4c -r fdf9bde5129a changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1276,7 +1280,7 @@
   | *  fdf9bde5129a (2) A1
   |/
   x  471f378eab4c (1) A0
-       rewritten(description) as 65b757b745b9 by test (*) (glob)
+       rewritten(description) as 65b757b745b9 using amend by test (*) (glob)
          diff -r 471f378eab4c -r 65b757b745b9 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1284,7 +1288,7 @@
          -A0
          +A2
   
-       rewritten(description) as fdf9bde5129a by test (*) (glob)
+       rewritten(description) as fdf9bde5129a using amend by test (*) (glob)
          diff -r 471f378eab4c -r fdf9bde5129a changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1311,6 +1315,7 @@
                   "effect": [
                       "description"
                   ],
+                  "operation": "amend",
                   "succnodes": [
                       "65b757b745b9"
                   ],
@@ -1325,6 +1330,7 @@
                   "effect": [
                       "description"
                   ],
+                  "operation": "amend",
                   "succnodes": [
                       "fdf9bde5129a"
                   ],
@@ -1453,7 +1459,7 @@
   |      (No patch available, changesets rebased)
   |
   x  0dec01379d3b (2) B0
-       rewritten(description) as b7ea6d14e664 by test (*) (glob)
+       rewritten(description) as b7ea6d14e664 using amend by test (*) (glob)
          diff -r 0dec01379d3b -r b7ea6d14e664 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1487,7 +1493,7 @@
   |      (No patch available, changesets rebased)
   |
   x  0dec01379d3b (2) B0
-       rewritten(description) as b7ea6d14e664 by test (*) (glob)
+       rewritten(description) as b7ea6d14e664 using amend by test (*) (glob)
          diff -r 0dec01379d3b -r b7ea6d14e664 changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1537,6 +1543,7 @@
                   "effect": [
                       "description"
                   ],
+                  "operation": "amend",
                   "succnodes": [
                       "b7ea6d14e664"
                   ],
@@ -1666,7 +1673,7 @@
   @  7a230b46bf61 (3) A2
   |
   x  fdf9bde5129a (2) A1
-  |    rewritten(description) as 7a230b46bf61 by test (*) (glob)
+  |    rewritten(description) as 7a230b46bf61 using amend by test (*) (glob)
   |      diff -r fdf9bde5129a -r 7a230b46bf61 changeset-description
   |      --- a/changeset-description
   |      +++ b/changeset-description
@@ -1676,7 +1683,7 @@
   |
   |
   x  471f378eab4c (1) A0
-       rewritten(description) as fdf9bde5129a by test (*) (glob)
+       rewritten(description) as fdf9bde5129a using amend by test (*) (glob)
          diff -r 471f378eab4c -r fdf9bde5129a changeset-description
          --- a/changeset-description
          +++ b/changeset-description
@@ -1705,21 +1712,21 @@
   o  7a230b46bf61 (2) A2
   |
   x  fdf9bde5129a
-  |    rewritten(description) as 7a230b46bf61 by test (*) (glob)
+  |    rewritten(description) as 7a230b46bf61 using amend by test (*) (glob)
   |      (No patch available, context is not local)
   |
   @  471f378eab4c (1) A0
-       rewritten(description) as fdf9bde5129a by test (*) (glob)
+       rewritten(description) as fdf9bde5129a using amend by test (*) (glob)
          (No patch available, successor is unknown locally)
   
   $ hg obslog 7a230b46bf61 --color=debug --patch
   o  [evolve.node|7a230b46bf61] [evolve.rev|(2)] [evolve.short_description|A2]
   |
   x  [evolve.node evolve.missing_change_ctx|fdf9bde5129a]
-  |    [evolve.verb|rewritten](description) as [evolve.node|7a230b46bf61] by [evolve.user|test] [evolve.date|(*)] (glob)
+  |    [evolve.verb|rewritten](description) as [evolve.node|7a230b46bf61] using [evolve.operation|amend] by [evolve.user|test] [evolve.date|(*)] (glob)
   |      (No patch available, context is not local)
   |
   @  [evolve.node|471f378eab4c] [evolve.rev|(1)] [evolve.short_description|A0]
-       [evolve.verb|rewritten](description) as [evolve.node|fdf9bde5129a] by [evolve.user|test] [evolve.date|(*)] (glob)
+       [evolve.verb|rewritten](description) as [evolve.node|fdf9bde5129a] using [evolve.operation|amend] by [evolve.user|test] [evolve.date|(*)] (glob)
          (No patch available, successor is unknown locally)
   
--- a/tests/test-obsolete.t	Tue Dec 19 13:15:00 2017 -0600
+++ b/tests/test-obsolete.t	Sun Mar 04 11:34:49 2018 -0500
@@ -717,7 +717,7 @@
   [2]
   $ hg olog
   @  0d3f46688ccc (3) add obsol_c
-  |    rewritten(parent) as 2033b4e49474 by test (*) (glob)
+  |    rewritten(parent) as 2033b4e49474 using rebase by test (*) (glob)
   |    rewritten as 725c380fe99b by test (*) (glob)
   |
   x  4538525df7e2 (2) add c
--- a/tests/test-topic-stack.t	Tue Dec 19 13:15:00 2017 -0600
+++ b/tests/test-topic-stack.t	Sun Mar 04 11:34:49 2018 -0500
@@ -870,13 +870,13 @@
   |    rewritten(parent, content) as dde94df880e9, e7ea874afbd5 by test (Thu Jan 01 00:00:00 1970 +0000)
   |
   x  907f7d3c2333 (18) c_G
-  |    rewritten(content) as b24bab30ac12 by test (Thu Jan 01 00:00:00 1970 +0000)
+  |    rewritten(content) as b24bab30ac12 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
   |
   x  3ab2eedae500 (13) c_G
-  |    rewritten(parent) as 907f7d3c2333 by test (Thu Jan 01 00:00:00 1970 +0000)
+  |    rewritten(parent) as 907f7d3c2333 using rebase by test (Thu Jan 01 00:00:00 1970 +0000)
   |
   x  c7d60a180d05 (6) c_G
-       rewritten(user) as 3ab2eedae500 by test (Thu Jan 01 00:00:00 1970 +0000)
+       rewritten(user) as 3ab2eedae500 using amend by test (Thu Jan 01 00:00:00 1970 +0000)
   
   $ hg export .
   # HG changeset patch