changeset 49260:cd51d4957b28

branching: merge stable into default
author Raphaël Gomès <rgomes@octobus.net>
date Thu, 02 Jun 2022 16:24:06 +0200
parents a94f28be2e6e (current diff) 868bee335517 (diff)
children 31602d471b60
files hgext/narrow/narrowwirepeer.py mercurial/chgserver.py tests/run-tests.py
diffstat 6 files changed, 51 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsigs	Fri May 27 02:54:20 2022 +0200
+++ b/.hgsigs	Thu Jun 02 16:24:06 2022 +0200
@@ -227,3 +227,4 @@
 d4486810a1795fba9521449b8885ced034f3a6dd 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmIePhwZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVm3LC/wP9h6bFiy1l3fJhmq2yKuXu/oNWqT7CmOPqOPnQoO6Pd7a184kvgrabU9dsnXllj1mtbUhaIcfZ8XAb30lTbr0W1dSDoT0QWMY7sOFgXIvJSbWWmFo8DrYQSTlg1xA0LWdwsSKmce/r1G6D7JERj5VzBs3Hq65Kb9vg94vqdVSvyye+YzSODSh1w8P0qsgv78UWqabSrf28DlUp/kG7j43k1J93ZEOgH7+jrxgiQ2WzhmhlWcUFJOGxchbdDl5XZptwPssNstUgXfZKe5sFOI7WJSN//rHo3JgLbEDCX7TMe82aPl2DxEquHNH8rrOha4UuGZjFwO+/PzykItUCPzPWabE6z49w6+/G1us+ofts1z8Muh0ICegFxbd0bRotGRmJ/iEZqrtgFQokx1SSlZKArbRBbLfWoJcczxWxBK1qCz2avKY4qKcieC9TTo7LrHqA5JvLNuqvInKITYOfq1zCuLvxnaSCQTKKOEEb9/ortjxN9rvx1bFyRorVvXR+J0=
 5bd6bcd31dd1ebb63b8914b00064f96297267af7 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmJMXf0ZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVpSlC/sH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qxa02YTqyKJDHHqgTyFrZIkH/jb+rdfIskaOZZo6JcGUoacFOUhFfhSxxB1kN2HEHvEAQPMkc=
+6b10151b962108f65bfa12b3918b1021ca334f73 0 iQHNBAABCgA3FiEEH2b4zfZU6QXBHaBhoR4BzQ4F2VYFAmKYxvUZHGFscGhhcmVAcmFwaGFlbGdvbWVzLmRldgAKCRChHgHNDgXZVqsDC/9EKBjkHvQeY55bqhqqyf5Mccw8cXH5/WBsyJYtEl+W6ykFRlTUUukY0MKzc1xCGG4sryTwqf8qxW92Yqt4bwoFIKIEpOa6CGsf18Ir/fMVNaOmYABtbbLqFgkuarNLz5wIMkGXugqZ4RUhs7HvL0Rsgb24mWpS5temzb2f0URP5uKFCY4MMC+oBFHKFfkn9MwAVIkX+iAakDR4x6dbSPKPNRwRqILKSnGosDZ+dnvvjJTbqZdLowU5OBXdUoa57j9xxcSzCme0hQ0VNuPcn4DQ/N2yZrCsJvvv3soE94jMkhbnfLZ3/EulQAVZZs9Hjur4w/Hk9g8+YK5lIvJDUSX3cBRiYKuGojxDMnXP5f1hW4YdDVCFhnwczeG7Q20fybjwWvB+QgYUkHzGbdCYSHCWE7f/HhTivEPSudYP4SdMnEdWNx2Rqvs+QsgFAEiIgc6lhupyZwyfIdhgxPJ/BAsjUDJnFR0dj86yVoWjoQfkEyf6toK3OjrHNLPEPfWX4Ac=
--- a/.hgtags	Fri May 27 02:54:20 2022 +0200
+++ b/.hgtags	Thu Jun 02 16:24:06 2022 +0200
@@ -240,3 +240,4 @@
 d4486810a1795fba9521449b8885ced034f3a6dd 6.1
 5bd6bcd31dd1ebb63b8914b00064f96297267af7 6.1.1
 0ddd5e1f5f67438af85d12e4ce6c39021dde9916 6.1.2
+6b10151b962108f65bfa12b3918b1021ca334f73 6.1.3
--- a/hgext/narrow/narrowwirepeer.py	Fri May 27 02:54:20 2022 +0200
+++ b/hgext/narrow/narrowwirepeer.py	Thu Jun 02 16:24:06 2022 +0200
@@ -9,6 +9,7 @@
 from mercurial import (
     bundle2,
     error,
+    exchange,
     extensions,
     hg,
     narrowspec,
@@ -85,6 +86,11 @@
         newincludes = splitpaths(newincludes)
         oldexcludes = splitpaths(oldexcludes)
         newexcludes = splitpaths(newexcludes)
+
+        # enforce narrow acl if set
+        if repo.ui.has_section(exchange._NARROWACL_SECTION):
+            exchange.applynarrowacl(repo, {'includepats': newincludes})
+
         # validate the patterns
         narrowspec.validatepatterns(set(oldincludes))
         narrowspec.validatepatterns(set(newincludes))
--- a/mercurial/chgserver.py	Fri May 27 02:54:20 2022 +0200
+++ b/mercurial/chgserver.py	Thu Jun 02 16:24:06 2022 +0200
@@ -446,6 +446,7 @@
                     os.dup2(nullfd, fp.fileno())
                     fp.flush()
                 os.dup2(fd, fp.fileno())
+                os.close(fd)
             except OSError as err:
                 # According to issue6330, running chg on heavy loaded systems
                 # can lead to EBUSY. [man dup2] indicates that, on Linux,
@@ -458,7 +459,6 @@
                     stringutil.forcebytestr(err),
                     fn,
                 )
-            os.close(fd)
             setattr(self, cn, ch)
             setattr(ui, fn, fp)
         os.close(nullfd)
--- a/tests/run-tests.py	Fri May 27 02:54:20 2022 +0200
+++ b/tests/run-tests.py	Thu Jun 02 16:24:06 2022 +0200
@@ -969,6 +969,10 @@
     return killmod.killdaemons(pidfile, tryhard=False, remove=True, logfn=vlog)
 
 
+# sysconfig is not thread-safe (https://github.com/python/cpython/issues/92452)
+sysconfiglock = threading.Lock()
+
+
 class Test(unittest.TestCase):
     """Encapsulates a single, runnable test.
 
@@ -1399,7 +1403,8 @@
             env["HGPORT%s" % offset] = '%s' % (self._startport + i)
 
         env = os.environ.copy()
-        env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or ''
+        with sysconfiglock:
+            env['PYTHONUSERBASE'] = sysconfig.get_config_var('userbase') or ''
         env['HGEMITWARNINGS'] = '1'
         env['TESTTMP'] = _bytes2sys(self._testtmp)
         # the FORWARD_SLASH version is useful when running `sh` on non unix
--- a/tests/test-narrow-acl.t	Fri May 27 02:54:20 2022 +0200
+++ b/tests/test-narrow-acl.t	Thu Jun 02 16:24:06 2022 +0200
@@ -41,3 +41,39 @@
   $ hg -R narrowclone1 tracked
   I path:f1
   I path:f2
+
+Narrow should not be able to widen to include f3
+  $ hg -R narrowclone1 tracked --addinclude f3
+  comparing with http://localhost:$HGPORT1/
+  searching for changes
+  abort: The following includes are not accessible for test: ['path:f3']
+  [255]
+  $ ls -A -1 narrowclone1 | sort
+  .hg
+  f1
+  f2
+  $ hg -R narrowclone1 tracked
+  I path:f1
+  I path:f2
+
+Narrow should allow widen to include f2
+  $ hg -R narrowclone1 tracked --removeinclude f2 > /dev/null
+  $ hg -R narrowclone1 tracked
+  I path:f1
+  $ ls -A -1 narrowclone1 | sort
+  .hg
+  f1
+  $ hg -R narrowclone1 tracked --addinclude f2
+  comparing with http://localhost:$HGPORT1/
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 0 changesets with 1 changes to 1 files
+  $ hg -R narrowclone1 tracked
+  I path:f1
+  I path:f2
+  $ ls -A -1 narrowclone1 | sort
+  .hg
+  f1
+  f2