Mercurial > hg
changeset 51314:7e6aae033d8d
branching: merge stable into default
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Thu, 11 Jan 2024 17:52:13 +0100 |
parents | 87bfd1703597 (current diff) 3f87e0d305cd (diff) |
children | 178e50edb4f8 |
files | mercurial/commands.py mercurial/pycompat.py |
diffstat | 8 files changed, 141 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgsigs Mon Jan 08 13:35:02 2024 +0100 +++ b/.hgsigs Thu Jan 11 17:52:13 2024 +0100 @@ -254,3 +254,4 @@ 27055614b68538576fb0439007009acf93fe0a49 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmVKXukZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVg5UDACTnRyxApQMQLaRX9khRB6E5XkSJqpR3wqXr5yMLaqgaUGzUUaupA8zTjWoIDM730V1hWliWinQGD/3XA7qUQ31VALRQq8PlvzMEkSz0NB2IDBU6uHdhNAkZQeYm7qJwpzCIuPs/diVm97oUJr0+Y7KJKV7ZxUtZ1bEBHq/FUgyVnLkVQJdb1p28ECIKQ8SS7XY5C8rdYGa1fHYpsLAfTbAunVOEl6Phi3Y3ZqNgcet8WAP+6MwXpgf6ye9O1p2HSaM4BFq2d8AizksjSCuVTTRtuCkpcLDGCtvb6dOJxb4TpMyaYWXerolEGF3ZJsaVgOi/bH7aDsoJP0I5IJnmxiyVjOvOUDd5o3nn0SElsp45r0udGlos5r6tW+kZ9OBBH8nv3AcFxuGD8YFPB3AMRcqIBG1tNLa02bOAaF+uFKVB+YGWHowZtC+SdN2XZ1tp7BD/3CQo+PrpZzEDdVs9S30wef5k+2Nrj2/8tOF/XULy1BRxQV+k2PTlE1/mTaEY60= 26c57e7a0890b96e2c473b394de380d6753c9230 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmVcykAZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmR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paXuu3IUwaS1U0gaTxKbjnEXZqVY1w4RkdUnhEm42RBlMsa9/TBbgkFacvWMi70VDDATJMPh7dQSi1fylSiYD2HEySAnaBxXU5aPfefbQ= +136902b3a95db38854ebaf5198a627641065c2ea 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmWgHCIZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVtVFDACX0F3mxc9xtIlaQaze8z9LnTg0dluNZiuM2C74o9jdVW5Jq+jhF7HjiGxRr2D5a/RhaPHg3bgRSf3Pjm0js9XSE0D9+HHZW3t29M37ShgknA2g9N1kADXkrg5frdOHYfa9tqhyWp78Vupydkh08iK4/5Prb/EPrDF3+GXwOJcIJ7xo4aQ7MVjwAzQkbUjzVqDd4x4HCRsT1jzUetnzuPXB6nWXcM521wbQjD9s4PceaAFPNyYXnckuSaNribSyCU6t3IqgMSxIr73khijc3+yCFHyTznEa3fNI7gp1VJygi69Ukt18YWJOG/dm0GGHvKunQUKcYFAAX2FY7NnQAqI/zqUDyg2vHE3ufy/F2tmNbpOnVuOz2/YYlIcTSF4llyt80IB89WrfdwTZqNUfZcwPgFG8ajW5v/jHvic5DZSxvDfmCvNIxhtOoz8BVZMXi3DzDOMbT20D9leCcBwmHoFYNAZC/z4QwkrXFgrbFiy27Sj5LqFqO1hlY3NVpk01F2w=
--- a/.hgtags Mon Jan 08 13:35:02 2024 +0100 +++ b/.hgtags Thu Jan 11 17:52:13 2024 +0100 @@ -270,3 +270,4 @@ 27055614b68538576fb0439007009acf93fe0a49 6.6rc0 26c57e7a0890b96e2c473b394de380d6753c9230 6.6 71bd09bebbe36a09569cbfb388f371433360056b 6.6.1 +136902b3a95db38854ebaf5198a627641065c2ea 6.6.2
--- a/hgext/narrow/narrowwirepeer.py Mon Jan 08 13:35:02 2024 +0100 +++ b/hgext/narrow/narrowwirepeer.py Thu Jan 11 17:52:13 2024 +0100 @@ -6,6 +6,10 @@ # GNU General Public License version 2 or any later version. +from mercurial.i18n import _ + +from mercurial.utils import stringutil + from mercurial import ( bundle2, error, @@ -82,20 +86,38 @@ # work around ''.split(',') => [''] return data.split(b',') if data else [] - oldincludes = splitpaths(oldincludes) - newincludes = splitpaths(newincludes) - oldexcludes = splitpaths(oldexcludes) - newexcludes = splitpaths(newexcludes) + oldincludes = set(splitpaths(oldincludes)) + newincludes = set(splitpaths(newincludes)) + oldexcludes = set(splitpaths(oldexcludes)) + newexcludes = set(splitpaths(newexcludes)) # enforce narrow acl if set if repo.ui.has_section(exchange._NARROWACL_SECTION): - exchange.applynarrowacl(repo, {'includepats': newincludes}) + kwargs = exchange.applynarrowacl( + repo, {'includepats': newincludes, 'excludepats': newexcludes} + ) + newincludes = kwargs['includepats'] + requiredexcludes = kwargs['excludepats'] - newexcludes + if requiredexcludes: + # XXX: The below code to get the username was copied from exchange.py, + # where it is noted that this is technically a layering violation for + # assuming the existence of HTTP. Using it anyway to make the error + # message consistent with the error message for invalid includes. + ui = repo.ui + username = ui.shortuser( + ui.environ.get(b'REMOTE_USER') or ui.username() + ) + raise error.Abort( + _(b"The following excludes cannot be removed for %s: %s") + % (username, stringutil.pprint(list(requiredexcludes))) + ) + newexcludes = kwargs['excludepats'] # validate the patterns - narrowspec.validatepatterns(set(oldincludes)) - narrowspec.validatepatterns(set(newincludes)) - narrowspec.validatepatterns(set(oldexcludes)) - narrowspec.validatepatterns(set(newexcludes)) + narrowspec.validatepatterns(oldincludes) + narrowspec.validatepatterns(newincludes) + narrowspec.validatepatterns(oldexcludes) + narrowspec.validatepatterns(newexcludes) common = wireprototypes.decodelist(commonheads) known = wireprototypes.decodelist(known)
--- a/mercurial/commands.py Mon Jan 08 13:35:02 2024 +0100 +++ b/mercurial/commands.py Thu Jan 11 17:52:13 2024 +0100 @@ -1593,13 +1593,13 @@ _(b'packed bundles cannot be produced by "hg bundle"'), hint=_(b"use 'hg debugcreatestreamclonebundle'"), ) - + base_opt = opts.get('base') if opts.get('all'): if dests: raise error.InputError( _(b"--all is incompatible with specifying destinations") ) - if opts.get('base'): + if base_opt: ui.warn(_(b"ignoring --base because --all was specified\n")) if opts.get('exact'): ui.warn(_(b"ignoring --exact because --all was specified\n")) @@ -1609,19 +1609,24 @@ raise error.InputError( _(b"--exact is incompatible with specifying destinations") ) - if opts.get('base'): + if base_opt: ui.warn(_(b"ignoring --base because --exact was specified\n")) base = repo.revs(b'parents(%ld) - %ld', revs, revs) if not base: base = [nullrev] + elif base_opt: + base = logcmdutil.revrange(repo, base_opt) + if not base: + # base specified, but nothing was selected + base = [nullrev] else: - base = logcmdutil.revrange(repo, opts.get('base')) + base = None if cgversion not in changegroup.supportedoutgoingversions(repo): raise error.Abort( _(b"repository does not support bundle version %s") % cgversion ) - if base: + if base is not None: if dests: raise error.InputError( _(b"--base is incompatible with specifying destinations")
--- a/mercurial/pycompat.py Mon Jan 08 13:35:02 2024 +0100 +++ b/mercurial/pycompat.py Thu Jan 11 17:52:13 2024 +0100 @@ -202,6 +202,13 @@ >>> bytestr(bytesable()) 'bytes' + ...unless the argument is the bytes *type* itself: it gets a + __bytes__() method in Python 3.11, which cannot be used as in an instance + of bytes: + + >>> bytestr(bytes) + "<class 'bytes'>" + There's no implicit conversion from non-ascii str as its encoding is unknown: @@ -251,10 +258,9 @@ def __new__(cls: Type[_Tbytestr], s: object = b'') -> _Tbytestr: if isinstance(s, bytestr): return s - if not isinstance( - s, (bytes, bytearray) - ) and not builtins.hasattr( # hasattr-py3-only - s, u'__bytes__' + if not isinstance(s, (bytes, bytearray)) and ( + isinstance(s, type) + or not builtins.hasattr(s, u'__bytes__') # hasattr-py3-only ): s = str(s).encode('ascii') return bytes.__new__(cls, s)
--- a/relnotes/6.6 Mon Jan 08 13:35:02 2024 +0100 +++ b/relnotes/6.6 Thu Jan 11 17:52:13 2024 +0100 @@ -1,3 +1,12 @@ += Mercurial 6.6.2 = + + * histedit: remove superfluous echo() and endwin() calls (issue6859) + * persistent-nodemap: avoid writing nodemap for empty revlog + * persistent-nodemap: respect the mmap setting when refreshing data + * bundle: do not detect --base argument that match nothing as lack of argument + * narrow: prevent removal of ACL-defined excludes + * pycompat: fix bytestr(bytes) in Python 3.11 + = Mercurial 6.6.1 = The first two patches fix aborted transactions that could happen since 6.6.
--- a/tests/test-bundle-r.t Mon Jan 08 13:35:02 2024 +0100 +++ b/tests/test-bundle-r.t Thu Jan 11 17:52:13 2024 +0100 @@ -140,6 +140,10 @@ $ hg -R test bundle --base 2 --all test-bundle-all-2.hg ignoring --base because --all was specified 9 changesets found + $ hg -R test bundle --base 3-3 -r tip test-base-match-nothing-with-dest.hg --config paths.default=$TESTTMP/test-3 + 5 changesets found + $ hg -R test bundle --base 3-3 -r tip test-base-match-nothing-no-dest.hg + 5 changesets found $ hg -R test bundle --base 3 -r tip test-bundle-should-fail.hg 1 changesets found
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-narrow-acl-excludes.t Thu Jan 11 17:52:13 2024 +0100 @@ -0,0 +1,75 @@ +Test exclusion-based ACL enforcement + $ . "$TESTDIR/narrow-library.sh" + + $ hg init master + $ cd master + + $ for x in `$TESTDIR/seq.py 3`; do + > echo $x > "f$x" + > hg add "f$x" + > hg commit -m "Add $x" + > done + $ cat >> .hg/hgrc << EOF + > [narrowacl] + > default.includes=* + > default.excludes=f2 f3 + > test.excludes=f3 + > EOF + $ hg serve -a localhost -p $HGPORT1 -d --pid-file=hg.pid + $ cat hg.pid >> "$DAEMON_PIDS" + + $ cd .. + $ hg clone http://localhost:$HGPORT1 narrowclone1 + requesting all changes + adding changesets + adding manifests + adding file changes + added 3 changesets with 2 changes to 2 files + new changesets * (glob) + updating to branch default + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + +The clone directory should only contain f1 and f2 + $ ls -A -1 narrowclone1 | sort + .hg + f1 + f2 + +Requirements should contain narrowhg + $ hg debugrequires -R narrowclone1 | grep narrowhg + narrowhg-experimental + +NarrowHG should exclude f3. + $ hg -R narrowclone1 tracked + I path:. + X path:f3 + +Narrow should not be able to widen to include f3 + $ hg -R narrowclone1 tracked --addinclude f3 + comparing with http://localhost:$HGPORT1/ + searching for changes + adding changesets + adding manifests + adding file changes + $ ls -A -1 narrowclone1 | sort + .hg + f1 + f2 + $ hg -R narrowclone1 tracked + I path:. + X path:f3 + + +Narrow should not be able to remove the exclusion for f3 + $ hg -R narrowclone1 tracked --removeexclude f3 + comparing with http://localhost:$HGPORT1/ + searching for changes + abort: The following excludes cannot be removed for test: ['path:f3'] + [255] + $ ls -A -1 narrowclone1 | sort + .hg + f1 + f2 + $ hg -R narrowclone1 tracked + I path:. + X path:f3