[PATCH 2 of 2] convert: execute merges in-memory (issue5076)
Tony Tung
ttung at fb.com
Tue Feb 23 08:14:00 UTC 2016
# HG changeset patch
# User Tony Tung <tonytung at merly.org>
# Date 1456215137 28800
# Tue Feb 23 00:12:17 2016 -0800
# Node ID b7f61d7438ba1aed06afa1a53a2b5fda8bdc225f
# Parent cbc605f28b61cc469e21186982d0569bf94f7d2a
convert: execute merges in-memory (issue5076)
Typically during merging two manifests, we detect if a subrepo is dirty
(i.e., the working directory differs from the hgsubstate). If it is, we
mark it in the manifest.
When we are doing repo conversions, we do not change the working
directory. All the changes are happening in-memory, and as such, the
computed substate will always mismatch. This patch adds a flag to the
manifest merge logic to treat wctx as not a directory.
This is an alternate fix. The original proposed fix was sent as
https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-February/079733.html
diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py
--- a/hgext/convert/hg.py
+++ b/hgext/convert/hg.py
@@ -194,6 +194,7 @@
True, # force
False, # acceptremote
False, # followcopies
+ inmemoryonly=True,
)
for file, (action, info, msg) in actions.iteritems():
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -769,13 +769,16 @@
return True
def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher,
- acceptremote, followcopies):
+ acceptremote, followcopies, inmemoryonly):
"""
Merge p1 and p2 with ancestor pa and generate merge action list
branchmerge and force are as passed in to update
matcher = matcher to filter file lists
acceptremote = accept the incoming changes without prompting
+ inmemoryonly = merge is happening in memory only; wctx does not
+ represent an actual working directory. an example
+ of this would be repository conversion (convert extension).
"""
if matcher is not None and matcher.always():
matcher = None
@@ -799,7 +802,7 @@
copied = set(copy.values())
copied.update(movewithdir.values())
- if '.hgsubstate' in m1:
+ if not inmemoryonly and '.hgsubstate' in m1:
# check whether sub state is modified
for s in sorted(wctx.substate):
if wctx.sub(s).dirty():
@@ -931,12 +934,12 @@
def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
acceptremote, followcopies, matcher=None,
- mergeforce=False):
+ mergeforce=False, inmemoryonly=False):
"Calculate the actions needed to merge mctx into wctx using ancestors"
if len(ancestors) == 1: # default
actions, diverge, renamedelete = manifestmerge(
repo, wctx, mctx, ancestors[0], branchmerge, force, matcher,
- acceptremote, followcopies)
+ acceptremote, followcopies, inmemoryonly)
_checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce)
else: # only when merge.preferancestor=* - the default
@@ -951,7 +954,7 @@
repo.ui.note(_('\ncalculating bids for ancestor %s\n') % ancestor)
actions, diverge1, renamedelete1 = manifestmerge(
repo, wctx, mctx, ancestor, branchmerge, force, matcher,
- acceptremote, followcopies)
+ acceptremote, followcopies, inmemoryonly)
_checkunknownfiles(repo, wctx, mctx, force, actions, mergeforce)
# Track the shortest set of warning on the theory that bid
More information about the Mercurial-devel
mailing list