mercurial/helptext/internals/mergestate.txt
author Martin von Zweigbergk <martinvonz@google.com>
Thu, 17 Sep 2020 22:34:36 -0700
changeset 45526 32ce4cbaec4b
parent 43676 2e017696181f
permissions -rw-r--r--
mergedriver: delete it The merge driver code was added in late 2015. I think '406a654b::6f045b56 & user("sid0")' is a reasonable revset for finding the relevant commits, including preparation for it. The code is very poorly tested, which makes it very hard to maintain. It seems it's only used by FB and they don't use this code base anymore, so let's remove the code to make it easier for us to maintain our product. Differential Revision: https://phab.mercurial-scm.org/D9041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42466
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.