D8120: debugmergestate: make templated

2020-02-27 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGacbfa31cfaf2: debugmergestate: make templated (authored by 
martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8120?vs=20361&id=20364

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8120/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8120

AFFECTED FILES
  mercurial/debugcommands.py
  relnotes/next
  tests/test-backout.t
  tests/test-completion.t
  tests/test-histedit-non-commute-abort.t
  tests/test-merge-changedelete.t
  tests/test-pathconflicts-merge.t
  tests/test-rebase-abort.t
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -306,48 +306,40 @@
 
   $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py 
fakemergerecord -x
   $ hg debugmergestate
-  * version 2 records
-  local: 57653b9f834a4493f7240b0681efcb9ae7cab745
-  other: dc77451844e37f03f5c559e3b8529b2b48d381d1
-  labels:
-local: working copy
-other: merge rev
-  unrecognized entry: xadvisory record
-  file extras: file1 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file1 (record type "F", state "r", hash 
60b27f004e454aca81b0480209cce5081ec52390)
-local path: file1 (flags "")
+  local (working copy): 57653b9f834a4493f7240b0681efcb9ae7cab745
+  other (merge rev): dc77451844e37f03f5c559e3b8529b2b48d381d1
+  file: file1 (state "r")
+local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
 ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
 other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
-  file extras: file2 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file2 (record type "F", state "u", hash 
cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
-local path: file2 (flags "")
+extra: ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac
+  file: file2 (state "u")
+local path: file2 (hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523, flags "")
 ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
 other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
+extra: ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac
   $ hg resolve -l
   R file1
   U file2
 
+test json output
+
+  $ hg debugmergestate -T json
+  [
+   {
+"commits": [{"label": "working copy", "name": "local", "node": 
"57653b9f834a4493f7240b0681efcb9ae7cab745"}, {"label": "merge rev", "name": 
"other", "node": "dc77451844e37f03f5c559e3b8529b2b48d381d1"}],
+"files": [{"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", 
"ancestor_path": "file1", "extras": [{"key": "ancestorlinknode", "value": 
"99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": 
"60b27f004e454aca81b0480209cce5081ec52390", "local_path": "file1", 
"other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": 
"file1", "path": "file1", "state": "r"}, {"ancestor_node": 
"2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": "file2", "extras": 
[{"key": "ancestorlinknode", "value": 
"99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": 
"cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523", "local_path": "file2", 
"other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": 
"file2", "path": "file2", "state": "u"}]
+   }
+  ]
+
+
 insert unsupported mandatory merge record
 
   $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py 
fakemergerecord -X
   $ hg debugmergestate
-  * version 2 records
-  local: 57653b9f834a4493f7240b0681efcb9ae7cab745
-  other: dc77451844e37f03f5c559e3b8529b2b48d381d1
-  labels:
-local: working copy
-other: merge rev
-  file extras: file1 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file1 (record type "F", state "r", hash 
60b27f004e454aca81b0480209cce5081ec52390)
-local path: file1 (flags "")
-ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
-other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
-  file extras: file2 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file2 (record type "F", state "u", hash 
cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
-local path: file2 (flags "")
-ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
-other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
-  unrecognized entry: Xmandatory record
+  abort: unsupported merge state records: X
+  (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
+  [255]
   $ hg resolve -l
   abort: unsupported merge state records: X
   (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort

D8120: debugmergestate: make templated

2020-02-27 Thread martinvonz (Martin von Zweigbergk)
martinvonz updated this revision to Diff 20361.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8120?vs=20214&id=20361

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8120/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8120

AFFECTED FILES
  mercurial/debugcommands.py
  relnotes/next
  tests/test-backout.t
  tests/test-completion.t
  tests/test-histedit-non-commute-abort.t
  tests/test-merge-changedelete.t
  tests/test-pathconflicts-merge.t
  tests/test-rebase-abort.t
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -306,48 +306,40 @@
 
   $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py 
fakemergerecord -x
   $ hg debugmergestate
-  * version 2 records
-  local: 57653b9f834a4493f7240b0681efcb9ae7cab745
-  other: dc77451844e37f03f5c559e3b8529b2b48d381d1
-  labels:
-local: working copy
-other: merge rev
-  unrecognized entry: xadvisory record
-  file extras: file1 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file1 (record type "F", state "r", hash 
60b27f004e454aca81b0480209cce5081ec52390)
-local path: file1 (flags "")
+  local (working copy): 57653b9f834a4493f7240b0681efcb9ae7cab745
+  other (merge rev): dc77451844e37f03f5c559e3b8529b2b48d381d1
+  file: file1 (state "r")
+local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
 ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
 other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
-  file extras: file2 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file2 (record type "F", state "u", hash 
cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
-local path: file2 (flags "")
+extra: ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac
+  file: file2 (state "u")
+local path: file2 (hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523, flags "")
 ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
 other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
+extra: ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac
   $ hg resolve -l
   R file1
   U file2
 
+test json output
+
+  $ hg debugmergestate -T json
+  [
+   {
+"commits": [{"label": "working copy", "name": "local", "node": 
"57653b9f834a4493f7240b0681efcb9ae7cab745"}, {"label": "merge rev", "name": 
"other", "node": "dc77451844e37f03f5c559e3b8529b2b48d381d1"}],
+"files": [{"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", 
"ancestor_path": "file1", "extras": [{"key": "ancestorlinknode", "value": 
"99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": 
"60b27f004e454aca81b0480209cce5081ec52390", "local_path": "file1", 
"other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": 
"file1", "path": "file1", "state": "r"}, {"ancestor_node": 
"2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": "file2", "extras": 
[{"key": "ancestorlinknode", "value": 
"99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": 
"cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523", "local_path": "file2", 
"other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": 
"file2", "path": "file2", "state": "u"}]
+   }
+  ]
+
+
 insert unsupported mandatory merge record
 
   $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py 
fakemergerecord -X
   $ hg debugmergestate
-  * version 2 records
-  local: 57653b9f834a4493f7240b0681efcb9ae7cab745
-  other: dc77451844e37f03f5c559e3b8529b2b48d381d1
-  labels:
-local: working copy
-other: merge rev
-  file extras: file1 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file1 (record type "F", state "r", hash 
60b27f004e454aca81b0480209cce5081ec52390)
-local path: file1 (flags "")
-ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
-other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
-  file extras: file2 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file2 (record type "F", state "u", hash 
cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
-local path: file2 (flags "")
-ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
-other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
-  unrecognized entry: Xmandatory record
+  abort: unsupported merge state records: X
+  (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
+  [255]
   $ hg resolve -l
   abort: unsupported merge state records: X
   (see https://mercurial-scm.org/wiki/MergeStateRecords for more information)
diff --git a/tests/test-rebase-abort.t b/tests/test-rebase-abort.t
--- a/tests/test-rebase-abort.t
+++ b/tests/test-rebase-abort.t
@@ -88,18 +88,13 @@
 
   $ hg --config extensions.fakemergerecord=

D8120: debugmergestate: make templated

2020-02-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a reviewer: durin42.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
martinvonz added a comment.


  This one replaces D8113 .

REVISION SUMMARY
  Our IntelliJ team wants to be able to read the merge state in order to
  help the user resolve merge conflicts. They had so far been reading
  file contents from p1() and p2() and their merge base. That is not
  ideal for several reasons (merge base is not necessarily the "graft
  base", renames are not handled, commands like `hg update -m` is not
  handled). It will get especially bad as of my D7827 
. This patch makes
  the output s a templated. I haven't bothered to make it complete
  (e.g. merge driver states are not handled), but it's probably good
  enough as a start.
  
  I've done a web search for "debugmergestate" and I can't find any
  indication that any tools currently rely on its output. If it turns
  out that we get bug reports for it once this is released, I won't
  object to backing this patch out on the stable branch (and then
  perhaps replace it by a separate command, or put it behind a new
  flag).
  
  The changes in test-backout.t are interesting, in particular this:
  
-other path: foo (node not stored in v1 format)
+other path:  (node foo)
  
  I wonder if that means that we actually read v1 format
  incorrectly. That seems to be an old format that was switched away
  from in 2014, so it doesn't matter now anyway.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D8120

AFFECTED FILES
  mercurial/debugcommands.py
  relnotes/next
  tests/test-backout.t
  tests/test-completion.t
  tests/test-histedit-non-commute-abort.t
  tests/test-merge-changedelete.t
  tests/test-pathconflicts-merge.t
  tests/test-rebase-abort.t
  tests/test-resolve.t

CHANGE DETAILS

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -306,48 +306,40 @@
 
   $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py 
fakemergerecord -x
   $ hg debugmergestate
-  * version 2 records
-  local: 57653b9f834a4493f7240b0681efcb9ae7cab745
-  other: dc77451844e37f03f5c559e3b8529b2b48d381d1
-  labels:
-local: working copy
-other: merge rev
-  unrecognized entry: xadvisory record
-  file extras: file1 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file1 (record type "F", state "r", hash 
60b27f004e454aca81b0480209cce5081ec52390)
-local path: file1 (flags "")
+  local (working copy): 57653b9f834a4493f7240b0681efcb9ae7cab745
+  other (merge rev): dc77451844e37f03f5c559e3b8529b2b48d381d1
+  file: file1 (state "r")
+local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
 ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
 other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
-  file extras: file2 (ancestorlinknode = 
99726c03216e233810a2564cbc0adfe395007eac)
-  file: file2 (record type "F", state "u", hash 
cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523)
-local path: file2 (flags "")
+extra: ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac
+  file: file2 (state "u")
+local path: file2 (hash cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523, flags "")
 ancestor path: file2 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
 other path: file2 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
+extra: ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac
   $ hg resolve -l
   R file1
   U file2
 
+test json output
+
+  $ hg debugmergestate -T json
+  [
+   {
+"commits": [{"label": "working copy", "name": "local", "node": 
"57653b9f834a4493f7240b0681efcb9ae7cab745"}, {"label": "merge rev", "name": 
"other", "node": "dc77451844e37f03f5c559e3b8529b2b48d381d1"}],
+"files": [{"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", 
"ancestor_path": "file1", "extras": [{"key": "ancestorlinknode", "value": 
"99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": 
"60b27f004e454aca81b0480209cce5081ec52390", "local_path": "file1", 
"other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": 
"file1", "path": "file1", "state": "r"}, {"ancestor_node": 
"2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": "file2", "extras": 
[{"key": "ancestorlinknode", "value": 
"99726c03216e233810a2564cbc0adfe395007eac"}], "local_flags": "", "local_key": 
"cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523", "local_path": "file2", 
"other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": 
"file2", "path": "file2", "state": "u"}]
+   }
+  ]
+
+
 insert unsupported mandatory merge record
 
   $ hg --config extensions.fakemergerecord=$TESTDIR/fakemergerecord.py 
fakemergerecord -X
   $ hg debugmergestate
-  * version 2 records
-  local: 57653b9f

D8120: debugmergestate: make templated

2020-02-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  This one replaces D8113 .

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8120/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8120

To: martinvonz, durin42, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel