Commits

Kevin Bullock committed f3b21be

filtering: rename filters to their antonyms

Now that changelog filtering is in place, it's become evident that
naming the filters according to the set of revs _not_ included in the
filtered changelog is confusing. This is especially evident in the
collaborative branch cache scheme.

This changes the names of the filters to reflect the revs that _are_
included:

hidden -> visible
unserved -> served
mutable -> immutable
impactable -> base

repoview.filteredrevs is renamed to filterrevs, so that callers read a
bit more sensibly, e.g.:

filterrevs('visible') # filter revs according to what's visible

Comments (0)

Files changed (16)

mercurial/context.py

     def mutable(self):
         return self.phase() > phases.public
     def hidden(self):
-        return self._rev in repoview.filteredrevs(self._repo, 'hidden')
+        return self._rev in repoview.filterrevs(self._repo, 'visible')
 
     def parents(self):
         """return contexts for each parent changeset"""

mercurial/discovery.py

         og.missingheads = onlyheads or repo.heads()
     elif onlyheads is None:
         # use visible heads as it should be cached
-        og.missingheads = repo.filtered("unserved").heads()
+        og.missingheads = repo.filtered("served").heads()
         og.excluded = [ctx.node() for ctx in repo.set('secret() or extinct()')]
     else:
         # compute common, missing and exclude secret stuff
     if not repo:
         raise util.Abort(_("repository '%s' is not local") %
                          (path or peer.url()))
-    return repo.filtered('hidden')
+    return repo.filtered('visible')
 
 def peer(uiorrepo, opts, path, create=False):
     '''return a repository peer for the specified path'''

mercurial/localrepo.py

 
     def __init__(self, repo, caps=MODERNCAPS):
         peer.peerrepository.__init__(self)
-        self._repo = repo.filtered('unserved')
+        self._repo = repo.filtered('served')
         self.ui = repo.ui
         self._caps = repo._restrictcapabilities(caps)
         self.requirements = repo.requirements

mercurial/repoview.py

     Secret and hidden changeset should not pretend to be here."""
     assert not repo.changelog.filteredrevs
     # fast path in simple case to avoid impact of non optimised code
-    hiddens = filteredrevs(repo, 'hidden')
+    hiddens = filterrevs(repo, 'visible')
     if phases.hassecret(repo):
         cl = repo.changelog
         secret = phases.secret
     # fast check to avoid revset call on huge repo
     if util.any(repo._phasecache.phaseroots[1:]):
         getphase = repo._phasecache.phase
-        maymutable = filteredrevs(repo, 'impactable')
+        maymutable = filterrevs(repo, 'base')
         return frozenset(r for r in maymutable if getphase(repo, r))
     return frozenset()
 
     return frozenset(xrange(firstmutable, len(cl)))
 
 # function to compute filtered set
-filtertable = {'hidden': computehidden,
-               'unserved': computeunserved,
-               'mutable':  computemutable,
-               'impactable':  computeimpactable}
+filtertable = {'visible': computehidden,
+               'served': computeunserved,
+               'immutable':  computemutable,
+               'base':  computeimpactable}
 ### Nearest subset relation
 # Nearest subset of filter X is a filter Y so that:
 # * Y is included in X,
 # * X - Y is as small as possible.
 # This create and ordering used for branchmap purpose.
 # the ordering may be partial
-subsettable = {None: 'hidden',
-               'hidden': 'unserved',
-               'unserved': 'mutable',
-               'mutable': 'impactable'}
+subsettable = {None: 'visible',
+               'visible': 'served',
+               'served': 'immutable',
+               'immutable': 'base'}
 
-def filteredrevs(repo, filtername):
+def filterrevs(repo, filtername):
     """returns set of filtered revision for this filter name"""
     if filtername not in repo.filteredrevcache:
         func = filtertable[filtername]
         this changelog must not be used for writing"""
         # some cache may be implemented later
         cl = copy.copy(self._unfilteredrepo.changelog)
-        cl.filteredrevs = filteredrevs(self._unfilteredrepo, self.filtername)
+        cl.filteredrevs = filterrevs(self._unfilteredrepo, self.filtername)
         return cl
 
     def unfiltered(self):

mercurial/revset.py

     """
     # i18n: "hidden" is a keyword
     getargs(x, 0, 0, _("hidden takes no arguments"))
-    hiddenrevs = repoview.filteredrevs(repo, 'hidden')
+    hiddenrevs = repoview.filterrevs(repo, 'visible')
     return [r for r in subset if r in hiddenrevs]
 
 def keyword(repo, subset, x):

mercurial/wireproto.py

         self.message = message
 
 def dispatch(repo, proto, command):
-    repo = repo.filtered("unserved")
+    repo = repo.filtered("served")
     func, spec = commands[command]
     args = proto.getargs(spec)
     return func(repo, proto, *args)
     return opts
 
 def batch(repo, proto, cmds, others):
-    repo = repo.filtered("unserved")
+    repo = repo.filtered("served")
     res = []
     for pair in cmds.split(';'):
         op, args = pair.split(' ', 1)
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   3 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   4 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   4 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   4 changesets found
   list of changesets:
   query 1; heads
   searching for changes
   all remote heads known locally
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   listing keys for "bookmarks"
   4 changesets found
   list of changesets:

tests/test-fncache.t

   .hg/00changelog.i
   .hg/00manifest.i
   .hg/cache
-  .hg/cache/branchheads-unserved
+  .hg/cache/branchheads-served
   .hg/data
   .hg/data/tst.d.hg
   .hg/data/tst.d.hg/foo.i
   .hg
   .hg/00changelog.i
   .hg/cache
-  .hg/cache/branchheads-unserved
+  .hg/cache/branchheads-served
   .hg/dirstate
   .hg/last-message.txt
   .hg/requires

tests/test-hardlinks.t

   $ nlinksdir r4
   2 r4/.hg/00changelog.i
   2 r4/.hg/branch
-  2 r4/.hg/cache/branchheads-unserved
+  2 r4/.hg/cache/branchheads-served
   2 r4/.hg/dirstate
   2 r4/.hg/hgrc
   2 r4/.hg/last-message.txt
   $ nlinksdir r4
   2 r4/.hg/00changelog.i
   1 r4/.hg/branch
-  2 r4/.hg/cache/branchheads-unserved
+  2 r4/.hg/cache/branchheads-served
   1 r4/.hg/dirstate
   2 r4/.hg/hgrc
   2 r4/.hg/last-message.txt

tests/test-inherit-mode.t

   00700 ./.hg/
   00600 ./.hg/00changelog.i
   00770 ./.hg/cache/
-  00660 ./.hg/cache/branchheads-unserved
+  00660 ./.hg/cache/branchheads-served
   00660 ./.hg/dirstate
   00660 ./.hg/last-message.txt
   00600 ./.hg/requires
   00770 ../push/.hg/
   00660 ../push/.hg/00changelog.i
   00770 ../push/.hg/cache/
-  00660 ../push/.hg/cache/branchheads-impactable
+  00660 ../push/.hg/cache/branchheads-base
   00660 ../push/.hg/requires
   00770 ../push/.hg/store/
   00660 ../push/.hg/store/00changelog.i

tests/test-keyword.t

 Commit and show expansion in original and copy
 
   $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   c
    c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
   overwriting c expanding keywords
 | invalid here.
 
   $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   a
   invalid branchheads cache: tip differs
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   overwriting a expanding keywords
   committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
   $ rm log

tests/test-newbranch.t

   repository tip rolled back to revision 4 (undo commit)
   working directory now based on revisions 4 and 3
 
-  $ cp ${branchcache}-unserved .hg/bc-invalid
+  $ cp ${branchcache}-served .hg/bc-invalid
 
   $ hg log -r foo
   changeset:   4:adf1a74a7f7b
   $ listbranchcaches
   === .hg/cache/branchheads ===
   corrupted
-  === .hg/cache/branchheads-unserved ===
+  === .hg/cache/branchheads-served ===
   adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
   c21617b13b220988e7a2e26290fbe4325ffa7139 bar
   1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
   $ hg push -qr 0 ../target
 
   $ (cd ../target/; listbranchcaches)
-  === .hg/cache/branchheads-impactable ===
+  === .hg/cache/branchheads-base ===
   db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0
   db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default
 
   $ hg push -qf ../target
 
   $ (cd ../target/; listbranchcaches)
-  === .hg/cache/branchheads-impactable ===
+  === .hg/cache/branchheads-base ===
   adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
   c21617b13b220988e7a2e26290fbe4325ffa7139 bar
   1c28f494dae69a2f8fc815059d257eccf3fcfe75 default

tests/test-obsolete-divergent.t

   $ newcase direct
   $ hg debugobsolete `getid A_0` `getid A_1`
   $ hg debugobsolete `getid A_0` `getid A_2`
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   $ hg log -G --hidden
   o  3:392fd25390da A_2
   |
   $ newcase indirect_known
   $ hg debugobsolete `getid A_0` `getid A_1`
   $ hg debugobsolete `getid A_0` `getid A_2`
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   $ mkcommit A_3
   created new head
   $ hg debugobsolete `getid A_2` `getid A_3`
   $ newcase indirect_unknown
   $ hg debugobsolete `getid A_0` aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
   $ hg debugobsolete aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa `getid A_1`
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   $ hg debugobsolete `getid A_0` `getid A_2`
   $ hg log -G --hidden
   o  3:392fd25390da A_2
   $ newcase final-unknown
   $ hg debugobsolete `getid A_0` `getid A_1`
   $ hg debugobsolete `getid A_1` `getid A_2`
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   $ hg debugobsolete `getid A_0` bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
   $ hg debugobsolete bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb cccccccccccccccccccccccccccccccccccccccc
   $ hg debugobsolete `getid A_1` dddddddddddddddddddddddddddddddddddddddd
   $ newcase converged_divergence
   $ hg debugobsolete `getid A_0` `getid A_1`
   $ hg debugobsolete `getid A_0` `getid A_2`
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   $ mkcommit A_3
   created new head
   $ hg debugobsolete `getid A_1` `getid A_3`
   $ newcase subset
   $ hg debugobsolete `getid A_0` `getid A_2`
   $ hg debugobsolete `getid A_0` `getid A_1` `getid A_2`
-  invalid branchheads cache (unserved): tip differs
+  invalid branchheads cache (served): tip differs
   $ hg debugsuccessorssets --hidden 'desc('A_0')'
   007dc284c1f8
       82623d38b9ba 392fd25390da

tests/test-phases.t

 check that branch cache with "unserved" filter are properly computed and stored
 
   $ ls ../push-dest/.hg/cache/branchheads*
-  ../push-dest/.hg/cache/branchheads-hidden
-  ../push-dest/.hg/cache/branchheads-unserved
-  $ cat ../push-dest/.hg/cache/branchheads-hidden
+  ../push-dest/.hg/cache/branchheads-served
+  ../push-dest/.hg/cache/branchheads-visible
+  $ cat ../push-dest/.hg/cache/branchheads-visible
   6d6770faffce199f1fddd1cf87f6f026138cf061 6
   b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e default
   2713879da13d6eea1ff22b442a5a87cb31a7ce6a default
   6d6770faffce199f1fddd1cf87f6f026138cf061 default
-  $ cat ../push-dest/.hg/cache/branchheads-unserved
+  $ cat ../push-dest/.hg/cache/branchheads-served
   cf9fe039dfd67e829edf6522a45de057b5c86519 4
   b3325c91a4d916bcc4cdc83ea3fe4ece46a42f6e default
   cf9fe039dfd67e829edf6522a45de057b5c86519 default

tests/test-rebase-collapse.t

   7:c65502d4178782309ce0574c5ae6ee9485a9bafa default
   6:c772a8b2dc17629cec88a19d09c926c4814b12c7 default
 
-  $ cat $TESTTMP/b2/.hg/cache/branchheads-unserved
+  $ cat $TESTTMP/b2/.hg/cache/branchheads-served
   c65502d4178782309ce0574c5ae6ee9485a9bafa 7
   c772a8b2dc17629cec88a19d09c926c4814b12c7 default
   c65502d4178782309ce0574c5ae6ee9485a9bafa default