changeset 18382:f3b21beb9802

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
author Kevin Bullock <kbullock@ringworld.org>
date Sun, 13 Jan 2013 01:39:16 -0600
parents 7ac4449f0f39
children 6880eae9f861
files mercurial/context.py mercurial/discovery.py mercurial/hg.py mercurial/localrepo.py mercurial/repoview.py mercurial/revset.py mercurial/wireproto.py tests/test-acl.t tests/test-fncache.t tests/test-hardlinks.t tests/test-inherit-mode.t tests/test-keyword.t tests/test-newbranch.t tests/test-obsolete-divergent.t tests/test-phases.t tests/test-rebase-collapse.t
diffstat 16 files changed, 64 insertions(+), 64 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Tue Jan 15 20:55:47 2013 +0100
+++ b/mercurial/context.py	Sun Jan 13 01:39:16 2013 -0600
@@ -212,7 +212,7 @@
     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"""
--- a/mercurial/discovery.py	Tue Jan 15 20:55:47 2013 +0100
+++ b/mercurial/discovery.py	Sun Jan 13 01:39:16 2013 -0600
@@ -115,7 +115,7 @@
         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
--- a/mercurial/hg.py	Tue Jan 15 20:55:47 2013 +0100
+++ b/mercurial/hg.py	Sun Jan 13 01:39:16 2013 -0600
@@ -113,7 +113,7 @@
     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'''
--- a/mercurial/localrepo.py	Tue Jan 15 20:55:47 2013 +0100
+++ b/mercurial/localrepo.py	Sun Jan 13 01:39:16 2013 -0600
@@ -66,7 +66,7 @@
 
     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
--- a/mercurial/repoview.py	Tue Jan 15 20:55:47 2013 +0100
+++ b/mercurial/repoview.py	Sun Jan 13 01:39:16 2013 -0600
@@ -44,7 +44,7 @@
     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
@@ -65,7 +65,7 @@
     # 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()
 
@@ -93,22 +93,22 @@
     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]
@@ -162,7 +162,7 @@
         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):
--- a/mercurial/revset.py	Tue Jan 15 20:55:47 2013 +0100
+++ b/mercurial/revset.py	Sun Jan 13 01:39:16 2013 -0600
@@ -893,7 +893,7 @@
     """
     # 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):
--- a/mercurial/wireproto.py	Tue Jan 15 20:55:47 2013 +0100
+++ b/mercurial/wireproto.py	Sun Jan 13 01:39:16 2013 -0600
@@ -345,7 +345,7 @@
         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)
@@ -362,7 +362,7 @@
     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)
--- a/tests/test-acl.t	Tue Jan 15 20:55:47 2013 +0100
+++ b/tests/test-acl.t	Sun Jan 13 01:39:16 2013 -0600
@@ -140,7 +140,7 @@
   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:
@@ -202,7 +202,7 @@
   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:
@@ -274,7 +274,7 @@
   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:
@@ -341,7 +341,7 @@
   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:
@@ -413,7 +413,7 @@
   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:
@@ -482,7 +482,7 @@
   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:
@@ -556,7 +556,7 @@
   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:
@@ -627,7 +627,7 @@
   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:
@@ -700,7 +700,7 @@
   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:
@@ -779,7 +779,7 @@
   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:
@@ -859,7 +859,7 @@
   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:
@@ -934,7 +934,7 @@
   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:
@@ -1020,7 +1020,7 @@
   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:
@@ -1100,7 +1100,7 @@
   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:
@@ -1176,7 +1176,7 @@
   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:
@@ -1252,7 +1252,7 @@
   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:
@@ -1329,7 +1329,7 @@
   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:
@@ -1527,7 +1527,7 @@
   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:
@@ -1839,7 +1839,7 @@
   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:
@@ -1927,7 +1927,7 @@
   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:
@@ -2083,7 +2083,7 @@
   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:
--- a/tests/test-fncache.t	Tue Jan 15 20:55:47 2013 +0100
+++ b/tests/test-fncache.t	Sun Jan 13 01:39:16 2013 -0600
@@ -70,7 +70,7 @@
   .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
@@ -98,7 +98,7 @@
   .hg
   .hg/00changelog.i
   .hg/cache
-  .hg/cache/branchheads-unserved
+  .hg/cache/branchheads-served
   .hg/dirstate
   .hg/last-message.txt
   .hg/requires
--- a/tests/test-hardlinks.t	Tue Jan 15 20:55:47 2013 +0100
+++ b/tests/test-hardlinks.t	Sun Jan 13 01:39:16 2013 -0600
@@ -196,7 +196,7 @@
   $ 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
@@ -226,7 +226,7 @@
   $ 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
--- a/tests/test-inherit-mode.t	Tue Jan 15 20:55:47 2013 +0100
+++ b/tests/test-inherit-mode.t	Sun Jan 13 01:39:16 2013 -0600
@@ -66,7 +66,7 @@
   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
@@ -111,7 +111,7 @@
   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
--- a/tests/test-keyword.t	Tue Jan 15 20:55:47 2013 +0100
+++ b/tests/test-keyword.t	Sun Jan 13 01:39:16 2013 -0600
@@ -576,7 +576,7 @@
 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
@@ -760,10 +760,10 @@
 | 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
--- a/tests/test-newbranch.t	Tue Jan 15 20:55:47 2013 +0100
+++ b/tests/test-newbranch.t	Sun Jan 13 01:39:16 2013 -0600
@@ -122,7 +122,7 @@
   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
@@ -160,7 +160,7 @@
   $ listbranchcaches
   === .hg/cache/branchheads ===
   corrupted
-  === .hg/cache/branchheads-unserved ===
+  === .hg/cache/branchheads-served ===
   adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
   c21617b13b220988e7a2e26290fbe4325ffa7139 bar
   1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
@@ -175,7 +175,7 @@
   $ hg push -qr 0 ../target
 
   $ (cd ../target/; listbranchcaches)
-  === .hg/cache/branchheads-impactable ===
+  === .hg/cache/branchheads-base ===
   db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0
   db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default
 
@@ -184,7 +184,7 @@
   $ hg push -qf ../target
 
   $ (cd ../target/; listbranchcaches)
-  === .hg/cache/branchheads-impactable ===
+  === .hg/cache/branchheads-base ===
   adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4
   c21617b13b220988e7a2e26290fbe4325ffa7139 bar
   1c28f494dae69a2f8fc815059d257eccf3fcfe75 default
--- a/tests/test-obsolete-divergent.t	Tue Jan 15 20:55:47 2013 +0100
+++ b/tests/test-obsolete-divergent.t	Sun Jan 13 01:39:16 2013 -0600
@@ -62,7 +62,7 @@
   $ 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
   |
@@ -104,7 +104,7 @@
   $ 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`
@@ -143,7 +143,7 @@
   $ 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
@@ -175,7 +175,7 @@
   $ 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
@@ -192,7 +192,7 @@
   $ 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`
@@ -439,7 +439,7 @@
   $ 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
--- a/tests/test-phases.t	Tue Jan 15 20:55:47 2013 +0100
+++ b/tests/test-phases.t	Sun Jan 13 01:39:16 2013 -0600
@@ -176,14 +176,14 @@
 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
--- a/tests/test-rebase-collapse.t	Tue Jan 15 20:55:47 2013 +0100
+++ b/tests/test-rebase-collapse.t	Sun Jan 13 01:39:16 2013 -0600
@@ -274,7 +274,7 @@
   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