Patchwork D7439: dirstate: include explicit matches in match.traversedir calls

login
register
mail settings
Submitter phabricator
Date Nov. 16, 2019, 12:35 a.m.
Message ID <differential-rev-PHID-DREV-etseqc2oxvohtmqbqrde-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43292/
State Superseded
Headers show

Comments

phabricator - Nov. 16, 2019, 12:35 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The caller should not have to register to get both explicit and
  non-explicit matches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7439

AFFECTED FILES
  mercurial/dirstate.py
  mercurial/merge.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Nov. 18, 2019, 9:27 a.m.
Alphare added inline comments.

INLINE COMMENTS

> dirstate.py:942
>          results, work, dirsnotfound = self._walkexplicit(match, subrepos)
> +        if matchtdir:
> +            for d in work:

Where is `matchtdir` defined? I don't see it on any of the patches in the stack.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7439/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7439

To: martinvonz, #hg-reviewers
Cc: Alphare, mercurial-devel
phabricator - Nov. 18, 2019, 1:58 p.m.
martinvonz added inline comments.
martinvonz marked an inline comment as done.

INLINE COMMENTS

> Alphare wrote in dirstate.py:942
> Where is `matchtdir` defined? I don't see it on any of the patches in the stack.

It's on line 916 in this file.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7439/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7439

To: martinvonz, #hg-reviewers
Cc: Alphare, mercurial-devel
phabricator - Nov. 18, 2019, 1:59 p.m.
Alphare added inline comments.
Alphare accepted this revision.

INLINE COMMENTS

> martinvonz wrote in dirstate.py:942
> It's on line 916 in this file.

Indeed. Don't know what happened. Thanks

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7439/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7439

To: martinvonz, #hg-reviewers, Alphare
Cc: Alphare, mercurial-devel

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2676,7 +2676,6 @@ 
 
     # There's no API to copy a matcher. So mutate the passed matcher and
     # restore it when we're done.
-    oldexplicitdir = matcher.explicitdir
     oldtraversedir = matcher.traversedir
 
     res = []
@@ -2684,7 +2683,7 @@ 
     try:
         if removeemptydirs:
             directories = []
-            matcher.explicitdir = matcher.traversedir = directories.append
+            matcher.traversedir = directories.append
 
         status = repo.status(match=matcher, ignored=ignored, unknown=True)
 
@@ -2706,5 +2705,4 @@ 
         return res
 
     finally:
-        matcher.explicitdir = oldexplicitdir
         matcher.traversedir = oldtraversedir
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -939,6 +939,11 @@ 
 
         # step 1: find all explicit files
         results, work, dirsnotfound = self._walkexplicit(match, subrepos)
+        if matchtdir:
+            for d in work:
+                matchtdir(d[0])
+            for d in dirsnotfound:
+                matchtdir(d)
 
         skipstep3 = skipstep3 and not (work or dirsnotfound)
         work = [d for d in work if not dirignore(d[0])]