Patchwork D8942: debugmergestate: don't next `extras` under `files`

login
register
mail settings
Submitter phabricator
Date Aug. 24, 2020, 2:16 p.m.
Message ID <differential-rev-PHID-DREV-qeqibhzs3ukcnd4qrns4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47042/
State Superseded
Headers show

Comments

phabricator - Aug. 24, 2020, 2:16 p.m.
pulkit created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  With recent changes and future changes, we will like to store extras information
  about files which were merged automatically. Hence, we will have merge extras
  for a file which is not in the mergestate.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS




To: pulkit, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -312,12 +312,12 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node 2ed2a3912a0b24502043eae84ee4b279c18b90dd)
     other path: file1 (node 6f4310b00b9a147241b071a60c28a650827fb03d)
-    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
+  extra: file1 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
+  extra: file2 (ancestorlinknode = 99726c03216e233810a2564cbc0adfe395007eac)
   $ hg resolve -l
   R file1
   U file2
@@ -328,7 +328,8 @@ 
   [
    {
     "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"}]
+    "extras": [{"file": "file1", "key": "ancestorlinknode", "value": "99726c03216e233810a2564cbc0adfe395007eac"}, {"file": "file2", "key": "ancestorlinknode", "value": "99726c03216e233810a2564cbc0adfe395007eac"}],
+    "files": [{"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": "file1", "local_flags": "", "local_key": "60b27f004e454aca81b0480209cce5081ec52390", "local_path": "file1", "other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": "file1", "path": "file1", "state": "r"}, {"ancestor_node": "2ed2a3912a0b24502043eae84ee4b279c18b90dd", "ancestor_path": "file2", "local_flags": "", "local_key": "cb99b709a1978bd205ab9dfd4c5aaa1fc91c7523", "local_path": "file2", "other_node": "6f4310b00b9a147241b071a60c28a650827fb03d", "other_path": "file2", "path": "file2", "state": "u"}]
    }
   ]
 
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
@@ -94,7 +94,7 @@ 
     local path: common (hash 94c8c21d08740f5da9eaa38d1f175c592692f0d1, flags "")
     ancestor path: common (node de0a666fdd9c1a0b0698b90d85064d8bd34f74b6)
     other path: common (node 2f6411de53677f6f1048fef5bf888d67a342e0a5)
-    extra: ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c
+  extra: common (ancestorlinknode = 3163e20567cc93074fbb7a53c8b93312e59dbf2c)
   $ hg resolve -l
   U common
 
diff --git a/tests/test-merge-changedelete.t b/tests/test-merge-changedelete.t
--- a/tests/test-merge-changedelete.t
+++ b/tests/test-merge-changedelete.t
@@ -82,17 +82,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "u")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -147,17 +147,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "r")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "u")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -225,17 +225,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "r")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "u")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   *** file1 does not exist
   --- file2 ---
   2
@@ -287,17 +287,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "u")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   *** file1 does not exist
   --- file2 ---
   2
@@ -336,17 +336,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "r")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "r")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -381,17 +381,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "r")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "r")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   *** file1 does not exist
   --- file2 ---
   2
@@ -427,17 +427,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "u")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -484,17 +484,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "u")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -543,17 +543,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "u")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -599,17 +599,17 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file3 (state "u")
     local path: file3 (hash d5b0a58bc47161b1b8a831084b366f757c4f0b11, flags "")
     ancestor path: file3 (node 2661d26c649684b482d10f91960cc3db683c38b4)
     other path: file3 (node a2644c43e210356772c7772a8674544a62e06beb)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file3 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -768,12 +768,12 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -807,12 +807,12 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "r")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -844,12 +844,12 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "r")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   *** file1 does not exist
   --- file2 ---
   2
@@ -883,12 +883,12 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -930,12 +930,12 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
@@ -978,12 +978,12 @@ 
     local path: file1 (hash 60b27f004e454aca81b0480209cce5081ec52390, flags "")
     ancestor path: file1 (node b8e02f6433738021a065f94175c7cd23db5f05be)
     other path: file1 (node 0000000000000000000000000000000000000000)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
   file: file2 (state "u")
     local path: file2 (hash 0000000000000000000000000000000000000000, flags "")
     ancestor path: file2 (node 5d9299349fc01ddd25d0070d149b124d8f10411e)
     other path: file2 (node e7c1328648519852e723de86c0c0525acd779257)
-    extra: ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff
+  extra: file1 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
+  extra: file2 (ancestorlinknode = ab57bf49aa276a22d35a473592d4c34b5abc3eff)
   --- file1 ---
   1
   changed
diff --git a/tests/test-histedit-non-commute-abort.t b/tests/test-histedit-non-commute-abort.t
--- a/tests/test-histedit-non-commute-abort.t
+++ b/tests/test-histedit-non-commute-abort.t
@@ -83,7 +83,7 @@ 
     local path: e (hash 58e6b3a414a1e090dfc6029add0f3555ccba127f, flags "")
     ancestor path: e (node 0000000000000000000000000000000000000000)
     other path: e (node 6b67ccefd5ce6de77e7ead4f5292843a0255329f)
-    extra: ancestorlinknode = 0000000000000000000000000000000000000000
+  extra: e (ancestorlinknode = 0000000000000000000000000000000000000000)
   $ hg resolve -l
   U e
 
diff --git a/tests/test-backout.t b/tests/test-backout.t
--- a/tests/test-backout.t
+++ b/tests/test-backout.t
@@ -717,7 +717,7 @@ 
     local path: foo (hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33, flags "")
     ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708)
     other path: foo (node f50039b486d6fa1a90ae51778388cad161f425ee)
-    extra: ancestorlinknode = 91360952243723bd5b1138d5f26bd8c8564cb553
+  extra: foo (ancestorlinknode = 91360952243723bd5b1138d5f26bd8c8564cb553)
   $ mv .hg/merge/state2 .hg/merge/state2-moved
   $ hg debugmergestate -v
   no version 2 merge state
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2014,8 +2014,8 @@ 
             b'  rename side: {rename_side}\n'
             b'  renamed path: {renamed_path}\n'
             b'")}'
-            b'{extras % "  extra: {key} = {value}\n"}'
             b'"}'
+            b'{extras % "extra: {file} ({key} = {value})\n"}'
         )
 
     ms = mergestatemod.mergestate.read(repo)
@@ -2060,15 +2060,18 @@ 
             ):
                 fm_files.data(renamed_path=state[1])
                 fm_files.data(rename_side=state[2])
-            fm_extras = fm_files.nested(b'extras')
-            for k, v in ms.extras(f).items():
-                fm_extras.startitem()
-                fm_extras.data(key=k)
-                fm_extras.data(value=v)
-            fm_extras.end()
 
     fm_files.end()
 
+    fm_extras = fm.nested(b'extras')
+    for f, d in sorted(ms._stateextras.iteritems()):
+        for k, v in d.iteritems():
+            fm_extras.startitem()
+            fm_extras.data(file=f)
+            fm_extras.data(key=k)
+            fm_extras.data(value=v)
+    fm_extras.end()
+
     fm.end()