diff --git a/contrib/packaging/Makefile b/contrib/packaging/Makefile --- a/contrib/packaging/Makefile +++ b/contrib/packaging/Makefile @@ -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 \ diff --git a/contrib/python-zstandard/c-ext/decompressor.c b/contrib/python-zstandard/c-ext/decompressor.c --- a/contrib/python-zstandard/c-ext/decompressor.c +++ b/contrib/python-zstandard/c-ext/decompressor.c @@ -68,13 +68,13 @@ static int Decompressor_init(ZstdDecompr }; 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; } diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -1036,6 +1036,12 @@ def _bmaction(old, new): 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 @@ def _pushb2bookmarkspart(pushop, bundler 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 @@ def _pushb2bookmarkspushkey(pushop, bund 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)) diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t --- a/tests/test-bookmarks-pushpull.t +++ b/tests/test-bookmarks-pushpull.t @@ -1322,3 +1322,31 @@ attempt to move the bookmark is rejected 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]