mercurial/merge.py
changeset 45383 f970cca30989
parent 45349 442823f66889
child 45384 72e503a24715
equal deleted inserted replaced
45382:0652a533fe3c 45383:f970cca30989
   577                        filename as key and related data as values
   577                        filename as key and related data as values
   578         """
   578         """
   579         self._filemapping = {}
   579         self._filemapping = {}
   580         self._diverge = {}
   580         self._diverge = {}
   581         self._renamedelete = {}
   581         self._renamedelete = {}
   582         self._commitinfo = {}
   582         self._commitinfo = collections.defaultdict(dict)
   583         self._actionmapping = collections.defaultdict(dict)
   583         self._actionmapping = collections.defaultdict(dict)
   584 
   584 
   585     def updatevalues(self, diverge, renamedelete, commitinfo):
   585     def updatevalues(self, diverge, renamedelete, commitinfo):
   586         self._diverge = diverge
   586         self._diverge = diverge
   587         self._renamedelete = renamedelete
   587         self._renamedelete = renamedelete
   754     branch_copies2 = copies.branch_copies()
   754     branch_copies2 = copies.branch_copies()
   755     diverge = {}
   755     diverge = {}
   756     # information from merge which is needed at commit time
   756     # information from merge which is needed at commit time
   757     # for example choosing filelog of which parent to commit
   757     # for example choosing filelog of which parent to commit
   758     # TODO: use specific constants in future for this mapping
   758     # TODO: use specific constants in future for this mapping
   759     commitinfo = {}
   759     commitinfo = collections.defaultdict(dict)
   760     if followcopies:
   760     if followcopies:
   761         branch_copies1, branch_copies2, diverge = copies.mergecopies(
   761         branch_copies1, branch_copies2, diverge = copies.mergecopies(
   762             repo, wctx, p2, pa
   762             repo, wctx, p2, pa
   763         )
   763         )
   764 
   764 
   842                             mergestatemod.ACTION_GET,
   842                             mergestatemod.ACTION_GET,
   843                             (fl2, False),
   843                             (fl2, False),
   844                             b'remote is newer',
   844                             b'remote is newer',
   845                         )
   845                         )
   846                         if branchmerge:
   846                         if branchmerge:
   847                             commitinfo[f] = b'other'
   847                             commitinfo[f][b'filenode-source'] = b'other'
   848                 elif nol and n2 == a:  # remote only changed 'x'
   848                 elif nol and n2 == a:  # remote only changed 'x'
   849                     mresult.addfile(
   849                     mresult.addfile(
   850                         f,
   850                         f,
   851                         mergestatemod.ACTION_EXEC,
   851                         mergestatemod.ACTION_EXEC,
   852                         (fl2,),
   852                         (fl2,),
   858                         mergestatemod.ACTION_GET,
   858                         mergestatemod.ACTION_GET,
   859                         (fl1, False),
   859                         (fl1, False),
   860                         b'remote is newer',
   860                         b'remote is newer',
   861                     )
   861                     )
   862                     if branchmerge:
   862                     if branchmerge:
   863                         commitinfo[f] = b'other'
   863                         commitinfo[f][b'filenode-source'] = b'other'
   864                 else:  # both changed something
   864                 else:  # both changed something
   865                     mresult.addfile(
   865                     mresult.addfile(
   866                         f,
   866                         f,
   867                         mergestatemod.ACTION_MERGE,
   867                         mergestatemod.ACTION_MERGE,
   868                         (f, f, f, False, pa.node()),
   868                         (f, f, f, False, pa.node()),
  1361     )
  1361     )
  1362 
  1362 
  1363     for f, op in pycompat.iteritems(mresult.commitinfo):
  1363     for f, op in pycompat.iteritems(mresult.commitinfo):
  1364         # the other side of filenode was choosen while merging, store this in
  1364         # the other side of filenode was choosen while merging, store this in
  1365         # mergestate so that it can be reused on commit
  1365         # mergestate so that it can be reused on commit
  1366         if op == b'other':
  1366         if op[b'filenode-source'] == b'other':
  1367             ms.addmergedother(f)
  1367             ms.addmergedother(f)
  1368 
  1368 
  1369     moves = []
  1369     moves = []
  1370 
  1370 
  1371     # 'cd' and 'dc' actions are treated like other merge conflicts
  1371     # 'cd' and 'dc' actions are treated like other merge conflicts