Changeset View
Changeset View
Standalone View
Standalone View
mercurial/merge.py
Show First 20 Lines • Show All 908 Lines • ▼ Show 20 Line(s) | def checkpathconflicts(repo, wctx, mctx, actions): | ||||
# conflicts if they still contain any files after the merge. | # conflicts if they still contain any files after the merge. | ||||
remoteconflicts = set() | remoteconflicts = set() | ||||
# The set of directories that appear as both a file and a directory in the | # The set of directories that appear as both a file and a directory in the | ||||
# remote manifest. These indicate an invalid remote manifest, which | # remote manifest. These indicate an invalid remote manifest, which | ||||
# can't be updated to cleanly. | # can't be updated to cleanly. | ||||
invalidconflicts = set() | invalidconflicts = set() | ||||
# The set of directories that contain files that are being created. | |||||
createdfiledirs = set() | |||||
# The set of files deleted by all the actions. | # The set of files deleted by all the actions. | ||||
deletedfiles = set() | deletedfiles = set() | ||||
for f, (m, args, msg) in actions.items(): | for f, (m, args, msg) in actions.items(): | ||||
if m in ('c', 'dc', 'm', 'cm'): | if m in ('c', 'dc', 'm', 'cm'): | ||||
# This action may create a new local file. | # This action may create a new local file. | ||||
createdfiledirs.update(util.finddirs(f)) | |||||
if mf.hasdir(f): | if mf.hasdir(f): | ||||
# The file aliases a local directory. This might be ok if all | # The file aliases a local directory. This might be ok if all | ||||
# the files in the local directory are being deleted. This | # the files in the local directory are being deleted. This | ||||
# will be checked once we know what all the deleted files are. | # will be checked once we know what all the deleted files are. | ||||
remoteconflicts.add(f) | remoteconflicts.add(f) | ||||
for p in util.finddirs(f): | # Track the names of all deleted files. | ||||
if m == 'r': | |||||
deletedfiles.add(f) | |||||
if m == 'm': | |||||
f1, f2, fa, move, anc = args | |||||
if move: | |||||
deletedfiles.add(f1) | |||||
if m == 'dm': | |||||
f2, flags = args | |||||
deletedfiles.add(f2) | |||||
# Check all directories that contain created files for path conflicts. | |||||
for p in createdfiledirs: | |||||
if p in mf: | if p in mf: | ||||
if p in mctx: | if p in mctx: | ||||
# The file is in a directory which aliases both a local | # A file is in a directory which aliases both a local | ||||
# and a remote file. This is an internal inconsistency | # and a remote file. This is an internal inconsistency | ||||
# within the remote manifest. | # within the remote manifest. | ||||
invalidconflicts.add(p) | invalidconflicts.add(p) | ||||
else: | else: | ||||
# The file is in a directory which aliases a local file. | # A file is in a directory which aliases a local file. | ||||
# We will need to rename the local file. | # We will need to rename the local file. | ||||
localconflicts.add(p) | localconflicts.add(p) | ||||
if p in actions and actions[p][0] in ('c', 'dc', 'm', 'cm'): | if p in actions and actions[p][0] in ('c', 'dc', 'm', 'cm'): | ||||
# The file is in a directory which aliases a remote file. | # The file is in a directory which aliases a remote file. | ||||
# This is an internal inconsistency within the remote | # This is an internal inconsistency within the remote | ||||
# manifest. | # manifest. | ||||
invalidconflicts.add(p) | invalidconflicts.add(p) | ||||
# Track the names of all deleted files. | |||||
if m == 'r': | |||||
deletedfiles.add(f) | |||||
if m == 'm': | |||||
f1, f2, fa, move, anc = args | |||||
if move: | |||||
deletedfiles.add(f1) | |||||
if m == 'dm': | |||||
f2, flags = args | |||||
deletedfiles.add(f2) | |||||
# Rename all local conflicting files that have not been deleted. | # Rename all local conflicting files that have not been deleted. | ||||
for p in localconflicts: | for p in localconflicts: | ||||
if p not in deletedfiles: | if p not in deletedfiles: | ||||
ctxname = str(wctx).rstrip('+') | ctxname = str(wctx).rstrip('+') | ||||
pnew = util.safename(p, ctxname, wctx, set(actions.keys())) | pnew = util.safename(p, ctxname, wctx, set(actions.keys())) | ||||
actions[pnew] = ('pr', (p,), "local path conflict") | actions[pnew] = ('pr', (p,), "local path conflict") | ||||
actions[p] = ('p', (pnew, 'l'), "path conflict") | actions[p] = ('p', (pnew, 'l'), "path conflict") | ||||
▲ Show 20 Lines • Show All 1095 Lines • Show Last 20 Lines |