Patchwork D1184: fsmonitor: use nonnormalset from dirstatemap

login
register
mail settings
Submitter phabricator
Date Oct. 18, 2017, 10:42 p.m.
Message ID <differential-rev-PHID-DREV-e2e5nnoread57rwqipkk-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/25222/
State Superseded
Headers show

Comments

phabricator - Oct. 18, 2017, 10:42 p.m.
quark created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  `dirstate._nonnormalset` has been moved to `dirstate._map.nonnormalset` by
  https://phab.mercurial-scm.org/rHG60927b19ed65c8ec58ec36afc515976b5d17d78a (dirstate: move nonnormal and otherparent sets to dirstatemap)
  and is guaranteed to be existed.
  
  Let's update fsmonitor code to use the new `nonnormalset`.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/fsmonitor/__init__.py

CHANGE DETAILS




To: quark, #hg-reviewers
Cc: mercurial-devel
phabricator - Oct. 18, 2017, 10:54 p.m.
wez added inline comments.

INLINE COMMENTS

> __init__.py:416
>                           if f not in results and matchfn(f))
> -    else:
> -        if matchalways:

ah, I think we do need to keep this code path for the fresh instance case, otherwise we won't know how to resync with the world

REPOSITORY
  rHG Mercurial

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

To: quark, #hg-reviewers
Cc: wez, mercurial-devel
phabricator - Oct. 18, 2017, 10:55 p.m.
quark added inline comments.

INLINE COMMENTS

> wez wrote in __init__.py:416
> ah, I think we do need to keep this code path for the fresh instance case, otherwise we won't know how to resync with the world

Ah, sorry. Will update.

REPOSITORY
  rHG Mercurial

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

To: quark, #hg-reviewers
Cc: wez, mercurial-devel
phabricator - Oct. 18, 2017, 10:55 p.m.
wez added inline comments.

INLINE COMMENTS

> __init__.py:420
> -                         if (f not in results and
> -                             (st[2] < 0 or st[0] != 'n' or fresh_instance)))
> -            visit.update(f for f in copymap if f not in results)

... so we should probably restore this logic, but can perhaps optimize some of these elements in here because we now know that `fresh_instance` will always be true in this path

REPOSITORY
  rHG Mercurial

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

To: quark, #hg-reviewers
Cc: wez, mercurial-devel
phabricator - Oct. 19, 2017, 12:42 a.m.
wez accepted this revision.
wez added a comment.


  lgtm

REPOSITORY
  rHG Mercurial

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

To: quark, #hg-reviewers, wez
Cc: wez, mercurial-devel

Patch

diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py
--- a/hgext/fsmonitor/__init__.py
+++ b/hgext/fsmonitor/__init__.py
@@ -274,7 +274,7 @@ 
     matchfn = match.matchfn
     matchalways = match.always()
     dmap = self._map._map
-    nonnormalset = getattr(self, '_nonnormalset', None)
+    nonnormalset = self._map.nonnormalset
 
     copymap = self._map.copymap
     getkind = stat.S_IFMT
@@ -404,28 +404,15 @@ 
     visit = set((f for f in notefiles if (f not in results and matchfn(f)
                                           and (f in dmap or not ignore(f)))))
 
-    if nonnormalset is not None and not fresh_instance:
+    if not fresh_instance:
         if matchalways:
             visit.update(f for f in nonnormalset if f not in results)
             visit.update(f for f in copymap if f not in results)
         else:
             visit.update(f for f in nonnormalset
                          if f not in results and matchfn(f))
             visit.update(f for f in copymap
                          if f not in results and matchfn(f))
-    else:
-        if matchalways:
-            visit.update(f for f, st in dmap.iteritems()
-                         if (f not in results and
-                             (st[2] < 0 or st[0] != 'n' or fresh_instance)))
-            visit.update(f for f in copymap if f not in results)
-        else:
-            visit.update(f for f, st in dmap.iteritems()
-                         if (f not in results and
-                             (st[2] < 0 or st[0] != 'n' or fresh_instance)
-                             and matchfn(f)))
-            visit.update(f for f in copymap
-                         if f not in results and matchfn(f))
 
     audit = pathutil.pathauditor(self._root, cached=True).check
     auditpass = [f for f in visit if audit(f)]