merge with stable
authorYuya Nishihara <yuya@tcha.org>
Sat, 31 Aug 2019 11:10:12 +0900
changeset 42820 10841b9a80c3
parent 42819 6a551a2dc666 (current diff)
parent 42812 a4e32fd539ab (diff)
child 42821 c070ca6ed86d
merge with stable
mercurial/exchange.py
--- a/contrib/packaging/Makefile	Thu Aug 29 15:49:16 2019 +0200
+++ b/contrib/packaging/Makefile	Sat Aug 31 11:10:12 2019 +0900
@@ -1,15 +1,15 @@
 $(eval HGROOT := $(shell cd ../..; pwd))
 
 DEBIAN_CODENAMES := \
-  jessie \
   stretch \
-  buster
+  buster \
+  bullseye
 
 UBUNTU_CODENAMES := \
-  trusty \
   xenial \
-  artful \
   bionic \
+  cosmic \
+  disco
 
 FEDORA_RELEASES := \
   20 \
--- a/contrib/python-zstandard/c-ext/decompressor.c	Thu Aug 29 15:49:16 2019 +0200
+++ b/contrib/python-zstandard/c-ext/decompressor.c	Sat Aug 31 11:10:12 2019 +0900
@@ -68,13 +68,13 @@
 	};
 
 	ZstdCompressionDict* dict = NULL;
-	size_t maxWindowSize = 0;
+	Py_ssize_t maxWindowSize = 0;
 	ZSTD_format_e format = ZSTD_f_zstd1;
 
 	self->dctx = NULL;
 	self->dict = NULL;
 
-	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O!II:ZstdDecompressor", kwlist,
+	if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|O!nI:ZstdDecompressor", kwlist,
 		&ZstdCompressionDictType, &dict, &maxWindowSize, &format)) {
 		return -1;
 	}
--- 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))
--- a/tests/test-bookmarks-pushpull.t	Thu Aug 29 15:49:16 2019 +0200
+++ b/tests/test-bookmarks-pushpull.t	Sat Aug 31 11:10:12 2019 +0900
@@ -1322,3 +1322,31 @@
   abort: push failed on remote
   [255]
 #endif
+
+-- test for pushing bookmarks pointing to secret changesets
+
+Set up a "remote" repo
+  $ hg init issue6159remote
+  $ cd issue6159remote
+  $ echo a > a
+  $ hg add a
+  $ hg commit -m_
+  $ hg bookmark foo
+  $ cd ..
+
+Clone a local repo
+  $ hg clone -q issue6159remote issue6159local
+  $ cd issue6159local
+  $ hg up -qr foo
+  $ echo b > b
+
+Move the bookmark "foo" to point at a secret changeset
+  $ hg commit -qAm_ --config phases.new-commit=secret
+
+Pushing the bookmark "foo" now fails as it contains a secret changeset
+  $ hg push -r foo
+  pushing to $TESTTMP/issue6159remote
+  searching for changes
+  no changes found (ignored 1 secret changesets)
+  abort: cannot push bookmark foo as it points to a secret changeset
+  [255]