comparison mercurial/merge.py @ 36009:55e8efa2451a

subrepo: split non-core functions to new module Resolves import cycle caused by subrepo -> cmdutil. Still we have another cycle, cmdutil -> context -> subrepo, but where I think importing context is wrong. Perhaps we'll need repo.makememctx().
author Yuya Nishihara <yuya@tcha.org>
date Tue, 06 Feb 2018 22:36:38 +0900
parents 45b678bf3a78
children 46a54de96a54
comparison
equal deleted inserted replaced
36008:006ff7268c5c 36009:55e8efa2451a
29 filemerge, 29 filemerge,
30 match as matchmod, 30 match as matchmod,
31 obsutil, 31 obsutil,
32 pycompat, 32 pycompat,
33 scmutil, 33 scmutil,
34 subrepo, 34 subrepoutil,
35 util, 35 util,
36 worker, 36 worker,
37 ) 37 )
38 38
39 _pack = struct.pack 39 _pack = struct.pack
1443 1443
1444 numupdates = sum(len(l) for m, l in actions.items() if m != 'k') 1444 numupdates = sum(len(l) for m, l in actions.items() if m != 'k')
1445 z = 0 1445 z = 0
1446 1446
1447 if [a for a in actions['r'] if a[0] == '.hgsubstate']: 1447 if [a for a in actions['r'] if a[0] == '.hgsubstate']:
1448 subrepo.submerge(repo, wctx, mctx, wctx, overwrite, labels) 1448 subrepoutil.submerge(repo, wctx, mctx, wctx, overwrite, labels)
1449 1449
1450 # record path conflicts 1450 # record path conflicts
1451 for f, args, msg in actions['p']: 1451 for f, args, msg in actions['p']:
1452 f1, fo = args 1452 f1, fo = args
1453 s = repo.ui.status 1453 s = repo.ui.status
1493 z += i 1493 z += i
1494 progress(_updating, z, item=item, total=numupdates, unit=_files) 1494 progress(_updating, z, item=item, total=numupdates, unit=_files)
1495 updated = len(actions['g']) 1495 updated = len(actions['g'])
1496 1496
1497 if [a for a in actions['g'] if a[0] == '.hgsubstate']: 1497 if [a for a in actions['g'] if a[0] == '.hgsubstate']:
1498 subrepo.submerge(repo, wctx, mctx, wctx, overwrite, labels) 1498 subrepoutil.submerge(repo, wctx, mctx, wctx, overwrite, labels)
1499 1499
1500 # forget (manifest only, just log it) (must come first) 1500 # forget (manifest only, just log it) (must come first)
1501 for f, args, msg in actions['f']: 1501 for f, args, msg in actions['f']:
1502 repo.ui.debug(" %s: %s -> f\n" % (f, msg)) 1502 repo.ui.debug(" %s: %s -> f\n" % (f, msg))
1503 z += 1 1503 z += 1
1581 for f, args, msg in mergeactions: 1581 for f, args, msg in mergeactions:
1582 repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg)) 1582 repo.ui.debug(" %s: %s -> m (premerge)\n" % (f, msg))
1583 z += 1 1583 z += 1
1584 progress(_updating, z, item=f, total=numupdates, unit=_files) 1584 progress(_updating, z, item=f, total=numupdates, unit=_files)
1585 if f == '.hgsubstate': # subrepo states need updating 1585 if f == '.hgsubstate': # subrepo states need updating
1586 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx), 1586 subrepoutil.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
1587 overwrite, labels) 1587 overwrite, labels)
1588 continue 1588 continue
1589 wctx[f].audit() 1589 wctx[f].audit()
1590 complete, r = ms.preresolve(f, wctx) 1590 complete, r = ms.preresolve(f, wctx)
1591 if not complete: 1591 if not complete:
1592 numupdates += 1 1592 numupdates += 1
1911 hint = _("commit or update --clean to discard changes") 1911 hint = _("commit or update --clean to discard changes")
1912 raise error.Abort(msg, hint=hint) 1912 raise error.Abort(msg, hint=hint)
1913 1913
1914 # Prompt and create actions. Most of this is in the resolve phase 1914 # Prompt and create actions. Most of this is in the resolve phase
1915 # already, but we can't handle .hgsubstate in filemerge or 1915 # already, but we can't handle .hgsubstate in filemerge or
1916 # subrepo.submerge yet so we have to keep prompting for it. 1916 # subrepoutil.submerge yet so we have to keep prompting for it.
1917 if '.hgsubstate' in actionbyfile: 1917 if '.hgsubstate' in actionbyfile:
1918 f = '.hgsubstate' 1918 f = '.hgsubstate'
1919 m, args, msg = actionbyfile[f] 1919 m, args, msg = actionbyfile[f]
1920 prompts = filemerge.partextras(labels) 1920 prompts = filemerge.partextras(labels)
1921 prompts['f'] = f 1921 prompts['f'] = f