Mercurial > public > mercurial-scm > hg
comparison mercurial/merge.py @ 45276:cb6a72dc0511
merge: pass commitinfo to applyupdates() and get it stored in mergestate
This patch passes the commitinfo calulcated in manifestmerge() to applyupdates()
so that it can be read there and stored in mergestate. On commit, we can read
mergestate for such information and act accordingly.
This patch also makes ACTION_GET_OTHER_AND_STORE not required anymore. Next
patch will remove the messy code surrounding it.
Differential Revision: https://phab.mercurial-scm.org/D8743
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Tue, 14 Jul 2020 16:31:52 +0530 |
parents | 8e8d513941b4 |
children | c515c54f6530 |
comparison
equal
deleted
inserted
replaced
45275:8e8d513941b4 | 45276:cb6a72dc0511 |
---|---|
1239 ) | 1239 ) |
1240 } | 1240 } |
1241 | 1241 |
1242 | 1242 |
1243 def applyupdates( | 1243 def applyupdates( |
1244 repo, actions, wctx, mctx, overwrite, wantfiledata, labels=None | 1244 repo, |
1245 actions, | |
1246 wctx, | |
1247 mctx, | |
1248 overwrite, | |
1249 wantfiledata, | |
1250 labels=None, | |
1251 commitinfo=None, | |
1245 ): | 1252 ): |
1246 """apply the merge action list to the working directory | 1253 """apply the merge action list to the working directory |
1247 | 1254 |
1248 wctx is the working copy context | 1255 wctx is the working copy context |
1249 mctx is the context to be merged into the working copy | 1256 mctx is the context to be merged into the working copy |
1257 commitinfo is a mapping of information which needs to be stored somewhere | |
1258 (probably mergestate) so that it can be used at commit time. | |
1250 | 1259 |
1251 Return a tuple of (counts, filedata), where counts is a tuple | 1260 Return a tuple of (counts, filedata), where counts is a tuple |
1252 (updated, merged, removed, unresolved) that describes how many | 1261 (updated, merged, removed, unresolved) that describes how many |
1253 files were affected by the update, and filedata is as described in | 1262 files were affected by the update, and filedata is as described in |
1254 batchget. | 1263 batchget. |
1258 | 1267 |
1259 updated, merged, removed = 0, 0, 0 | 1268 updated, merged, removed = 0, 0, 0 |
1260 ms = mergestatemod.mergestate.clean( | 1269 ms = mergestatemod.mergestate.clean( |
1261 repo, wctx.p1().node(), mctx.node(), labels | 1270 repo, wctx.p1().node(), mctx.node(), labels |
1262 ) | 1271 ) |
1272 | |
1273 if commitinfo is None: | |
1274 commitinfo = {} | |
1275 | |
1276 for f, op in pycompat.iteritems(commitinfo): | |
1277 # the other side of filenode was choosen while merging, store this in | |
1278 # mergestate so that it can be reused on commit | |
1279 if op == b'other': | |
1280 ms.addmergedother(f) | |
1263 | 1281 |
1264 # add ACTION_GET_OTHER_AND_STORE to mergestate | 1282 # add ACTION_GET_OTHER_AND_STORE to mergestate |
1265 for e in actions[mergestatemod.ACTION_GET_OTHER_AND_STORE]: | 1283 for e in actions[mergestatemod.ACTION_GET_OTHER_AND_STORE]: |
1266 ms.addmergedother(e[0]) | 1284 ms.addmergedother(e[0]) |
1267 | 1285 |
1933 repo, len(actions[mergestatemod.ACTION_GET]), p1.node() | 1951 repo, len(actions[mergestatemod.ACTION_GET]), p1.node() |
1934 ) | 1952 ) |
1935 | 1953 |
1936 wantfiledata = updatedirstate and not branchmerge | 1954 wantfiledata = updatedirstate and not branchmerge |
1937 stats, getfiledata = applyupdates( | 1955 stats, getfiledata = applyupdates( |
1938 repo, actions, wc, p2, overwrite, wantfiledata, labels=labels | 1956 repo, |
1957 actions, | |
1958 wc, | |
1959 p2, | |
1960 overwrite, | |
1961 wantfiledata, | |
1962 labels=labels, | |
1963 commitinfo=mresult.commitinfo, | |
1939 ) | 1964 ) |
1940 | 1965 |
1941 if updatedirstate: | 1966 if updatedirstate: |
1942 with repo.dirstate.parentchange(): | 1967 with repo.dirstate.parentchange(): |
1943 repo.setparents(fp1, fp2) | 1968 repo.setparents(fp1, fp2) |