# HG changeset patch # User Martin von Zweigbergk # Date 2022-02-16 04:24:46 # Node ID 6cfa30681a1db469e07b083b3b26da824442d2b4 # Parent b70c9697ab415636c06e9201ea526cba626bd3a8 # Parent a1538c05d855d4752ddbf38466dd66026971319c branching: merge with stable diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -204,11 +204,11 @@ i18n/hg.pot: $(PYFILES) $(DOCFILES) i18n # Packaging targets packaging_targets := \ - centos7 \ - centos8 \ + rhel7 \ + rhel8 \ deb \ - docker-centos7 \ - docker-centos8 \ + docker-rhel7 \ + docker-rhel8 \ docker-debian-bullseye \ docker-debian-buster \ docker-debian-stretch \ diff --git a/contrib/packaging/Makefile b/contrib/packaging/Makefile --- a/contrib/packaging/Makefile +++ b/contrib/packaging/Makefile @@ -13,20 +13,20 @@ UBUNTU_CODENAMES := \ FEDORA_RELEASE := 31 -CENTOS_RELEASES := \ +RHEL_RELEASES := \ 7 \ 8 -# Build a Python for these CentOS releases. -CENTOS_WITH_PYTHON_RELEASES := -CENTOS_WITH_NONVERSIONED_PYTHON := -CENTOS_WITH_36_DOCUTILS := 7 +# Build a Python for these RHEL (and derivatives) releases. +RHEL_WITH_PYTHON_RELEASES := +RHEL_WITH_NONVERSIONED_PYTHON := +RHEL_WITH_36_DOCUTILS := 7 help: @echo 'Packaging Make Targets' @echo '' - @echo 'docker-centos{$(strip $(CENTOS_RELEASES))}' - @echo ' Build an RPM for a specific CentOS version using Docker.' + @echo 'docker-rhel{$(strip $(RHEL_RELEASES))}' + @echo ' Build an RPM for a specific RHEL/derivative version using Docker.' @echo '' @echo 'docker-debian-{$(strip $(DEBIAN_CODENAMES))}' @echo ' Build Debian packages specific to a Debian distro using Docker.' @@ -53,8 +53,8 @@ help: @echo 'ppa' @echo ' Build a Debian source package locally targeting the current system' @echo '' - @echo 'centos{$(strip $(CENTOS_RELEASES))}' - @echo ' Build an RPM for a specific CentOS version locally' + @echo 'rhel{$(strip $(RHEL_RELEASES))}' + @echo ' Build an RPM for a specific RHEL/derivative version locally' @echo '' @echo 'fedora' @echo ' Build an RPM for Fedora $(FEDORA_RELEASE) locally' @@ -106,22 +106,22 @@ fedora: docker-fedora: ./dockerrpm fedora$(FEDORA_RELEASE) -# CentOS targets. -define centos_targets -.PHONY: centos$(1) -centos$(1): - mkdir -p $$(HGROOT)/packages/centos$(1) - ./buildrpm $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(CENTOS_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,) - cp $$(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $$(HGROOT)/packages/centos$(1) - cp $$(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $$(HGROOT)/packages/centos$(1) +# RHEL targets. +define rhel_targets +.PHONY: rhel$(1) +rhel$(1): + mkdir -p $$(HGROOT)/packages/rhel$(1) + ./buildrpm $$(if $$(filter $(1),$$(RHEL_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(RHEL_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(RHEL_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,) + cp $$(HGROOT)/contrib/packaging/rpmbuild/RPMS/*/* $$(HGROOT)/packages/rhel$(1) + cp $$(HGROOT)/contrib/packaging/rpmbuild/SRPMS/* $$(HGROOT)/packages/rhel$(1) -.PHONY: docker-centos$(1) -docker-centos$(1): - ./dockerrpm centos$(1) $$(if $$(filter $(1),$$(CENTOS_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(CENTOS_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(CENTOS_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,) +.PHONY: docker-rhel$(1) +docker-rhel$(1): + ./dockerrpm rhel$(1) $$(if $$(filter $(1),$$(RHEL_WITH_PYTHON_RELEASES)),--withpython,$$(if $$(filter $(1),$$(RHEL_WITH_NONVERSIONED_PYTHON)),--python python,))$$(if $$(filter $(1),$$(RHEL_WITH_36_DOCUTILS)), --docutilspackage python36-docutils,) endef -$(foreach release,$(CENTOS_RELEASES),$(eval $(call centos_targets,$(release)))) +$(foreach release,$(RHEL_RELEASES),$(eval $(call rhel_targets,$(release)))) .PHONY: linux-wheels linux-wheels: linux-wheels-x86_64 linux-wheels-i686 diff --git a/contrib/packaging/debian/copyright b/contrib/packaging/debian/copyright --- a/contrib/packaging/debian/copyright +++ b/contrib/packaging/debian/copyright @@ -3,7 +3,7 @@ Upstream-Name: mercurial Source: https://www.mercurial-scm.org/ Files: * -Copyright: 2005-2021, Olivia Mackall and others. +Copyright: 2005-2022, Olivia Mackall and others. License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public diff --git a/contrib/packaging/docker/centos7 b/contrib/packaging/docker/rhel7 rename from contrib/packaging/docker/centos7 rename to contrib/packaging/docker/rhel7 diff --git a/contrib/packaging/docker/centos8 b/contrib/packaging/docker/rhel8 rename from contrib/packaging/docker/centos8 rename to contrib/packaging/docker/rhel8 --- a/contrib/packaging/docker/centos8 +++ b/contrib/packaging/docker/rhel8 @@ -1,4 +1,4 @@ -FROM centos:centos8 +FROM rockylinux/rockylinux:8 RUN groupadd -g %GID% build && \ useradd -u %UID% -g %GID% -s /bin/bash -d /build -m build diff --git a/contrib/packaging/inno/mercurial.iss b/contrib/packaging/inno/mercurial.iss --- a/contrib/packaging/inno/mercurial.iss +++ b/contrib/packaging/inno/mercurial.iss @@ -6,7 +6,7 @@ #endif [Setup] -AppCopyright=Copyright 2005-2021 Olivia Mackall and others +AppCopyright=Copyright 2005-2022 Olivia Mackall and others AppName=Mercurial AppVersion={#VERSION} OutputBaseFilename=Mercurial-{#VERSION}{#SUFFIX} @@ -29,7 +29,7 @@ AppContact=mercurial@mercurial-scm.org DefaultDirName={pf}\Mercurial SourceDir=stage VersionInfoDescription=Mercurial distributed SCM (version {#VERSION}) -VersionInfoCopyright=Copyright 2005-2021 Olivia Mackall and others +VersionInfoCopyright=Copyright 2005-2022 Olivia Mackall and others VersionInfoCompany=Olivia Mackall and others VersionInfoVersion={#QUAD_VERSION} InternalCompressLevel=max diff --git a/contrib/win32/ReadMe.html b/contrib/win32/ReadMe.html --- a/contrib/win32/ReadMe.html +++ b/contrib/win32/ReadMe.html @@ -140,7 +140,7 @@ editor = whatever

- Mercurial is Copyright 2005-2021 Olivia Mackall and others. + Mercurial is Copyright 2005-2022 Olivia Mackall and others.

diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -7906,7 +7906,7 @@ def version_(ui, **opts): ) license = _( b"(see https://mercurial-scm.org for more information)\n" - b"\nCopyright (C) 2005-2021 Olivia Mackall and others\n" + b"\nCopyright (C) 2005-2022 Olivia Mackall and others\n" b"This is free software; see the source for copying conditions. " b"There is NO\nwarranty; " b"not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" diff --git a/mercurial/dirstateutils/v2.py b/mercurial/dirstateutils/v2.py --- a/mercurial/dirstateutils/v2.py +++ b/mercurial/dirstateutils/v2.py @@ -303,17 +303,17 @@ def pack_dirstate(map, copy_map): # Determine if the next entry is in the same sub-tree, if so don't # pack yet next_path = sorted_map[index][0] - should_pack = not get_folder(next_path).startswith(current_folder) + should_pack = not is_ancestor(next_path, current_folder) if should_pack: pack_directory_children(current_node, copy_map, data, stack) while stack and current_node.path != b"": # Go up the tree and write until we reach the folder of the next # entry (if any, otherwise the root) parent = current_node.parent - in_parent_folder_of_next_entry = next_path is not None and ( - get_folder(next_path).startswith(get_folder(stack[-1].path)) + in_ancestor_of_next_path = next_path is not None and ( + is_ancestor(next_path, get_folder(stack[-1].path)) ) - if parent is None or in_parent_folder_of_next_entry: + if parent is None or in_ancestor_of_next_path: break pack_directory_children(parent, copy_map, data, stack) current_node = parent @@ -344,13 +344,34 @@ def get_folder(path): return path.rsplit(b'/', 1)[0] if b'/' in path else b'' +def is_ancestor(path, maybe_ancestor): + """Returns whether `maybe_ancestor` is an ancestor of `path`. + + >>> is_ancestor(b"a", b"") + True + >>> is_ancestor(b"a/b/c", b"a/b/c") + False + >>> is_ancestor(b"hgext3rd/__init__.py", b"hgext") + False + >>> is_ancestor(b"hgext3rd/__init__.py", b"hgext3rd") + True + """ + if maybe_ancestor == b"": + return True + if path <= maybe_ancestor: + return False + path_components = path.split(b"/") + ancestor_components = maybe_ancestor.split(b"/") + return all(c == o for c, o in zip(path_components, ancestor_components)) + + def move_to_correct_node_in_tree(target_folder, current_node, stack): """ Move inside the dirstate node tree to the node corresponding to `target_folder`, creating the missing nodes along the way if needed. """ while target_folder != current_node.path: - if target_folder.startswith(current_node.path): + if is_ancestor(target_folder, current_node.path): # We need to go down a folder prefix = target_folder[len(current_node.path) :].lstrip(b'/') subfolder_name = prefix.split(b'/', 1)[0] diff --git a/mercurial/helptext/hg.1.txt b/mercurial/helptext/hg.1.txt --- a/mercurial/helptext/hg.1.txt +++ b/mercurial/helptext/hg.1.txt @@ -112,7 +112,7 @@ Mailing list: https://www.mercurial-scm. Copying """"""" -Copyright (C) 2005-2021 Olivia Mackall. +Copyright (C) 2005-2022 Olivia Mackall. Free use of this software is granted under the terms of the GNU General Public License version 2 or any later version. diff --git a/mercurial/helptext/hgignore.5.txt b/mercurial/helptext/hgignore.5.txt --- a/mercurial/helptext/hgignore.5.txt +++ b/mercurial/helptext/hgignore.5.txt @@ -26,7 +26,7 @@ See Also Copying ======= This manual page is copyright 2006 Vadim Gelfer. -Mercurial is copyright 2005-2021 Olivia Mackall. +Mercurial is copyright 2005-2022 Olivia Mackall. Free use of this software is granted under the terms of the GNU General Public License version 2 or any later version. diff --git a/mercurial/helptext/hgrc.5.txt b/mercurial/helptext/hgrc.5.txt --- a/mercurial/helptext/hgrc.5.txt +++ b/mercurial/helptext/hgrc.5.txt @@ -34,7 +34,7 @@ See Also Copying ======= This manual page is copyright 2005 Bryan O'Sullivan. -Mercurial is copyright 2005-2021 Olivia Mackall. +Mercurial is copyright 2005-2022 Olivia Mackall. Free use of this software is granted under the terms of the GNU General Public License version 2 or any later version. diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py --- a/mercurial/utils/urlutil.py +++ b/mercurial/utils/urlutil.py @@ -1,6 +1,6 @@ # utils.urlutil - code related to [paths] management # -# Copyright 2005-2021 Olivia Mackall and others +# Copyright 2005-2022 Olivia Mackall and others # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1722,7 +1722,7 @@ if py2exeloaded: extra['console'] = [ { 'script': 'hg', - 'copyright': 'Copyright (C) 2005-2021 Olivia Mackall and others', + 'copyright': 'Copyright (C) 2005-2022 Olivia Mackall and others', 'product_version': version, } ] diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -1137,11 +1137,11 @@ def has_pytype(): return version and sv(_bytes2sys(version.group(0))) >= sv('2019.10.17') -@check("rustfmt", "rustfmt tool at version nightly-2020-10-04") +@check("rustfmt", "rustfmt tool at version nightly-2021-11-02") def has_rustfmt(): # We use Nightly's rustfmt due to current unstable config options. return matchoutput( - '`rustup which --toolchain nightly-2020-10-04 rustfmt` --version', + '`rustup which --toolchain nightly-2021-11-02 rustfmt` --version', b'rustfmt', ) diff --git a/tests/test-check-rust-format.t b/tests/test-check-rust-format.t --- a/tests/test-check-rust-format.t +++ b/tests/test-check-rust-format.t @@ -3,6 +3,8 @@ $ . "$TESTDIR/helpers-testrepo.sh" $ cd "$TESTDIR"/.. + +Warning: Keep this in sync with hghave.py $ RUSTFMT=$(rustup which --toolchain nightly-2021-11-02 rustfmt) $ for f in `testrepohg files 'glob:**/*.rs'` ; do > $RUSTFMT --check --edition=2018 --unstable-features --color=never $f diff --git a/tests/test-dirstate.t b/tests/test-dirstate.t --- a/tests/test-dirstate.t +++ b/tests/test-dirstate.t @@ -103,3 +103,21 @@ coherent (issue4353) 1 $ hg status ? a + +#if dirstate-v2 +Check that folders that are prefixes of others do not throw the packer into an +infinite loop. + + $ cd .. + $ hg init infinite-loop + $ cd infinite-loop + $ mkdir hgext3rd hgext + $ touch hgext3rd/__init__.py hgext/zeroconf.py + $ hg commit -Aqm0 + + $ hg st -c + C hgext/zeroconf.py + C hgext3rd/__init__.py + + $ cd .. +#endif diff --git a/tests/test-doctest.py b/tests/test-doctest.py --- a/tests/test-doctest.py +++ b/tests/test-doctest.py @@ -132,6 +132,7 @@ expected_mods_tested = set( ('mercurial.cmdutil', '{}'), ('mercurial.color', '{}'), ('mercurial.dagparser', "{'optionflags': 4}"), + ('mercurial.dirstateutils.v2', '{}'), ('mercurial.encoding', '{}'), ('mercurial.fancyopts', '{}'), ('mercurial.formatter', '{}'),