mercurial/merge.py
changeset 45349 442823f66889
parent 45348 490607efc992
child 45383 f970cca30989
equal deleted inserted replaced
45348:490607efc992 45349:442823f66889
  1337             or self.unresolvedcount
  1337             or self.unresolvedcount
  1338         )
  1338         )
  1339 
  1339 
  1340 
  1340 
  1341 def applyupdates(
  1341 def applyupdates(
  1342     repo,
  1342     repo, mresult, wctx, mctx, overwrite, wantfiledata, labels=None,
  1343     mresult,
       
  1344     wctx,
       
  1345     mctx,
       
  1346     overwrite,
       
  1347     wantfiledata,
       
  1348     labels=None,
       
  1349     commitinfo=None,
       
  1350 ):
  1343 ):
  1351     """apply the merge action list to the working directory
  1344     """apply the merge action list to the working directory
  1352 
  1345 
  1353     mresult is a mergeresult object representing result of the merge
  1346     mresult is a mergeresult object representing result of the merge
  1354     wctx is the working copy context
  1347     wctx is the working copy context
  1355     mctx is the context to be merged into the working copy
  1348     mctx is the context to be merged into the working copy
  1356     commitinfo is a mapping of information which needs to be stored somewhere
       
  1357                (probably mergestate) so that it can be used at commit time.
       
  1358 
  1349 
  1359     Return a tuple of (counts, filedata), where counts is a tuple
  1350     Return a tuple of (counts, filedata), where counts is a tuple
  1360     (updated, merged, removed, unresolved) that describes how many
  1351     (updated, merged, removed, unresolved) that describes how many
  1361     files were affected by the update, and filedata is as described in
  1352     files were affected by the update, and filedata is as described in
  1362     batchget.
  1353     batchget.
  1367     updated, merged, removed = 0, 0, 0
  1358     updated, merged, removed = 0, 0, 0
  1368     ms = mergestatemod.mergestate.clean(
  1359     ms = mergestatemod.mergestate.clean(
  1369         repo, wctx.p1().node(), mctx.node(), labels
  1360         repo, wctx.p1().node(), mctx.node(), labels
  1370     )
  1361     )
  1371 
  1362 
  1372     if commitinfo is None:
  1363     for f, op in pycompat.iteritems(mresult.commitinfo):
  1373         commitinfo = {}
       
  1374 
       
  1375     for f, op in pycompat.iteritems(commitinfo):
       
  1376         # 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
  1377         # mergestate so that it can be reused on commit
  1365         # mergestate so that it can be reused on commit
  1378         if op == b'other':
  1366         if op == b'other':
  1379             ms.addmergedother(f)
  1367             ms.addmergedother(f)
  1380 
  1368 
  2049             repo, mresult.len((mergestatemod.ACTION_GET,)), p1.node()
  2037             repo, mresult.len((mergestatemod.ACTION_GET,)), p1.node()
  2050         )
  2038         )
  2051 
  2039 
  2052         wantfiledata = updatedirstate and not branchmerge
  2040         wantfiledata = updatedirstate and not branchmerge
  2053         stats, getfiledata = applyupdates(
  2041         stats, getfiledata = applyupdates(
  2054             repo,
  2042             repo, mresult, wc, p2, overwrite, wantfiledata, labels=labels,
  2055             mresult,
       
  2056             wc,
       
  2057             p2,
       
  2058             overwrite,
       
  2059             wantfiledata,
       
  2060             labels=labels,
       
  2061             commitinfo=mresult.commitinfo,
       
  2062         )
  2043         )
  2063 
  2044 
  2064         if updatedirstate:
  2045         if updatedirstate:
  2065             with repo.dirstate.parentchange():
  2046             with repo.dirstate.parentchange():
  2066                 repo.setparents(fp1, fp2)
  2047                 repo.setparents(fp1, fp2)