changeset 5932:fe25ec8f0124 stable

topic: use "served" repo filter to guess what the server will publish
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 24 May 2021 15:14:30 +0800
parents 6357551cb66f
children c979af037915
files hgext3rd/topic/flow.py tests/test-topic-flow-publish-bare.t
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/flow.py	Mon May 24 14:26:42 2021 +0800
+++ b/hgext3rd/topic/flow.py	Mon May 24 15:14:30 2021 +0800
@@ -152,6 +152,11 @@
         published = repo.filtered(b'served').revs(b'not public()')
     else:
         published = repo.revs(b'::%ln - public()', pushop.revs)
+        # we want to use pushop.revs in the revset even if they themselves are
+        # secret, but we don't want to have anything that the server won't see
+        # in the result of this expression
+        published &= repo.filtered(b'served')
+
     if mode == b'auto':
         published = repo.revs(b'%ld::(%ld - topic())', published, published)
     if published:
--- a/tests/test-topic-flow-publish-bare.t	Mon May 24 14:26:42 2021 +0800
+++ b/tests/test-topic-flow-publish-bare.t	Mon May 24 15:14:30 2021 +0800
@@ -365,6 +365,13 @@
 Trying to push changeset without topic (would publish them)
 
   $ mkcommit c_aM0
+  $ hg phase --secret --force
+  $ hg push --config experimental.auto-publish=abort -r .
+  pushing to $TESTTMP/bare-branch-server
+  searching for changes
+  no changes found (ignored 1 secret changesets)
+  [1]
+  $ hg phase --draft
   $ hg push --config experimental.auto-publish=abort -r .
   pushing to $TESTTMP/bare-branch-server
   abort: push would publish 1 changesets