If set to false, parts of the merge might be performed in memory.
Largefiles isn't a good candidate for in-memory merge (it uses a custom
dirstate, matcher, and the files might not fit in memory) so have it always
run an old-style merge.
hg-reviewers |
If set to false, parts of the merge might be performed in memory.
Largefiles isn't a good candidate for in-memory merge (it uses a custom
dirstate, matcher, and the files might not fit in memory) so have it always
run an old-style merge.
Lint Skipped |
Unit Tests Skipped |
lfutil.updatestandin(repo, lfile, fstandin) | lfutil.updatestandin(repo, lfile, fstandin) | ||||
# mark all clean largefiles as dirty, just in case the update gets | # mark all clean largefiles as dirty, just in case the update gets | ||||
# interrupted before largefiles and lfdirstate are synchronized | # interrupted before largefiles and lfdirstate are synchronized | ||||
for lfile in oldclean: | for lfile in oldclean: | ||||
lfdirstate.normallookup(lfile) | lfdirstate.normallookup(lfile) | ||||
lfdirstate.write() | lfdirstate.write() | ||||
oldstandins = lfutil.getstandinsstate(repo) | oldstandins = lfutil.getstandinsstate(repo) | ||||
# largefiles is not a good candidate for in-memory merge (large files, | |||||
# custom dirstate, matcher usage) so always force an on-disk merge. | |||||
kwargs["ondisk"] = True | |||||
result = orig(repo, node, branchmerge, force, *args, **kwargs) | result = orig(repo, node, branchmerge, force, *args, **kwargs) | ||||
newstandins = lfutil.getstandinsstate(repo) | newstandins = lfutil.getstandinsstate(repo) | ||||
filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) | filelist = lfutil.getlfilestoupdate(oldstandins, newstandins) | ||||
# to avoid leaving all largefiles as dirty and thus rehash them, mark | # to avoid leaving all largefiles as dirty and thus rehash them, mark | ||||
# all the ones that didn't change as clean | # all the ones that didn't change as clean | ||||
for lfile in oldclean.difference(filelist): | for lfile in oldclean.difference(filelist): |
if branchmerge: | if branchmerge: | ||||
repo.dirstate.add(f) | repo.dirstate.add(f) | ||||
repo.dirstate.copy(f0, f) | repo.dirstate.copy(f0, f) | ||||
else: | else: | ||||
repo.dirstate.normal(f) | repo.dirstate.normal(f) | ||||
def update(repo, node, branchmerge, force, ancestor=None, | def update(repo, node, branchmerge, force, ancestor=None, | ||||
mergeancestor=False, labels=None, matcher=None, mergeforce=False, | mergeancestor=False, labels=None, matcher=None, mergeforce=False, | ||||
updatecheck=None): | updatecheck=None, ondisk=True): | ||||
""" | """ | ||||
Perform a merge between the working directory and the given node | Perform a merge between the working directory and the given node | ||||
node = the node to update to | node = the node to update to | ||||
branchmerge = whether to merge between branches | branchmerge = whether to merge between branches | ||||
force = whether to force branch merging or file overwriting | force = whether to force branch merging or file overwriting | ||||
matcher = a matcher to filter file lists (dirstate not updated) | matcher = a matcher to filter file lists (dirstate not updated) | ||||
mergeancestor = whether it is merging with an ancestor. If true, | mergeancestor = whether it is merging with an ancestor. If true, | ||||
x = can't happen | x = can't happen | ||||
* = don't-care | * = don't-care | ||||
1 = incompatible options (checked in commands.py) | 1 = incompatible options (checked in commands.py) | ||||
2 = abort: uncommitted changes (commit or update --clean to discard changes) | 2 = abort: uncommitted changes (commit or update --clean to discard changes) | ||||
3 = abort: uncommitted changes (checked in commands.py) | 3 = abort: uncommitted changes (checked in commands.py) | ||||
Return the same tuple as applyupdates(). | Return the same tuple as applyupdates(). | ||||
This function might run parts of the merge in memory if ``ondisk=False``. | |||||
""" | """ | ||||
# Avoid cycle. | # Avoid cycle. | ||||
from . import sparse | from . import sparse | ||||
# This function used to find the default destination if node was None, but | # This function used to find the default destination if node was None, but | ||||
# that's now in destutil.py. | # that's now in destutil.py. | ||||
assert node is not None | assert node is not None | ||||
if not branchmerge and not force: | if not branchmerge and not force: |