changeset 24479:871485bd03fd

revert: move calculation of targetsubs earlier
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Mar 2015 13:48:51 -0500
parents 95cbc77c0cad
children 3df7fc75afc5
files mercurial/cmdutil.py tests/test-subrepo-missing.t
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cmdutil.py	Wed Mar 25 15:53:30 2015 -0700
+++ b/mercurial/cmdutil.py	Fri Mar 27 13:48:51 2015 -0500
@@ -2811,6 +2811,10 @@
         interactive = opts.get('interactive', False)
         wctx = repo[None]
         m = scmutil.match(wctx, pats, opts)
+
+        # we'll need this later
+        targetsubs = sorted(s for s in wctx.substate if m(s))
+
         if not m.always():
             m.bad = lambda x, y: False
             for abs in repo.walk(m):
@@ -3048,10 +3052,6 @@
             _revertprefetch(repo, ctx, *[actions[name][0] for name in needdata])
             _performrevert(repo, parents, ctx, actions, interactive)
 
-        # get the list of subrepos that must be reverted
-        subrepomatch = scmutil.match(wctx, pats, opts)
-        targetsubs = sorted(s for s in wctx.substate if subrepomatch(s))
-
         if targetsubs:
             # Revert the subrepos on the revert list
             for sub in targetsubs:
--- a/tests/test-subrepo-missing.t	Wed Mar 25 15:53:30 2015 -0700
+++ b/tests/test-subrepo-missing.t	Fri Mar 27 13:48:51 2015 -0500
@@ -34,6 +34,7 @@
   $ hg revert .hgsub
   warning: subrepo spec file .hgsub not found
   warning: subrepo spec file .hgsub not found
+  warning: subrepo spec file .hgsub not found
 
 delete .hgsubstate and revert it