[Updated] D8742: merge: introduce 'commitinfo' in mergeresult
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Sun Aug 2 17:43:32 UTC 2020
Closed by commit rHG8e8d513941b4: merge: introduce 'commitinfo' in mergeresult (authored by pulkit).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8742?vs=22097&id=22196
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8742/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8742
AFFECTED FILES
hgext/convert/hg.py
mercurial/merge.py
CHANGE DETAILS
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -546,18 +546,21 @@
It has information about what actions need to be performed on dirstate
mapping of divergent renames and other such cases. '''
- def __init__(self, actions, diverge, renamedelete):
+ def __init__(self, actions, diverge, renamedelete, commitinfo):
"""
actions: dict of filename as keys and action related info as values
diverge: mapping of source name -> list of dest name for
divergent renames
renamedelete: mapping of source name -> list of destinations for files
deleted on one side and renamed on other.
+ commitinfo: dict containing data which should be used on commit
+ contains a filename -> info mapping
"""
self._actions = actions
self._diverge = diverge
self._renamedelete = renamedelete
+ self._commitinfo = commitinfo
@property
def actions(self):
@@ -571,6 +574,10 @@
def renamedelete(self):
return self._renamedelete
+ @property
+ def commitinfo(self):
+ return self._commitinfo
+
def setactions(self, actions):
self._actions = actions
@@ -608,6 +615,10 @@
branch_copies1 = copies.branch_copies()
branch_copies2 = copies.branch_copies()
diverge = {}
+ # information from merge which is needed at commit time
+ # for example choosing filelog of which parent to commit
+ # TODO: use specific constants in future for this mapping
+ commitinfo = {}
if followcopies:
branch_copies1, branch_copies2, diverge = copies.mergecopies(
repo, wctx, p2, pa
@@ -701,6 +712,8 @@
(fl2, False),
b'remote is newer',
)
+ if branchmerge:
+ commitinfo[f] = b'other'
elif nol and n2 == a: # remote only changed 'x'
actions[f] = (
mergestatemod.ACTION_EXEC,
@@ -715,6 +728,8 @@
(fl1, False),
b'remote is newer',
)
+ if branchmerge:
+ commitinfo[f] = b'other'
else: # both changed something
actions[f] = (
mergestatemod.ACTION_MERGE,
@@ -875,7 +890,7 @@
renamedelete = branch_copies1.renamedelete
renamedelete.update(branch_copies2.renamedelete)
- return mergeresult(actions, diverge, renamedelete)
+ return mergeresult(actions, diverge, renamedelete, commitinfo)
def _resolvetrivial(repo, wctx, mctx, ancestor, actions):
@@ -1034,7 +1049,8 @@
actions[f] = l[0]
continue
repo.ui.note(_(b'end of auction\n\n'))
- mresult = mergeresult(actions, diverge, renamedelete)
+ # TODO: think about commitinfo when bid merge is used
+ mresult = mergeresult(actions, diverge, renamedelete, {})
if wctx.rev() is None:
fractions = _forgetremoved(wctx, mctx, branchmerge)
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -217,6 +217,7 @@
"""
anc = [p1ctx.ancestor(p2ctx)]
# Calculate what files are coming from p2
+ # TODO: mresult.commitinfo might be able to get that info
mresult = mergemod.calculateupdates(
self.repo,
p1ctx,
To: pulkit, #hg-reviewers, indygreg
Cc: marmoute, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200802/cacd7d28/attachment-0002.html>
More information about the Mercurial-patches
mailing list