mercurial/merge.py
changeset 27031 8be0af32e513
parent 27027 a01ecbcfaf84
child 27034 86ede9eda252
equal deleted inserted replaced
27030:cf9ed6d32ccb 27031:8be0af32e513
    14 
    14 
    15 from .i18n import _
    15 from .i18n import _
    16 from .node import (
    16 from .node import (
    17     bin,
    17     bin,
    18     hex,
    18     hex,
       
    19     nullhex,
    19     nullid,
    20     nullid,
    20     nullrev,
    21     nullrev,
    21 )
    22 )
    22 from . import (
    23 from . import (
    23     copies,
    24     copies,
    56     Currently known records:
    57     Currently known records:
    57 
    58 
    58     L: the node of the "local" part of the merge (hexified version)
    59     L: the node of the "local" part of the merge (hexified version)
    59     O: the node of the "other" part of the merge (hexified version)
    60     O: the node of the "other" part of the merge (hexified version)
    60     F: a file to be merged entry
    61     F: a file to be merged entry
       
    62     C: a change/delete or delete/change conflict
    61     D: a file that the external merge driver will merge internally
    63     D: a file that the external merge driver will merge internally
    62        (experimental)
    64        (experimental)
    63     m: the external merge driver defined for this merge plus its run state
    65     m: the external merge driver defined for this merge plus its run state
    64        (experimental)
    66        (experimental)
    65     X: unsupported mandatory record type (used in tests)
    67     X: unsupported mandatory record type (used in tests)
   141                     # the merge driver should be idempotent, so just rerun it
   143                     # the merge driver should be idempotent, so just rerun it
   142                     mdstate = 'u'
   144                     mdstate = 'u'
   143 
   145 
   144                 self._readmergedriver = bits[0]
   146                 self._readmergedriver = bits[0]
   145                 self._mdstate = mdstate
   147                 self._mdstate = mdstate
   146             elif rtype in 'FD':
   148             elif rtype in 'FDC':
   147                 bits = record.split('\0')
   149                 bits = record.split('\0')
   148                 self._state[bits[0]] = bits[1:]
   150                 self._state[bits[0]] = bits[1:]
   149             elif not rtype.islower():
   151             elif not rtype.islower():
   150                 unsupported.add(rtype)
   152                 unsupported.add(rtype)
   151         self._dirty = False
   153         self._dirty = False
   313             records.append(('m', '\0'.join([
   315             records.append(('m', '\0'.join([
   314                 self.mergedriver, self._mdstate])))
   316                 self.mergedriver, self._mdstate])))
   315         for d, v in self._state.iteritems():
   317         for d, v in self._state.iteritems():
   316             if v[0] == 'd':
   318             if v[0] == 'd':
   317                 records.append(('D', '\0'.join([d] + v)))
   319                 records.append(('D', '\0'.join([d] + v)))
       
   320             # v[1] == local ('cd'), v[6] == other ('dc') -- not supported by
       
   321             # older versions of Mercurial
       
   322             elif v[1] == nullhex or v[6] == nullhex:
       
   323                 records.append(('C', '\0'.join([d] + v)))
   318             else:
   324             else:
   319                 records.append(('F', '\0'.join([d] + v)))
   325                 records.append(('F', '\0'.join([d] + v)))
   320         return records
   326         return records
   321 
   327 
   322     def _writerecords(self, records):
   328     def _writerecords(self, records):