comparison mercurial/cmdutil.py @ 22551:8d707da26f9b

revert: move targetsubs calculation down to its use A future patch will be reorganizing this section of the code into two paths, and targetsubs complicates this by existing in the middle of one path, but not the other. We fix that by moving it 200 lines down, to the only place it's used.
author Durham Goode <durham@fb.com>
date Fri, 19 Sep 2014 18:40:39 -0700
parents 5e16fe6fdd32
children f528bfb25b45
comparison
equal deleted inserted replaced
22550:85ade05dc5b3 22551:8d707da26f9b
2501 m.bad = badfn 2501 m.bad = badfn
2502 for abs in ctx.walk(m): 2502 for abs in ctx.walk(m):
2503 if abs not in names: 2503 if abs not in names:
2504 names[abs] = m.rel(abs), m.exact(abs) 2504 names[abs] = m.rel(abs), m.exact(abs)
2505 2505
2506 # get the list of subrepos that must be reverted
2507 targetsubs = sorted(s for s in ctx.substate if m(s))
2508
2509 # Find status of all file in `names`. 2506 # Find status of all file in `names`.
2510 m = scmutil.matchfiles(repo, names) 2507 m = scmutil.matchfiles(repo, names)
2511 2508
2512 changes = repo.status(node1=node, match=m, 2509 changes = repo.status(node1=node, match=m,
2513 unknown=True, ignored=True, clean=True) 2510 unknown=True, ignored=True, clean=True)
2690 2687
2691 2688
2692 if not opts.get('dry_run'): 2689 if not opts.get('dry_run'):
2693 _performrevert(repo, parents, ctx, actions) 2690 _performrevert(repo, parents, ctx, actions)
2694 2691
2692 # get the list of subrepos that must be reverted
2693 subrepomatch = scmutil.match(ctx, pats, opts)
2694 targetsubs = sorted(s for s in ctx.substate if subrepomatch(s))
2695
2695 if targetsubs: 2696 if targetsubs:
2696 # Revert the subrepos on the revert list 2697 # Revert the subrepos on the revert list
2697 for sub in targetsubs: 2698 for sub in targetsubs:
2698 ctx.sub(sub).revert(ui, ctx.substate[sub], *pats, **opts) 2699 ctx.sub(sub).revert(ui, ctx.substate[sub], *pats, **opts)
2699 finally: 2700 finally: