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
- 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