changeset 48773:6cfa30681a1d

branching: merge with stable
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 15 Feb 2022 20:24:46 -0800
parents b70c9697ab41 (current diff) a1538c05d855 (diff)
children eb9c55453249
files contrib/packaging/docker/rhel7 contrib/packaging/docker/rhel8 mercurial/commands.py mercurial/dirstateutils/v2.py setup.py tests/hghave.py tests/test-dirstate.t
diffstat 20 files changed, 122 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Fri Feb 11 16:52:48 2022 -0800
+++ b/Makefile	Tue Feb 15 20:24:46 2022 -0800
@@ -204,11 +204,11 @@
 # 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 \
--- a/contrib/packaging/Makefile	Fri Feb 11 16:52:48 2022 -0800
+++ b/contrib/packaging/Makefile	Tue Feb 15 20:24:46 2022 -0800
@@ -13,20 +13,20 @@
 
 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 @@
 	@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 @@
 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
--- a/contrib/packaging/debian/copyright	Fri Feb 11 16:52:48 2022 -0800
+++ b/contrib/packaging/debian/copyright	Tue Feb 15 20:24:46 2022 -0800
@@ -3,7 +3,7 @@
 Source: https://www.mercurial-scm.org/
 
 Files: *
-Copyright: 2005-2021, Olivia Mackall <olivia@selenic.com> and others.
+Copyright: 2005-2022, Olivia Mackall <olivia@selenic.com> 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
--- a/contrib/packaging/docker/centos7	Fri Feb 11 16:52:48 2022 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-FROM centos:centos7
-
-RUN groupadd -g %GID% build && \
-    useradd -u %UID% -g %GID% -s /bin/bash -d /build -m build
-
-RUN yum install -y epel-release
-RUN yum install -y \
-	gcc \
-	gettext \
-	make \
-	python3-devel \
-	python36-docutils \
-	rpm-build \
-	tar
-
-# For creating repo meta data
-RUN yum install -y createrepo
-
-# For rust extensions
-RUN yum install -y cargo
--- a/contrib/packaging/docker/centos8	Fri Feb 11 16:52:48 2022 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-FROM centos:centos8
-
-RUN groupadd -g %GID% build && \
-    useradd -u %UID% -g %GID% -s /bin/bash -d /build -m build
-
-RUN yum install -y \
-	gcc \
-	gettext \
-	make \
-	python3-devel \
-	python3-docutils \
-	rpm-build
-
-# For creating repo meta data
-RUN yum install -y createrepo
-
-# For rust extensions
-RUN yum install -y cargo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/packaging/docker/rhel7	Tue Feb 15 20:24:46 2022 -0800
@@ -0,0 +1,20 @@
+FROM centos:centos7
+
+RUN groupadd -g %GID% build && \
+    useradd -u %UID% -g %GID% -s /bin/bash -d /build -m build
+
+RUN yum install -y epel-release
+RUN yum install -y \
+	gcc \
+	gettext \
+	make \
+	python3-devel \
+	python36-docutils \
+	rpm-build \
+	tar
+
+# For creating repo meta data
+RUN yum install -y createrepo
+
+# For rust extensions
+RUN yum install -y cargo
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/packaging/docker/rhel8	Tue Feb 15 20:24:46 2022 -0800
@@ -0,0 +1,18 @@
+FROM rockylinux/rockylinux:8
+
+RUN groupadd -g %GID% build && \
+    useradd -u %UID% -g %GID% -s /bin/bash -d /build -m build
+
+RUN yum install -y \
+	gcc \
+	gettext \
+	make \
+	python3-devel \
+	python3-docutils \
+	rpm-build
+
+# For creating repo meta data
+RUN yum install -y createrepo
+
+# For rust extensions
+RUN yum install -y cargo
--- a/contrib/packaging/inno/mercurial.iss	Fri Feb 11 16:52:48 2022 -0800
+++ b/contrib/packaging/inno/mercurial.iss	Tue Feb 15 20:24:46 2022 -0800
@@ -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 @@
 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
--- a/contrib/win32/ReadMe.html	Fri Feb 11 16:52:48 2022 -0800
+++ b/contrib/win32/ReadMe.html	Tue Feb 15 20:24:46 2022 -0800
@@ -140,7 +140,7 @@
     </p>
 
     <p>
-      Mercurial is Copyright 2005-2021 Olivia Mackall and others.
+      Mercurial is Copyright 2005-2022 Olivia Mackall and others.
     </p>
 
     <p>
--- a/mercurial/commands.py	Fri Feb 11 16:52:48 2022 -0800
+++ b/mercurial/commands.py	Tue Feb 15 20:24:46 2022 -0800
@@ -7906,7 +7906,7 @@
     )
     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"
--- a/mercurial/dirstateutils/v2.py	Fri Feb 11 16:52:48 2022 -0800
+++ b/mercurial/dirstateutils/v2.py	Tue Feb 15 20:24:46 2022 -0800
@@ -303,17 +303,17 @@
             # 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 @@
     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]
--- a/mercurial/helptext/hg.1.txt	Fri Feb 11 16:52:48 2022 -0800
+++ b/mercurial/helptext/hg.1.txt	Tue Feb 15 20:24:46 2022 -0800
@@ -112,7 +112,7 @@
 
 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.
 
--- a/mercurial/helptext/hgignore.5.txt	Fri Feb 11 16:52:48 2022 -0800
+++ b/mercurial/helptext/hgignore.5.txt	Tue Feb 15 20:24:46 2022 -0800
@@ -26,7 +26,7 @@
 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.
 
--- a/mercurial/helptext/hgrc.5.txt	Fri Feb 11 16:52:48 2022 -0800
+++ b/mercurial/helptext/hgrc.5.txt	Tue Feb 15 20:24:46 2022 -0800
@@ -34,7 +34,7 @@
 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.
 
--- a/mercurial/utils/urlutil.py	Fri Feb 11 16:52:48 2022 -0800
+++ b/mercurial/utils/urlutil.py	Tue Feb 15 20:24:46 2022 -0800
@@ -1,6 +1,6 @@
 # utils.urlutil - code related to [paths] management
 #
-# Copyright 2005-2021 Olivia Mackall <olivia@selenic.com> and others
+# Copyright 2005-2022 Olivia Mackall <olivia@selenic.com> 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.
--- a/setup.py	Fri Feb 11 16:52:48 2022 -0800
+++ b/setup.py	Tue Feb 15 20:24:46 2022 -0800
@@ -1722,7 +1722,7 @@
     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,
         }
     ]
--- a/tests/hghave.py	Fri Feb 11 16:52:48 2022 -0800
+++ b/tests/hghave.py	Tue Feb 15 20:24:46 2022 -0800
@@ -1137,11 +1137,11 @@
     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',
     )
 
--- a/tests/test-check-rust-format.t	Fri Feb 11 16:52:48 2022 -0800
+++ b/tests/test-check-rust-format.t	Tue Feb 15 20:24:46 2022 -0800
@@ -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
--- a/tests/test-dirstate.t	Fri Feb 11 16:52:48 2022 -0800
+++ b/tests/test-dirstate.t	Tue Feb 15 20:24:46 2022 -0800
@@ -103,3 +103,21 @@
   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
--- a/tests/test-doctest.py	Fri Feb 11 16:52:48 2022 -0800
+++ b/tests/test-doctest.py	Tue Feb 15 20:24:46 2022 -0800
@@ -132,6 +132,7 @@
         ('mercurial.cmdutil', '{}'),
         ('mercurial.color', '{}'),
         ('mercurial.dagparser', "{'optionflags': 4}"),
+        ('mercurial.dirstateutils.v2', '{}'),
         ('mercurial.encoding', '{}'),
         ('mercurial.fancyopts', '{}'),
         ('mercurial.formatter', '{}'),