changeset 5933:c979af037915 stable

evolve: use "served" repo filter to guess what the server will publish
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 24 May 2021 15:15:45 +0800
parents fe25ec8f0124
children 6f8ab1030374
files hgext3rd/evolve/safeguard.py tests/test-obsolete-push.t
diffstat 2 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/safeguard.py	Mon May 24 15:14:30 2021 +0800
+++ b/hgext3rd/evolve/safeguard.py	Mon May 24 15:15:45 2021 +0800
@@ -38,6 +38,10 @@
                 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 published:
                 if behavior == b'warn':
                     ui.warn(_(b'%i changesets about to be published\n')
--- a/tests/test-obsolete-push.t	Mon May 24 15:14:30 2021 +0800
+++ b/tests/test-obsolete-push.t	Mon May 24 15:15:45 2021 +0800
@@ -60,7 +60,7 @@
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ cd strict-publish-client
   $ echo c > c
-  $ hg ci -qAm C c
+  $ hg ci -qAm C c --secret
 
 abort behavior
 
@@ -70,6 +70,17 @@
   > eof
   $ hg push -r .
   pushing to $TESTTMP/source
+  searching for changes
+  no changes found (ignored 1 secret changesets)
+  [1]
+  $ hg push
+  pushing to $TESTTMP/source
+  searching for changes
+  no changes found (ignored 1 secret changesets)
+  [1]
+  $ hg phase --draft
+  $ hg push -r .
+  pushing to $TESTTMP/source
   abort: push would publish 1 changesets
   (* 'experimental.auto-publish' config) (glob)
   [255]