changeset 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 85ade05dc5b3
children bb14cca8c4e4
files mercurial/cmdutil.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Tue Sep 23 14:20:08 2014 -0400
+++ b/mercurial/cmdutil.py	Fri Sep 19 18:40:39 2014 -0700
@@ -2503,9 +2503,6 @@
             if abs not in names:
                 names[abs] = m.rel(abs), m.exact(abs)
 
-        # get the list of subrepos that must be reverted
-        targetsubs = sorted(s for s in ctx.substate if m(s))
-
         # Find status of all file in `names`.
         m = scmutil.matchfiles(repo, names)
 
@@ -2692,6 +2689,10 @@
         if not opts.get('dry_run'):
             _performrevert(repo, parents, ctx, actions)
 
+            # get the list of subrepos that must be reverted
+            subrepomatch = scmutil.match(ctx, pats, opts)
+            targetsubs = sorted(s for s in ctx.substate if subrepomatch(s))
+
             if targetsubs:
                 # Revert the subrepos on the revert list
                 for sub in targetsubs: