comparison mercurial/merge.py @ 34547:81aebcc73beb

merge: add merge action 'p' to record path conflicts during update Add a new merge action to record path conflicts. A status message is printed, and the path conflict is added to the merge state. Differential Revision: https://phab.mercurial-scm.org/D776
author Mark Thomas <mbthomas@fb.com>
date Mon, 02 Oct 2017 14:05:30 -0700
parents 1913162854f2
children b4955650eb57
comparison
equal deleted inserted replaced
34546:e4cf957bf7ce 34547:81aebcc73beb
1241 repo.ui.debug("removing %s\n" % f) 1241 repo.ui.debug("removing %s\n" % f)
1242 wctx[f].audit() 1242 wctx[f].audit()
1243 wctx[f].remove() 1243 wctx[f].remove()
1244 1244
1245 numupdates = sum(len(l) for m, l in actions.items() if m != 'k') 1245 numupdates = sum(len(l) for m, l in actions.items() if m != 'k')
1246 z = 0
1246 1247
1247 if [a for a in actions['r'] if a[0] == '.hgsubstate']: 1248 if [a for a in actions['r'] if a[0] == '.hgsubstate']:
1248 subrepo.submerge(repo, wctx, mctx, wctx, overwrite, labels) 1249 subrepo.submerge(repo, wctx, mctx, wctx, overwrite, labels)
1249 1250
1250 # remove in parallel (must come first) 1251 # record path conflicts
1251 z = 0 1252 for f, args, msg in actions['p']:
1253 f1, fo = args
1254 s = repo.ui.status
1255 s(_("%s: path conflict - a file or link has the same name as a "
1256 "directory\n") % f)
1257 if fo == 'l':
1258 s(_("the local file has been renamed to %s\n") % f1)
1259 else:
1260 s(_("the remote file has been renamed to %s\n") % f1)
1261 s(_("resolve manually then use 'hg resolve --mark %s'\n") % f)
1262 ms.addpath(f, f1, fo)
1263 z += 1
1264 progress(_updating, z, item=f, total=numupdates, unit=_files)
1265
1266 # remove in parallel (must come before getting)
1252 prog = worker.worker(repo.ui, 0.001, batchremove, (repo, wctx), 1267 prog = worker.worker(repo.ui, 0.001, batchremove, (repo, wctx),
1253 actions['r']) 1268 actions['r'])
1254 for i, item in prog: 1269 for i, item in prog:
1255 z += i 1270 z += i
1256 progress(_updating, z, item=item, total=numupdates, unit=_files) 1271 progress(_updating, z, item=item, total=numupdates, unit=_files)
1696 actionbyfile[f] = ('g', (flags, False), "prompt recreating") 1711 actionbyfile[f] = ('g', (flags, False), "prompt recreating")
1697 else: 1712 else:
1698 del actionbyfile[f] 1713 del actionbyfile[f]
1699 1714
1700 # Convert to dictionary-of-lists format 1715 # Convert to dictionary-of-lists format
1701 actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split()) 1716 actions = dict((m, [])
1717 for m in 'a am f g cd dc r dm dg m e k p'.split())
1702 for f, (m, args, msg) in actionbyfile.iteritems(): 1718 for f, (m, args, msg) in actionbyfile.iteritems():
1703 if m not in actions: 1719 if m not in actions:
1704 actions[m] = [] 1720 actions[m] = []
1705 actions[m].append((f, args, msg)) 1721 actions[m].append((f, args, msg))
1706 1722