diff mercurial/exchange.py @ 42830:10841b9a80c3

merge with stable
author Yuya Nishihara <yuya@tcha.org>
date Sat, 31 Aug 2019 11:10:12 +0900
parents 268662aac075 3332bde53714
children 08fce968d00b
line wrap: on
line diff
--- a/mercurial/exchange.py	Thu Aug 29 15:49:16 2019 +0200
+++ b/mercurial/exchange.py	Sat Aug 31 11:10:12 2019 +0900
@@ -1036,6 +1036,12 @@
         return 'delete'
     return 'update'
 
+def _abortonsecretctx(pushop, node, b):
+    """abort if a given bookmark points to a secret changeset"""
+    if node and pushop.repo[node].phase() == phases.secret:
+        raise error.Abort(_('cannot push bookmark %s as it points to a secret'
+                            ' changeset') % b)
+
 def _pushb2bookmarkspart(pushop, bundler):
     pushop.stepsdone.add('bookmarks')
     if not pushop.outbookmarks:
@@ -1044,6 +1050,7 @@
     allactions = []
     data = []
     for book, old, new in pushop.outbookmarks:
+        _abortonsecretctx(pushop, new, book)
         new = bin(new)
         data.append((book, new))
         allactions.append((book, _bmaction(old, new)))
@@ -1072,6 +1079,7 @@
         assert False
 
     for book, old, new in pushop.outbookmarks:
+        _abortonsecretctx(pushop, new, book)
         part = bundler.newpart('pushkey')
         part.addparam('namespace', enc('bookmarks'))
         part.addparam('key', enc(book))