comparison tests/test-backout.t @ 44396:acbfa31cfaf2

debugmergestate: make templated 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. Differential Revision: https://phab.mercurial-scm.org/D8120
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 13 Feb 2020 21:14:20 -0800
parents 14d0e89520a2
children 693da1b928af
comparison
equal deleted inserted replaced
44395:382f4f09f0bd 44396:acbfa31cfaf2
707 $ hg backout -r 'desc("capital three")' --tool internal:fail 707 $ hg backout -r 'desc("capital three")' --tool internal:fail
708 0 files updated, 0 files merged, 0 files removed, 1 files unresolved 708 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
709 use 'hg resolve' to retry unresolved file merges 709 use 'hg resolve' to retry unresolved file merges
710 [1] 710 [1]
711 $ hg status 711 $ hg status
712 $ hg debugmergestate 712 $ hg debugmergestate -v
713 * version 2 records 713 v1 and v2 states match: using v2
714 local: b71750c4b0fdf719734971e3ef90dbeab5919a2d 714 local: b71750c4b0fdf719734971e3ef90dbeab5919a2d
715 other: a30dd8addae3ce71b8667868478542bc417439e6 715 other: a30dd8addae3ce71b8667868478542bc417439e6
716 file extras: foo (ancestorlinknode = 91360952243723bd5b1138d5f26bd8c8564cb553) 716 file: foo (state "u")
717 file: foo (record type "F", state "u", hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33) 717 local path: foo (hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33, flags "")
718 local path: foo (flags "")
719 ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708) 718 ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708)
720 other path: foo (node f50039b486d6fa1a90ae51778388cad161f425ee) 719 other path: foo (node f50039b486d6fa1a90ae51778388cad161f425ee)
720 extra: ancestorlinknode = 91360952243723bd5b1138d5f26bd8c8564cb553
721 $ mv .hg/merge/state2 .hg/merge/state2-moved 721 $ mv .hg/merge/state2 .hg/merge/state2-moved
722 $ hg debugmergestate 722 $ hg debugmergestate -v
723 * version 1 records 723 no version 2 merge state
724 local: b71750c4b0fdf719734971e3ef90dbeab5919a2d 724 local: b71750c4b0fdf719734971e3ef90dbeab5919a2d
725 file: foo (record type "F", state "u", hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33) 725 other: b71750c4b0fdf719734971e3ef90dbeab5919a2d
726 local path: foo (flags "") 726 file: foo (state "u")
727 local path: foo (hash 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33, flags "")
727 ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708) 728 ancestor path: foo (node f89532f44c247a0e993d63e3a734dd781ab04708)
728 other path: foo (node not stored in v1 format) 729 other path: (node foo)
729 $ mv .hg/merge/state2-moved .hg/merge/state2 730 $ mv .hg/merge/state2-moved .hg/merge/state2
730 $ hg resolve -l # still unresolved 731 $ hg resolve -l # still unresolved
731 U foo 732 U foo
732 $ hg summary 733 $ hg summary
733 parent: 2:b71750c4b0fd tip 734 parent: 2:b71750c4b0fd tip