safeguard: allow push to succeed (and without warning) with --publish
authorAnton Shestakov <av6@dwimlabs.net>
Mon, 05 Nov 2018 19:56:33 +0800
changeset 4246 2d9902f0ff17
parent 4245 419801742d08
child 4247 820a25dcea58
safeguard: allow push to succeed (and without warning) with --publish
CHANGELOG
hgext3rd/evolve/safeguard.py
tests/test-obsolete-push.t
--- a/CHANGELOG	Sun Nov 04 22:06:23 2018 +0800
+++ b/CHANGELOG	Mon Nov 05 19:56:33 2018 +0800
@@ -1,6 +1,10 @@
 Changelog
 =========
 
+8.4.0 - in progress
+-------------------
+
+  * push: have `--publish` overrule the `auto-publish` config
 
 8.3.2 - in progress
 -------------------
--- a/hgext3rd/evolve/safeguard.py	Sun Nov 04 22:06:23 2018 +0800
+++ b/hgext3rd/evolve/safeguard.py	Mon Nov 05 19:56:33 2018 +0800
@@ -26,7 +26,8 @@
         def checkpush(self, pushop):
             super(noautopublishrepo, self).checkpush(pushop)
             behavior = self.ui.config('experimental', 'auto-publish', 'default')
-            if behavior not in ('warn', 'abort'):
+            nocheck = behavior not in ('warn', 'abort')
+            if nocheck or getattr(pushop, 'publish', False):
                 return
             remotephases = pushop.remote.listkeys('phases')
             publishing = remotephases.get('publishing', False)
--- a/tests/test-obsolete-push.t	Sun Nov 04 22:06:23 2018 +0800
+++ b/tests/test-obsolete-push.t	Mon Nov 05 19:56:33 2018 +0800
@@ -4,6 +4,7 @@
   > [extensions]
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
+  $ echo "topic=$(echo $(dirname $TESTDIR))/hgext3rd/topic/" >> $HGRCPATH
 
   $ template='{rev}:{node|short}@{branch}({separate("/", obsolete, phase)}) {desc|firstline}\n'
   $ glog() {
@@ -91,3 +92,15 @@
   adding manifests
   adding file changes
   added 0 changesets with 0 changes to 1 files
+
+--publish overrides auto-publish
+
+  $ echo d > d
+  $ hg ci -qAm D d
+  $ hg push -r . --publish --config experimental.auto-publish=abort
+  pushing to $TESTTMP/source
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files