annotate mercurial/helptext/internals/mergestate.txt @ 46139:3ca5ca380a34

filemerge: add support for the new "mergediff" marker style to premerge This adds support for the new "mergediff" conflict marker style to "merge-tools.<tool>.premerge" (the new value is called "keep-mergediff"). Differential Revision: https://phab.mercurial-scm.org/D9606
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 14 Dec 2020 18:09:37 -0800
parents 32ce4cbaec4b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
42450
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
1 The active mergestate is stored in ``.hg/merge`` when a merge is triggered
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
2 by commands like ``hg merge``, ``hg rebase``, etc. until the merge is
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
3 completed or aborted to track the 3-way merge state of individual files.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
4
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
5 The contents of the directory are:
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
6
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
7 Conflicting files
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
8 -----------------
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
9
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
10 The local version of the conflicting files are stored with their
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
11 filenames as the hash of their paths.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
12
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
13 state
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
14 -----
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
15
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
16 This mergestate file record is used by hg version prior to 2.9.1
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
17 and contains less data than ``state2``. If there is no contradiction
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
18 with ``state2``, we can assume that both are written at the same time.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
19 In this case, data from ``state2`` is used. Otherwise, we use ``state``.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
20 We read/write both ``state`` and ``state2`` records to ensure backward
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
21 compatibility.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
22
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
23 state2
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
24 ------
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
25
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
26 This record stores a superset of data in ``state``, including new kinds
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
27 of records in the future.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
28
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
29 Each record can contain arbitrary content and has an associated type. This
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
30 `type` should be a letter. If `type` is uppercase, the record is mandatory:
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
31 versions of Mercurial that don't support it should abort. If `type` is
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
32 lowercase, the record can be safely ignored.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
33
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
34 Currently known records:
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
35
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
36 | * L: the node of the "local" part of the merge (hexified version)
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
37 | * O: the node of the "other" part of the merge (hexified version)
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
38 | * F: a file to be merged entry
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
39 | * C: a change/delete or delete/change conflict
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
40 | * P: a path conflict (file vs directory)
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
41 | * f: a (filename, dictionary) tuple of optional values for a given file
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
42 | * X: unsupported mandatory record type (used in tests)
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
43 | * x: unsupported advisory record type (used in tests)
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
44 | * l: the labels for the parts of the merge.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
45
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
46 Merge record states (indexed by filename):
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
47
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
48 | * u: unresolved conflict
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
49 | * r: resolved conflict
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
50 | * pu: unresolved path conflict (file conflicts with directory)
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
51 | * pr: resolved path conflict
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
52
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
53 The resolve command transitions between 'u' and 'r' for conflicts and
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
54 'pu' and 'pr' for path conflicts.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
55
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
56 This format is a list of arbitrary records of the form:
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
57
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
58 [type][length][content]
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
59
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
60 `type` is a single character, `length` is a 4 byte integer, and
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
61 `content` is an arbitrary byte sequence of length `length`.
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
62
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
63 Mercurial versions prior to 3.7 have a bug where if there are
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
64 unsupported mandatory merge records, attempting to clear out the merge
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
65 state with hg update --clean or similar aborts. The 't' record type
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
66 works around that by writing out what those versions treat as an
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
67 advisory record, but later versions interpret as special: the first
9d31581cc44e help: add help entry for internals.mergestate
Navaneeth Suresh <navaneeths1998@gmail.com>
parents:
diff changeset
68 character is the 'real' record type and everything onwards is the data.