D12628: worker: fix `_blockingreader.read()` to really block

2022-05-18 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Maybe I'm missing something simple, but the help for `io.BytesIO.readinto` 
says:
  
Returns number of bytes read (0 for EOF), or None if the object
is set not to block and has no data to read.
  
  and `io.BytesIO.read` says:
  
Return an empty bytes object at EOF.
  
  That would seem to mean that if the _first_ internal `readinto()` of the
  nonblocking `self._wrapped` returns `None` because no data is available, the 
caller
  is tricked that EOF has been reached by returning an empty bytes object.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D12628

AFFECTED FILES
  mercurial/worker.py

CHANGE DETAILS

diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -109,8 +109,10 @@
 
 while pos < size:
 ret = self._wrapped.readinto(view[pos:])
-if not ret:
-break
+if ret is None:
+continue  # nonblocking, and no data
+elif ret == 0:
+break  # 0 -> EOF
 pos += ret
 
 del view



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12627: worker: adapt _blockingreader to work around a python3.8.[0-1] bug (issue6444)

2022-05-17 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Python 3.8.0 is the latest I can load on Ubuntu 18.04, and I regularly hit the
  TypeError because this function is missing.  While it can be avoided by
  disabling worker usage via config option, that's a bit obscure.
  
  I'm limiting the function definition to the narrow range of affected pythons
  because there were other bugs in this area that were worked around, that I 
don't
  fully understand.  See the bug report for discussions on why the narrow range,
  and related commits working around other bugs.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D12627

AFFECTED FILES
  mercurial/worker.py

CHANGE DETAILS

diff --git a/mercurial/worker.py b/mercurial/worker.py
--- a/mercurial/worker.py
+++ b/mercurial/worker.py
@@ -78,6 +78,14 @@
 # _wrapped.readinto(), since that is unbuffered. The unpickler is fine
 # with just read() and readline(), so we don't need to implement it.
 
+if (3, 8, 0) <= sys.version_info[:3] < (3, 8, 2):
+
+# This is required for python 3.8, prior to 3.8.2.  See issue6444.
+def readinto(self, b):
+data = self._wrapped.readall()
+b[:] = data
+return len(data)
+
 def readline(self):
 return self._wrapped.readline()
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12606: contrib: migrate off of a couple of bitbucket URLs

2022-05-04 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I noticed this when diffing the thg installer against Mercurial to see what 
was
  missing.  There are a handful of other URLs in i18n and extension example help
  text if anyone cares to update those.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D12606

AFFECTED FILES
  contrib/packaging/wix/readme.rst
  contrib/win32/mercurial.ini

CHANGE DETAILS

diff --git a/contrib/win32/mercurial.ini b/contrib/win32/mercurial.ini
--- a/contrib/win32/mercurial.ini
+++ b/contrib/win32/mercurial.ini
@@ -5,7 +5,7 @@
 ; This file will be replaced by the installer on every upgrade.
 ; Editing this file can cause strange side effects on Vista.
 ;
-; http://bitbucket.org/tortoisehg/stable/issue/135
+; https://foss.heptapod.net/mercurial/tortoisehg/thg/-/issues/135
 ;
 ; To change settings you see in this file, override (or enable) them in
 ; your user Mercurial.ini file, where USERNAME is your Windows user name:
diff --git a/contrib/packaging/wix/readme.rst b/contrib/packaging/wix/readme.rst
--- a/contrib/packaging/wix/readme.rst
+++ b/contrib/packaging/wix/readme.rst
@@ -63,7 +63,7 @@
 TortoiseHG uses the WiX files in this directory.
 
 The code for building TortoiseHG installers lives at
-https://bitbucket.org/tortoisehg/thg-winbuild and is maintained by
+https://foss.heptapod.net/mercurial/tortoisehg/thg-winbuild and is maintained 
by
 Steve Borho (st...@borho.org).
 
 When changing behavior of the WiX installer, be sure to notify



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12605: diff: add help text to highlight the ability to do "merge diffs"

2022-05-04 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D12605

AFFECTED FILES
  mercurial/commands.py
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -644,7 +644,8 @@
   Note:
  'hg diff' may generate unexpected results for merges, as it will
  default to comparing against the working directory's first parent
- changeset if no revisions are specified.
+ changeset if no revisions are specified.  To diff against the conflict
+ regions, you can use '--config diff.merge=yes'.
   
   By default, the working directory files are compared to its first parent.
   To see the differences from another revision, use --from. To see the
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2537,7 +2537,8 @@
 
:hg:`diff` may generate unexpected results for merges, as it will
default to comparing against the working directory's first
-   parent changeset if no revisions are specified.
+   parent changeset if no revisions are specified.  To diff against the
+   conflict regions, you can use `--config diff.merge=yes`.
 
 By default, the working directory files are compared to its first parent. 
To
 see the differences from another revision, use --from. To see the 
difference



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12599: doc: use an absolute path in sys.path to work around a python DLL loading bug

2022-05-02 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This bug[1] was causing the zstd entry under "Available Compression Engines" 
to
  be omitted from the documentation for some versions of python3.  I could
  upgrade, but past upgrades have broken venvs and clobbered installed packages.
  It's a trivial workaround, so there's no sense in leaving this subtle issue.  
It
  was flushed out by changing the module policy here from 'allow' to 'c', and
  seeing this error:
  
ImportError: DLL load failed while importing parsers: The parameter is 
incorrect.
  
  [1] https://github.com/python/cpython/issues/87271

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12599

AFFECTED FILES
  doc/gendoc.py

CHANGE DETAILS

diff --git a/doc/gendoc.py b/doc/gendoc.py
--- a/doc/gendoc.py
+++ b/doc/gendoc.py
@@ -21,7 +21,7 @@
 # available. Relax C module requirements.
 os.environ['HGMODULEPOLICY'] = 'allow'
 # import from the live mercurial repo
-sys.path.insert(0, "..")
+sys.path.insert(0, os.path.abspath(".."))
 from mercurial import demandimport
 
 demandimport.enable()



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12596: wix: bump the minimum Windows required to 8.1

2022-04-28 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  PyOxidizer binaries are built with py 3.9.6, so not even Windows 7 is 
supported.
  Unfortunately, there don't appear to be more recent values for newer versions 
of
  Windows, but at least Windows 8.1 is still in extended support for another 9
  months or so.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12596

AFFECTED FILES
  contrib/packaging/wix/mercurial.wxs

CHANGE DETAILS

diff --git a/contrib/packaging/wix/mercurial.wxs 
b/contrib/packaging/wix/mercurial.wxs
--- a/contrib/packaging/wix/mercurial.wxs
+++ b/contrib/packaging/wix/mercurial.wxs
@@ -33,8 +33,8 @@
CompressionLevel='high' />
 
 
-
-VersionNT >= 501
+
+VersionNT >= 603
 
 
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12595: wix: drop python2 conditionals

2022-04-28 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12595

AFFECTED FILES
  contrib/packaging/wix/mercurial.wxs
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -292,7 +292,6 @@
 "Platform": platform,
 "Version": VERSION,
 "Comments": "Installs Mercurial version %s" % VERSION,
-"PythonVersion": "3",
 "MercurialHasLib": "1",
 }
 
diff --git a/contrib/packaging/wix/mercurial.wxs 
b/contrib/packaging/wix/mercurial.wxs
--- a/contrib/packaging/wix/mercurial.wxs
+++ b/contrib/packaging/wix/mercurial.wxs
@@ -79,23 +79,6 @@
   
 
   
-
-  
-  
-
-  
-  
-
-  
-  
-
-  
 
 
 
 
 
-
-  
-  
-
   
   
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12570: packaging: drop python27 references from the Windows instructions

2022-04-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I also diffed these two files and eliminated cosmetic differences to make it
  easier to ensure both are in alignment.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12570

AFFECTED FILES
  contrib/packaging/inno/readme.rst
  contrib/packaging/wix/readme.rst

CHANGE DETAILS

diff --git a/contrib/packaging/wix/readme.rst b/contrib/packaging/wix/readme.rst
--- a/contrib/packaging/wix/readme.rst
+++ b/contrib/packaging/wix/readme.rst
@@ -12,50 +12,36 @@
 Requirements
 
 
-Building the WiX installers requires a Windows machine. The following
-dependencies must be installed:
+Building the WiX installer requires a Windows machine.
 
-* Python 2.7 (download from https://www.python.org/downloads/)
-* Microsoft Visual C++ Compiler for Python 2.7
-  (https://www.microsoft.com/en-us/download/details.aspx?id=44266)
-* Python 3.5+ (to run the ``packaging.py`` script)
+The following system dependencies must be installed:
+
+* Python 3.6+ (to run the ``packaging.py`` script)
 
 Building
 
 
 The ``packaging.py`` script automates the process of producing an MSI
 installer. It manages fetching and configuring non-system dependencies
-(such as py2exe, gettext, and various Python packages).
-
-The script requires an activated ``Visual C++ 2008`` command prompt.
-A shortcut to such a prompt was installed with ``Microsoft Visual
-C++ Compiler for Python 2.7``. From your Start Menu, look for
-``Microsoft Visual C++ Compiler Package for Python 2.7`` then
-launch either ``Visual C++ 2008 32-bit Command Prompt`` or
-``Visual C++ 2008 64-bit Command Prompt``.
+(such as gettext, and various Python packages).  It can be run from a
+basic cmd.exe Window (i.e. activating the MSBuildTools environment is
+not required).
 
 From the prompt, change to the Mercurial source directory. e.g.
 ``cd c:\src\hg``.
 
-Next, invoke ``packaging.py`` to produce an MSI installer. You will need
-to supply the path to the Python interpreter to use.::
+Next, invoke ``packaging.py`` to produce an MSI installer.::
 
$ py -3 contrib\packaging\packaging.py \
-  wix --python c:\python27\python.exe
-
-.. note::
-
-   The script validates that the Visual C++ environment is active and
-   that the architecture of the specified Python interpreter matches the
-   Visual C++ environment. An error is raised otherwise.
+   wix --pyoxidizer-target x86_64-pc-windows-msvc
 
 If everything runs as intended, dependencies will be fetched and
 configured into the ``build`` sub-directory, Mercurial will be built,
 and an installer placed in the ``dist`` sub-directory. The final line
 of output should print the name of the generated installer.
 
-Additional options may be configured. Run ``packaging.py wix --help`` to
-see a list of program flags.
+Additional options may be configured. Run ``packaging.py wix --help``
+to see a list of program flags.
 
 Relationship to TortoiseHG
 ==
diff --git a/contrib/packaging/inno/readme.rst 
b/contrib/packaging/inno/readme.rst
--- a/contrib/packaging/inno/readme.rst
+++ b/contrib/packaging/inno/readme.rst
@@ -5,52 +5,35 @@
 
 The following system dependencies must be installed:
 
-* Python 2.7 (download from https://www.python.org/downloads/)
-* Microsoft Visual C++ Compiler for Python 2.7
-  (https://www.microsoft.com/en-us/download/details.aspx?id=44266)
 * Inno Setup (http://jrsoftware.org/isdl.php) version 5.4 or newer.
   Be sure to install the optional Inno Setup Preprocessor feature,
   which is required.
-* Python 3.5+ (to run the ``packaging.py`` script)
+* Python 3.6+ (to run the ``packaging.py`` script)
 
 Building
 
 
-The ``packaging.py`` script automates the process of producing an
-Inno installer. It manages fetching and configuring the
-non-system dependencies (such as py2exe, gettext, and various
-Python packages).
-
-The script requires an activated ``Visual C++ 2008`` command prompt.
-A shortcut to such a prompt was installed with ``Microsoft Visual C++
-Compiler for Python 2.7``. From your Start Menu, look for
-``Microsoft Visual C++ Compiler Package for Python 2.7`` then launch
-either ``Visual C++ 2008 32-bit Command Prompt`` or
-``Visual C++ 2008 64-bit Command Prompt``.
+The ``packaging.py`` script automates the process of producing an Inno
+installer. It manages fetching and configuring non-system dependencies
+(such as gettext, and various Python packages).  It can be run from a
+basic cmd.exe Window (i.e. activating the MSBuildTools environment is
+not required).
 
 From the prompt, change to the Mercurial source directory. e.g.
 ``cd c:\src\hg``.
 
-Next, invoke ``packaging.py`` to produce an Inno installer. You will
-need to supply the path to the Python interpreter to use.::
+Next, invoke ``packaging.py`` to produce an Inno installer.::
 
$ py -3 contrib\p

D12571: packaging: fix the type hint on the download_entry function

2022-04-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Flagged by PyCharm.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12571

AFFECTED FILES
  contrib/packaging/hgpackaging/downloads.py

CHANGE DETAILS

diff --git a/contrib/packaging/hgpackaging/downloads.py 
b/contrib/packaging/hgpackaging/downloads.py
--- a/contrib/packaging/hgpackaging/downloads.py
+++ b/contrib/packaging/hgpackaging/downloads.py
@@ -10,6 +10,7 @@
 import gzip
 import hashlib
 import pathlib
+import typing
 import urllib.request
 
 
@@ -126,8 +127,8 @@
 
 
 def download_entry(
-name: dict, dest_path: pathlib.Path, local_name=None
-) -> pathlib.Path:
+name: str, dest_path: pathlib.Path, local_name=None
+) -> typing.Tuple[pathlib.Path, typing.Dict[str, typing.Union[str, int]]]:
 entry = DOWNLOADS[name]
 
 url = entry['url']



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12569: packaging: add a missing parenthesis to help text

2022-04-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12569

AFFECTED FILES
  contrib/packaging/hgpackaging/cli.py

CHANGE DETAILS

diff --git a/contrib/packaging/hgpackaging/cli.py 
b/contrib/packaging/hgpackaging/cli.py
--- a/contrib/packaging/hgpackaging/cli.py
+++ b/contrib/packaging/hgpackaging/cli.py
@@ -91,7 +91,7 @@
 sp.add_argument(
 "--version",
 help="Mercurial version string to use "
-"(detected from __version__.py if not defined",
+"(detected from __version__.py if not defined)",
 )
 sp.set_defaults(func=build_inno)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12568: git: un-byteify the `mode` argument for the builtin `open()`

2022-04-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I guess this was assuming `pycompat.open` was imported, but it's not here or
  elsewhere in the git extension.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12568

AFFECTED FILES
  hgext/git/dirstate.py

CHANGE DETAILS

diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py
--- a/hgext/git/dirstate.py
+++ b/hgext/git/dirstate.py
@@ -33,7 +33,7 @@
 return orig(filepath, warn, sourceinfo=False)
 result = []
 warnings = []
-with open(filepath, b'rb') as fp:
+with open(filepath, 'rb') as fp:
 for l in fp:
 l = l.strip()
 if not l or l.startswith(b'#'):



To: mharbison72, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12567: git: adapt to some recent dirstate API changes

2022-04-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  There are still old methods like add() and drop().  I don't see anything that
  looks equivalent, so there's likely more work to do.  But this allows diff and
  commit to work again on the simple webpage repo for thg.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12567

AFFECTED FILES
  hgext/git/__init__.py
  hgext/git/dirstate.py

CHANGE DETAILS

diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py
--- a/hgext/git/dirstate.py
+++ b/hgext/git/dirstate.py
@@ -4,6 +4,7 @@
 
 from mercurial.node import sha1nodeconstants
 from mercurial import (
+dirstatemap,
 error,
 extensions,
 match as matchmod,
@@ -11,6 +12,9 @@
 scmutil,
 util,
 )
+from mercurial.dirstateutils import (
+timestamp,
+)
 from mercurial.interfaces import (
 dirstate as intdirstate,
 util as interfaceutil,
@@ -18,6 +22,9 @@
 
 from . import gitutil
 
+
+DirstateItem = dirstatemap.DirstateItem
+propertycache = util.propertycache
 pygit2 = gitutil.get_pygit2()
 
 
@@ -67,13 +74,28 @@
 
 @interfaceutil.implementer(intdirstate.idirstate)
 class gitdirstate:
-def __init__(self, ui, root, gitrepo):
+def __init__(self, ui, vfs, gitrepo, use_dirstate_v2):
 self._ui = ui
-self._root = os.path.dirname(root)
+self._root = os.path.dirname(vfs.base)
+self._opener = vfs
 self.git = gitrepo
 self._plchangecallbacks = {}
 # TODO: context.poststatusfixup is bad and uses this attribute
 self._dirty = False
+self._mapcls = dirstatemap.dirstatemap
+self._use_dirstate_v2 = use_dirstate_v2
+
+@propertycache
+def _map(self):
+"""Return the dirstate contents (see documentation for dirstatemap)."""
+self._map = self._mapcls(
+self._ui,
+self._opener,
+self._root,
+sha1nodeconstants,
+self._use_dirstate_v2,
+)
+return self._map
 
 def p1(self):
 try:
@@ -142,6 +164,13 @@
 [],
 [],
 )
+
+try:
+mtime_boundary = timestamp.get_fs_now(self._opener)
+except OSError:
+# In largefiles or readonly context
+mtime_boundary = None
+
 gstatus = self.git.status()
 for path, status in gstatus.items():
 path = pycompat.fsencode(path)
@@ -193,6 +222,7 @@
 scmutil.status(
 modified, added, removed, deleted, unknown, ignored, clean
 ),
+mtime_boundary,
 )
 
 def flagfunc(self, buildfallback):
@@ -205,6 +235,13 @@
 os.path.dirname(pycompat.fsencode(self.git.path))
 )
 
+def get_entry(self, path):
+"""return a DirstateItem for the associated path"""
+entry = self._map.get(path)
+if entry is None:
+return DirstateItem()
+return entry
+
 def normalize(self, path):
 normed = util.normcase(path)
 assert normed == path, b"TODO handling of case folding: %s != %s" % (
diff --git a/hgext/git/__init__.py b/hgext/git/__init__.py
--- a/hgext/git/__init__.py
+++ b/hgext/git/__init__.py
@@ -16,6 +16,7 @@
 localrepo,
 pycompat,
 registrar,
+requirements as requirementsmod,
 scmutil,
 store,
 util,
@@ -300,9 +301,15 @@
 
 class gitlocalrepo(orig):
 def _makedirstate(self):
+v2_req = requirementsmod.DIRSTATE_V2_REQUIREMENT
+use_dirstate_v2 = v2_req in self.requirements
+
 # TODO narrow support here
 return dirstate.gitdirstate(
-self.ui, self.vfs.base, self.store.git
+self.ui,
+self.vfs,
+self.store.git,
+use_dirstate_v2,
 )
 
 def commit(self, *args, **kwargs):



To: mharbison72, durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12566: idirstate: add missing get_entry() method

2022-04-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12566

AFFECTED FILES
  mercurial/interfaces/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/interfaces/dirstate.py b/mercurial/interfaces/dirstate.py
--- a/mercurial/interfaces/dirstate.py
+++ b/mercurial/interfaces/dirstate.py
@@ -61,6 +61,9 @@
 used to get real file paths. Use vfs functions instead.
 """
 
+def get_entry(path):
+"""return a DirstateItem for the associated path"""
+
 def pathto(f, cwd=None):
 pass
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12560: contrib: add a hint if the Windows dependency MSI is already installed

2022-04-15 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In the past, I've gotten confused when the script failed on seemingly random
  python installs (and thus the py3.8 install was commented out from the last 
time
  this happened to me, which has been reverted here).  This particular error 
code
  means the package was already installed.  For python, it means the major and
  minor version are the same, but the micro version may differ.
  
  In practice, ignoring the python installation failure will cause the pip
  installation that happens next to fail, because python.exe for that version is
  somewhere else on the system.  This could probably be fixed by running py.exe
  with the major and minor version, but that is skipped during the install for
  some reason.  I didn't feel like over complicating this though, and at least
  there's a better hint when the problem occurs.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12560

AFFECTED FILES
  contrib/install-windows-dependencies.ps1

CHANGE DETAILS

diff --git a/contrib/install-windows-dependencies.ps1 
b/contrib/install-windows-dependencies.ps1
--- a/contrib/install-windows-dependencies.ps1
+++ b/contrib/install-windows-dependencies.ps1
@@ -90,7 +90,13 @@
 $p = Start-Process -FilePath $path -ArgumentList $arguments -Wait 
-PassThru -WindowStyle Hidden
 
 if ($p.ExitCode -ne 0) {
-throw "process exited non-0: $($p.ExitCode)"
+# If the MSI is already installed, ignore the error
+if ($p.ExitCode -eq 1638) {
+Write-Output "program already installed; continuing..."
+}
+else {
+throw "process exited non-0: $($p.ExitCode)"
+}
 }
 }
 
@@ -150,7 +156,7 @@
 Install-Python3 "Python 3.7 32-bit" ${prefix}\assets\python37-x86.exe 
${prefix}\python37-x86 ${pip}
 Install-Python3 "Python 3.7 64-bit" ${prefix}\assets\python37-x64.exe 
${prefix}\python37-x64 ${pip}
 Install-Python3 "Python 3.8 32-bit" ${prefix}\assets\python38-x86.exe 
${prefix}\python38-x86 ${pip}
-#Install-Python3 "Python 3.8 64-bit" ${prefix}\assets\python38-x64.exe 
${prefix}\python38-x64 ${pip}
+Install-Python3 "Python 3.8 64-bit" ${prefix}\assets\python38-x64.exe 
${prefix}\python38-x64 ${pip}
 Install-Python3 "Python 3.9 32-bit" ${prefix}\assets\python39-x86.exe 
${prefix}\python39-x86 ${pip}
 Install-Python3 "Python 3.9 64-bit" ${prefix}\assets\python39-x64.exe 
${prefix}\python39-x64 ${pip}
 Install-Python3 "Python 3.10 32-bit" ${prefix}\assets\python310-x86.exe 
${prefix}\python310-x86 ${pip}



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12559: contrib: update python dependencies on Windows

2022-04-15 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12559

AFFECTED FILES
  contrib/install-windows-dependencies.ps1

CHANGE DETAILS

diff --git a/contrib/install-windows-dependencies.ps1 
b/contrib/install-windows-dependencies.ps1
--- a/contrib/install-windows-dependencies.ps1
+++ b/contrib/install-windows-dependencies.ps1
@@ -29,19 +29,19 @@
 $PYTHON38_x64_URL = 
"https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe";
 $PYTHON38_x64_SHA256 = 
"7628244cb53408b50639d2c1287c659f4e29d3dfdb9084b11aed5870c0c6a48a"
 
-$PYTHON39_x86_URL = "https://www.python.org/ftp/python/3.9.9/python-3.9.9.exe";
-$PYTHON39_x86_SHA256 = 
"6646a5683adf14d35e8c53aab946895bc0f0b825f7acac3a62cc85ee7d0dc71a"
-$PYTHON39_X64_URL = 
"https://www.python.org/ftp/python/3.9.9/python-3.9.9-amd64.exe";
-$PYTHON39_x64_SHA256 = 
"137d59e5c0b01a8f1bdcba08344402ae658c81c6bf03b6602bd8b4e951ad0714"
+$PYTHON39_x86_URL = 
"https://www.python.org/ftp/python/3.9.12/python-3.9.12.exe";
+$PYTHON39_x86_SHA256 = 
"3d883326f30ac231c06b33f2a8ea700a185c20bf98d01da118079e9134d5fd20"
+$PYTHON39_X64_URL = 
"https://www.python.org/ftp/python/3.9.12/python-3.9.12-amd64.exe";
+$PYTHON39_x64_SHA256 = 
"2ba57ab2281094f78fc0227a27f4d47c90d94094e7cca35ce78419e616b3cb63"
 
-$PYTHON310_x86_URL = 
"https://www.python.org/ftp/python/3.10.0/python-3.10.0.exe";
-$PYTHON310_x86_SHA256 = 
"ea896eeefb1db9e12fb89ec77a6e28c9fe52b4a162a34c85d9688be2ec2392e8"
-$PYTHON310_X64_URL = 
"https://www.python.org/ftp/python/3.10.0/python-3.10.0-amd64.exe";
-$PYTHON310_x64_SHA256 = 
"cb580eb7dc55f9198e650f016645023e8b2224cf7d033857d12880b46c5c94ef"
+$PYTHON310_x86_URL = 
"https://www.python.org/ftp/python/3.10.4/python-3.10.4.exe";
+$PYTHON310_x86_SHA256 = 
"97c37c53c7a826f5b00e185754ab2a324a919f7afc469b20764b71715c80041d"
+$PYTHON310_X64_URL = 
"https://www.python.org/ftp/python/3.10.4/python-3.10.4-amd64.exe";
+$PYTHON310_x64_SHA256 = 
"a81fc4180f34e5733c3f15526c668ff55de096366f9006d8a44c0336704e50f1"
 
-# PIP 19.2.3.
-$PIP_URL = 
"https://github.com/pypa/get-pip/raw/309a56c5fd94bd1134053a541cb4657a4e47e09d/get-pip.py";
-$PIP_SHA256 = 
"57e3643ff19f018f8a00dfaa6b7e4620e3c1a7a2171fd218425366ec006b3bfe"
+# PIP 22.0.4.
+$PIP_URL = 
"https://github.com/pypa/get-pip/raw/38e54e5de07c66e875c11a1ebbdb938854625dd8/public/get-pip.py";
+$PIP_SHA256 = 
"e235c437e5c7d7524fbce3880ca39b917a73dc565e0c813465b7a7a329bb279a"
 
 $INNO_SETUP_URL = 
"http://files.jrsoftware.org/is/5/innosetup-5.6.1-unicode.exe";
 $INNO_SETUP_SHA256 = 
"27D49E9BC769E9D1B214C153011978DB90DC01C2ACD1DDCD9ED7B3FE3B96B538"



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12556: windows: disable pager when packaged with py2exe

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  With Windows and py3, all output that got directed to the pager was lost.  It
  can be worked around by the user piping to `more`, but that's easy to forget,
  and can be dangerous if `hg diff` or similar incorrectly shows no changes.  
The
  problem appears to be the new WindowsConsoleIO in py3.6[1].  We've worked 
around
  it with PyOxidizer by setting the `Py_LegacyWindowsStdioFlag` interpreter
  option, and worked around it with `hg.bat` and `exewrapper.c` by internally
  setting `PYTHONLEGACYWINDOWSSTDIO=1`.
  
  Unfortunately, py2exe doesn't appear to be able to set the interpreter option,
  and somehow seems to also ignore the environment variable.  The latter isn't a
  good fix anyway, since setting it in the environment would affect other python
  programs too.  We can't install a global config for this because a config 
closer
  to the user (e.g. from before pager was turned on by default) can override it.
  
  [1] https://peps.python.org/pep-0528/

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12556

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1432,6 +1432,14 @@
 # HGPLAINEXCEPT=pager, and the user didn't specify --debug.
 return
 
+# py2exe doesn't appear to be able to use legacy I/O, and nothing is
+# output to the pager for paged commands.  Piping to `more` in cmd.exe
+# works, but is easy to forget.  Just disable pager for py2exe, but
+# leave it working for pyoxidizer and exewrapper builds.
+if pycompat.iswindows and getattr(sys, "frozen", None) == 
"console_exe":
+self.debug(b"pager is unavailable with py2exe packaging\n")
+return
+
 pagercmd = self.config(b'pager', b'pager', rcutil.fallbackpager)
 if not pagercmd:
 return



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12557: windows: fix stdio with py2exe and py3

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  - DO NOT QUEUE THIS **
  
  I have no idea how this is supposed to be fixed for real, but it's likely
  related to the comment above where stdout is set about maybe needing a silly
  wrapper.  PEP 528[1] talks about not assuming the encoding of 
sys.stdout.buffer,
  but I thought the whole point of always using bytes was to avoid encoding.
  
  This hack allows TortoiseHg to work when built with py2exe on py3, by avoiding
  this:
  
#!python
** Mercurial version (6.1.1+hg216.d8b5fd0ab640local20220412).  TortoiseHg 
version (6.1.1+26-204092cabbee)
** Command: --nofork workbench
** CWD: C:\Users\Administrator\Desktop
** Encoding: cp1252
** Extensions loaded: absorb, strip, tortoisehg.util.configitems
** Python version: 3.9.12 (tags/v3.9.12:b28265d, Mar 23 2022, 23:52:46) 
[MSC v.1929 64 bit (AMD64)]
** Windows version: sys.getwindowsversion(major=6, minor=2, build=9200, 
platform=2, service_pack='')
** Processor architecture: x64
** Qt-5.15.2 PyQt-5.15.6 QScintilla-2.13.1
Traceback (most recent call last):
  File "tortoisehg\hgqt\repotab.pyc", line 355, in _onCurrentTabChanged
  File "tortoisehg\hgqt\repotab.pyc", line 406, in _createRepoWidget
  File "tortoisehg\hgqt\repowidget.pyc", line 228, in __init__
  File "tortoisehg\hgqt\repowidget.pyc", line 260, in setupUi
  File "tortoisehg\hgqt\repofilter.pyc", line 264, in __init__
  File "tortoisehg\hgqt\repofilter.pyc", line 554, in refresh
  File "tortoisehg\hgqt\repofilter.pyc", line 491, in _updateBranchFilter
  File "tortoisehg\util\hglib.pyc", line 237, in namedbranches
  File "mercurial\localrepo.pyc", line 2154, in branchmap
  File "mercurial\branchmap.pyc", line 72, in __getitem__
  File "mercurial\branchmap.pyc", line 81, in updatecache
  File "mercurial\repoview.pyc", line 421, in changelog
  File "mercurial\repoview.pyc", line 248, in filterrevs
  File "mercurial\repoview.pyc", line 104, in computehidden
  File "mercurial\repoview.pyc", line 43, in hideablerevs
  File "mercurial\obsolete.pyc", line 911, in getrevs
  File "mercurial\localrepo.pyc", line 118, in __get__
  File "mercurial\scmutil.pyc", line 1709, in __get__
  File "mercurial\localrepo.pyc", line 1723, in obsstore
  File "mercurial\obsolete.pyc", line 817, in makestore
  File "mercurial\ui.pyc", line 1855, in warn
  File "mercurial\ui.pyc", line 1330, in _writemsg
  File "mercurial\ui.pyc", line 2282, in _writemsgwith
  File "mercurial\ui.pyc", line 1273, in _write
  File "mercurial\ui.pyc", line 1298, in _writenobuf
  File "mercurial\windows.pyc", line 240, in write
  File "mercurial\utils\procutil.pyc", line 114, in write
  File "boot_common.py", line 74, in write
TypeError: write() argument must be str, not memoryview
  
  [1] https://peps.python.org/pep-0528/

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12557

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -107,11 +107,11 @@
 
 def write(self, s):
 write1 = self.orig.write
-m = memoryview(s)
-total_to_write = len(s)
+v = encoding.strfromlocal(s)
+total_to_write = len(v)
 total_written = 0
 while total_written < total_to_write:
-c = write1(m[total_written:])
+c = write1(v[total_written:])
 if c:
 total_written += c
 return total_written
@@ -147,11 +147,11 @@
 if sys.stdout is None:
 stdout = BadFile()
 else:
-stdout = _make_write_all(sys.stdout.buffer)
+stdout = _make_write_all(getattr(sys.stdout, 'buffer', sys.stdout))
 if sys.stderr is None:
 stderr = BadFile()
 else:
-stderr = _make_write_all(sys.stderr.buffer)
+stderr = _make_write_all(getattr(sys.stderr, 'buffer', sys.stderr))
 
 if pycompat.iswindows:
 # Work around Windows bugs.



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12555: procutil: avoid `+= None` when writing to full std{err, out} descriptor on py3

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The write function returns `None` if there was no room to write the given
  data[1].  I don't like that this is effectively an infinite loop if there's
  never any progress emptying the underlying buffer, but we're no worse off than
  before, and it fixes random stacktrace popups seen in the py3 build of
  TortoiseHg.
  
  [1] https://docs.python.org/3/library/io.html#io.RawIOBase.write

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12555

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -111,7 +111,9 @@
 total_to_write = len(s)
 total_written = 0
 while total_written < total_to_write:
-total_written += write1(m[total_written:])
+c = write1(m[total_written:])
+if c:
+total_written += c
 return total_written
 
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12553: setup: fix the py2exe logic to work with py3

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  TortoiseHg still uses (the modernized) py2exe packaging, but the build was
  failing since `py2exe.Distribution` was removed.
  
  One thing to note is that later in this module, there's a hack to include
  `distutils` when building from a virtualenv.  While `import distutils` works 
in
  `hg debugshell` when built with py2, it doesn't work in py3.  I'm not sure 
why-
  I don't see it in `library.zip` either.  It doesn't seem to break anything
  though.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12553

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -197,7 +197,7 @@
 try:
 import py2exe
 
-py2exe.Distribution  # silence unused import warning
+py2exe.patch_distutils()
 py2exeloaded = True
 # import py2exe's patched Distribution class
 from distutils.core import Distribution



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12554: resourceutil: force filesystem access to resources when using py2exe

2022-04-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I don't know why it doesn't work, but it avoids this fatal error on startup:
  
> hg debugshell
Traceback (most recent call last):
  File "hg", line 58, in 
  File "mercurial\dispatch.pyc", line 143, in run
  File "mercurial\dispatch.pyc", line 232, in dispatch
  File "mercurial\dispatch.pyc", line 254, in _rundispatch
  File "mercurial\ui.pyc", line 316, in load
  File "mercurial\rcutil.pyc", line 98, in rccomponents
  File "mercurial\rcutil.pyc", line 68, in default_rc_resources
  File "mercurial\utils\resourceutil.pyc", line 102, in contents
  File "", line 775, in contents
AssertionError
  
  I assume the py2 version of py2exe never hit this because 
`importlib.resources`
  failed to import.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12554

AFFECTED FILES
  mercurial/utils/resourceutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py
--- a/mercurial/utils/resourceutil.py
+++ b/mercurial/utils/resourceutil.py
@@ -61,6 +61,10 @@
 # Force loading of the resources module
 resources.open_binary  # pytype: disable=module-attr
 
+# py2exe raises an AssertionError if uses importlib.resources
+if getattr(sys, "frozen", None) in ("console_exe", "windows_exe"):
+raise ImportError
+
 except (ImportError, AttributeError):
 # importlib.resources was not found (almost definitely because we're on a
 # Python version before 3.7)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12421: util: drop a duplicate import

2022-03-29 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was already imported several lines above.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12421

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -42,7 +42,6 @@
 open,
 setattr,
 )
-from .node import hex
 from hgdemandimport import tracing
 from . import (
 encoding,



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12423: tests: stop excluding the pycompat module from pyflakes

2022-03-29 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I assume this was skipped because of all of the py2 stuff causing a lot of 
spew.
  The "unused" imports are left in place in case any 3rd party stuff is using 
it.
  I don't care about most of it, but TortoiseHg uses `io` and `queue`, so
  minimally I'd like to keep those.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12423

AFFECTED FILES
  tests/test-check-pyflakes.t

CHANGE DETAILS

diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t
--- a/tests/test-check-pyflakes.t
+++ b/tests/test-check-pyflakes.t
@@ -15,11 +15,19 @@
 
   $ testrepohg locate 'set:**.py or grep("^#!.*python")' \
   > -X hgext/fsmonitor/pywatchman \
-  > -X mercurial/pycompat.py -X contrib/python-zstandard \
+  > -X contrib/python-zstandard \
   > -X mercurial/thirdparty \
   > 2>/dev/null \
   > | xargs "$PYTHON" -m pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
   contrib/perf.py:*:* undefined name 'xrange' (glob) (?)
   mercurial/hgweb/server.py:*:* undefined name 'reload' (glob) (?)
+  mercurial/pycompat.py:*:* 'codecs' imported but unused (glob)
+  mercurial/pycompat.py:*:* 'concurrent.futures' imported but unused (glob)
+  mercurial/pycompat.py:*:* 'http.client as httplib' imported but unused (glob)
+  mercurial/pycompat.py:*:* 'http.cookiejar as cookielib' imported but unused 
(glob)
+  mercurial/pycompat.py:*:* 'io' imported but unused (glob)
+  mercurial/pycompat.py:*:* 'queue' imported but unused (glob)
+  mercurial/pycompat.py:*:* 'socketserver' imported but unused (glob)
+  mercurial/pycompat.py:*:* 'xmlrpc.client as xmlrpclib' imported but unused 
(glob)
   mercurial/util.py:*:* 'pickle' imported but unused (glob)
   



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12419: util: restore the util.pickle symbol

2022-03-29 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This was accidently dropped in df56e6bd37f6 
, 
which started importing pickle
  directly.  That commit explicitly says it will retain it for compatibility 
with
  external stuff though.
  
  The unused import in pycompat isn't flagged because that module is skipped.
  Just importing with a comment seemed cleaner than `import X as Y` and then
  assigning to a `pickle` variable, just to avoid the pyflakes warning.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12419

AFFECTED FILES
  mercurial/util.py
  tests/test-check-pyflakes.t

CHANGE DETAILS

diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t
--- a/tests/test-check-pyflakes.t
+++ b/tests/test-check-pyflakes.t
@@ -24,4 +24,5 @@
   mercurial/util.py:*:* undefined name 'file' (glob) (?)
   mercurial/encoding.py:*:* undefined name 'localstr' (glob) (?)
   tests/run-tests.py:*:* undefined name 'PermissionError' (glob) (?)
+  mercurial/util.py:*:* 'pickle' imported but unused (glob)
   
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -25,6 +25,7 @@
 import locale
 import mmap
 import os
+import pickle  # provides util.pickle symbol
 import re as remod
 import shutil
 import stat



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12422: tests: drop some py2 specific pyflake failures

2022-03-29 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12422

AFFECTED FILES
  tests/test-check-pyflakes.t

CHANGE DETAILS

diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t
--- a/tests/test-check-pyflakes.t
+++ b/tests/test-check-pyflakes.t
@@ -21,8 +21,5 @@
   > | xargs "$PYTHON" -m pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
   contrib/perf.py:*:* undefined name 'xrange' (glob) (?)
   mercurial/hgweb/server.py:*:* undefined name 'reload' (glob) (?)
-  mercurial/util.py:*:* undefined name 'file' (glob) (?)
-  mercurial/encoding.py:*:* undefined name 'localstr' (glob) (?)
-  tests/run-tests.py:*:* undefined name 'PermissionError' (glob) (?)
   mercurial/util.py:*:* 'pickle' imported but unused (glob)
   



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12420: pycompat: drop the pickle import

2022-03-29 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I suspect this is what df56e6bd37f6 
 
meant to eliminate.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12420

AFFECTED FILES
  mercurial/pycompat.py

CHANGE DETAILS

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -20,7 +20,6 @@
 import io
 import json
 import os
-import pickle
 import queue
 import shlex
 import socketserver



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12401: pytype: disable a few errors about Windows specific module attributes

2022-03-24 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  These were flagged by pytype 2022.03.21.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12401

AFFECTED FILES
  mercurial/scmwindows.py
  mercurial/windows.py

CHANGE DETAILS

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -676,14 +676,21 @@
 LOCAL_MACHINE).
 """
 if scope is None:
+# pytype: disable=module-attr
 scope = (winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE)
+# pytype: enable=module-attr
 elif not isinstance(scope, (list, tuple)):
 scope = (scope,)
 for s in scope:
 try:
+# pytype: disable=module-attr
 with winreg.OpenKey(s, encoding.strfromlocal(key)) as hkey:
+# pytype: enable=module-attr
 name = valname and encoding.strfromlocal(valname) or valname
+# pytype: disable=module-attr
 val = winreg.QueryValueEx(hkey, name)[0]
+# pytype: enable=module-attr
+
 # never let a Unicode string escape into the wild
 return encoding.unitolocal(val)
 except EnvironmentError:
diff --git a/mercurial/scmwindows.py b/mercurial/scmwindows.py
--- a/mercurial/scmwindows.py
+++ b/mercurial/scmwindows.py
@@ -52,7 +52,11 @@
 
 # next look for a system rcpath in the registry
 value = util.lookupreg(
-b'SOFTWARE\\Mercurial', None, winreg.HKEY_LOCAL_MACHINE
+# pytype: disable=module-attr
+b'SOFTWARE\\Mercurial',
+None,
+winreg.HKEY_LOCAL_MACHINE
+# pytype: enable=module-attr
 )
 if value and isinstance(value, bytes):
 value = util.localpath(value)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D12400: pytype: drop py3.6 support

2022-03-24 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Pytype 2022.01.07 only supports 3.7+.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12400

AFFECTED FILES
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -30,7 +30,6 @@
 mercurial/testing/storage.py  # tons of [attribute-error]
 mercurial/ui.py   # [attribute-error], [wrong-arg-types]
 mercurial/unionrepo.py# ui, svfs, unfiltered [attribute-error]
-mercurial/utils/memorytop.py  # not 3.6 compatible
 mercurial/win32.py# [not-callable]
 mercurial/wireprotoframing.py # [unsupported-operands], [attribute-error], 
[import-error]
 mercurial/wireprotov1peer.py  # [attribute-error]
@@ -39,7 +38,7 @@
 TODO: use --no-cache on test server?  Caching the files locally helps during
 development, but may be a hinderance for CI testing.
 
-  $ pytype -V 3.6 --keep-going --jobs auto mercurial \
+  $ pytype -V 3.7 --keep-going --jobs auto mercurial \
   >-x mercurial/bundlerepo.py \
   >-x mercurial/context.py \
   >-x mercurial/crecord.py \
@@ -62,7 +61,6 @@
   >-x mercurial/thirdparty \
   >-x mercurial/ui.py \
   >-x mercurial/unionrepo.py \
-  >-x mercurial/utils/memorytop.py \
   >-x mercurial/win32.py \
   >-x mercurial/wireprotoframing.py \
   >-x mercurial/wireprotov1peer.py \



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11971: subrepo: make -S work again on Windows for incoming/outgoing to remote repos

2022-01-10 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  While it worked fine for the top level repo, the remote path for the subrepo 
got
  mangled to something like "https://server/prefix\repo\subrepo";, which I've 
seen
  result in both a 400 and a 404, depending on the server.  We need to 
`normpath`
  at least the `subpath` because of 
"http://user:***@localhost:$HGPORT/main/../sub";
  in `test-subrepo-relative-path.t`.  Keep the `os.path` flavor for handling
  filesystem based remote repos, since this string is also displayed.
  
  This is one case where the automatic substitution of '\' for '/' and 
rematching
  done by the test runner is unfortunate- I don't see how to write a test to 
catch
  this.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11971

AFFECTED FILES
  mercurial/hg.py

CHANGE DETAILS

diff --git a/mercurial/hg.py b/mercurial/hg.py
--- a/mercurial/hg.py
+++ b/mercurial/hg.py
@@ -10,6 +10,7 @@
 
 import errno
 import os
+import posixpath
 import shutil
 import stat
 import weakref
@@ -1292,7 +1293,11 @@
 source = bytes(subpath)
 else:
 p = urlutil.url(source)
-p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
+if p.islocal():
+normpath = os.path.normpath
+else:
+normpath = posixpath.normpath
+p.path = normpath(b'%s/%s' % (p.path, subpath))
 source = bytes(p)
 other = peer(repo, opts, source)
 cleanupfn = other.close
@@ -1363,7 +1368,11 @@
 dest = bytes(subpath)
 else:
 p = urlutil.url(dest)
-p.path = os.path.normpath(b'%s/%s' % (p.path, subpath))
+if p.islocal():
+normpath = os.path.normpath
+else:
+normpath = posixpath.normpath
+p.path = normpath(b'%s/%s' % (p.path, subpath))
 dest = bytes(p)
 branches = path.branch, opts.get(b'branch') or []
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11944: setup.py: fix some documentation typos

2021-12-18 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11944

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -209,7 +209,7 @@
 from distutils.sysconfig import get_python_inc, get_config_var
 from distutils.version import StrictVersion
 
-# Explain to distutils.StrictVersion how our release candidates are versionned
+# Explain to distutils.StrictVersion how our release candidates are versioned
 StrictVersion.version_re = re.compile(r'^(\d+)\.(\d+)(\.(\d+))?-?(rc(\d+))?$')
 
 
@@ -597,8 +597,8 @@
 e for e in self.extensions if e.name != 'mercurial.zstd'
 ]
 
-# Build Rust standalon extensions if it'll be used
-# and its build is not explictely disabled (for external build
+# Build Rust standalone extensions if it'll be used
+# and its build is not explicitly disabled (for external build
 # as Linux distributions would do)
 if self.distribution.rust and self.rust:
 if not sys.platform.startswith('linux'):
@@ -1502,7 +1502,7 @@
 raise RustCompilationError("Cargo not found")
 elif exc.errno == errno.EACCES:
 raise RustCompilationError(
-"Cargo found, but permisssion to execute it is denied"
+"Cargo found, but permission to execute it is denied"
 )
 else:
 raise



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11931: pytype: stop excluding ssutil.py

2021-12-15 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Pytype simply can't distinguish the type for this one entry's value from the
  other values:
  
File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 142, in 
_hostsettings:
No attribute 'append' on None [attribute-error]
  In Optional[Union[Any, List[nothing], bool, bytes]]
File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 142, in 
_hostsettings:
No attribute 'append' on bool [attribute-error]
  In Optional[Union[Any, List[nothing], bool, bytes]]
File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 142, in 
_hostsettings:
No attribute 'append' on bytes [attribute-error]
  In Optional[Union[Any, List[nothing], bool, bytes]]
File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 147, in 
_hostsettings:
No attribute 'append' on None [attribute-error]
  In Optional[Union[Any, List[Tuple[Any, Any]], bool, bytes]]
File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 147, in 
_hostsettings:
No attribute 'append' on bool [attribute-error]
  In Optional[Union[Any, List[Tuple[Any, Any]], bool, bytes]]
File "/mnt/c/Users/Matt/hg/mercurial/sslutil.py", line 147, in 
_hostsettings:
No attribute 'append' on bytes [attribute-error]
  In Optional[Union[Any, List[Tuple[Any, Any]], bool, bytes]]

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11931

AFFECTED FILES
  mercurial/sslutil.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -27,7 +27,6 @@
 mercurial/pure/osutil.py  # [invalid-typevar], [not-callable]
 mercurial/pure/parsers.py # [attribute-error]
 mercurial/repoview.py # [attribute-error]
-mercurial/sslutil.py  # [attribute-error]
 mercurial/testing/storage.py  # tons of [attribute-error]
 mercurial/ui.py   # [attribute-error], [wrong-arg-types]
 mercurial/unionrepo.py# ui, svfs, unfiltered [attribute-error]
@@ -59,7 +58,6 @@
   >-x mercurial/pure/osutil.py \
   >-x mercurial/pure/parsers.py \
   >-x mercurial/repoview.py \
-  >-x mercurial/sslutil.py \
   >-x mercurial/testing/storage.py \
   >-x mercurial/thirdparty \
   >-x mercurial/ui.py \
diff --git a/mercurial/sslutil.py b/mercurial/sslutil.py
--- a/mercurial/sslutil.py
+++ b/mercurial/sslutil.py
@@ -139,12 +139,18 @@
 
 alg, fingerprint = fingerprint.split(b':', 1)
 fingerprint = fingerprint.replace(b':', b'').lower()
+# pytype: disable=attribute-error
+# `s` is heterogeneous, but this entry is always a list of tuples
 s[b'certfingerprints'].append((alg, fingerprint))
+# pytype: enable=attribute-error
 
 # Fingerprints from [hostfingerprints] are always SHA-1.
 for fingerprint in ui.configlist(b'hostfingerprints', bhostname):
 fingerprint = fingerprint.replace(b':', b'').lower()
+# pytype: disable=attribute-error
+# `s` is heterogeneous, but this entry is always a list of tuples
 s[b'certfingerprints'].append((b'sha1', fingerprint))
+# pytype: enable=attribute-error
 s[b'legacyfingerprint'] = True
 
 # If a host cert fingerprint is defined, it is the only thing that



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11930: pytype: stop excluding wireprotoserver.py

2021-12-15 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The `config` entry is a 2 part tuple, which has `__iter__()`:
  
File "/mnt/c/Users/Matt/hg/mercurial/wireprotoserver.py", line 253, in 
_availableapis:
No attribute '__iter__' on Callable[[Any, Any], Any] [attribute-error]
  In Union[Callable[[Any, Any, Any, Any, Any], None], Callable[[Any, Any], 
Any]]
File "/mnt/c/Users/Matt/hg/mercurial/wireprotoserver.py", line 253, in 
_availableapis:
No attribute '__iter__' on Callable[[Any, Any, Any, Any, Any], None] 
[attribute-error]
  In Union[Callable[[Any, Any, Any, Any, Any], None], Callable[[Any, Any], 
Any]]

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11930

AFFECTED FILES
  mercurial/wireprotoserver.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -34,7 +34,6 @@
 mercurial/utils/memorytop.py  # not 3.6 compatible
 mercurial/win32.py# [not-callable]
 mercurial/wireprotoframing.py # [unsupported-operands], [attribute-error], 
[import-error]
-mercurial/wireprotoserver.py  # line 253, in _availableapis: No attribute 
'__iter__' on Callable[[Any, Any], Any] [attribute-error]
 mercurial/wireprotov1peer.py  # [attribute-error]
 mercurial/wireprotov1server.py  # BUG?: BundleValueError handler accesses 
subclass's attrs
 
@@ -68,7 +67,6 @@
   >-x mercurial/utils/memorytop.py \
   >-x mercurial/win32.py \
   >-x mercurial/wireprotoframing.py \
-  >-x mercurial/wireprotoserver.py \
   >-x mercurial/wireprotov1peer.py \
   >-x mercurial/wireprotov1server.py \
   >  > $TESTTMP/pytype-output.txt || cat $TESTTMP/pytype-output.txt
diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py
+++ b/mercurial/wireprotoserver.py
@@ -250,7 +250,7 @@
 # Registered APIs are made available via config options of the name of
 # the protocol.
 for k, v in API_HANDLERS.items():
-section, option = v[b'config']
+section, option = v[b'config']  # pytype: disable=attribute-error
 if repo.ui.configbool(section, option):
 apis.add(k)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11929: pytype: stop excluding pycompat.py

2021-12-15 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Whatever issues were here seem to have been previously fixed.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11929

AFFECTED FILES
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -26,7 +26,6 @@
 mercurial/minirst.py  # [unsupported-operands], [attribute-error]
 mercurial/pure/osutil.py  # [invalid-typevar], [not-callable]
 mercurial/pure/parsers.py # [attribute-error]
-mercurial/pycompat.py # bytes vs str issues
 mercurial/repoview.py # [attribute-error]
 mercurial/sslutil.py  # [attribute-error]
 mercurial/testing/storage.py  # tons of [attribute-error]
@@ -60,7 +59,6 @@
   >-x mercurial/minirst.py \
   >-x mercurial/pure/osutil.py \
   >-x mercurial/pure/parsers.py \
-  >-x mercurial/pycompat.py \
   >-x mercurial/repoview.py \
   >-x mercurial/sslutil.py \
   >-x mercurial/testing/storage.py \



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11927: pytype: stop excluding procutil.py

2021-12-15 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This avoids these false warnings:
  
File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 78, in 
:
No attribute 'register' on Type[io.BufferedIOBase] [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 117, in 
:
No attribute 'register' on Type[io.IOBase] [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/utils/procutil.py", line 770, in 
runbgcommandpy3:
No attribute 'close' on int [attribute-error]
  In Union[IO[Union[bytes, str]], int]

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11927

AFFECTED FILES
  mercurial/utils/procutil.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -32,7 +32,6 @@
 mercurial/testing/storage.py  # tons of [attribute-error]
 mercurial/ui.py   # [attribute-error], [wrong-arg-types]
 mercurial/unionrepo.py# ui, svfs, unfiltered [attribute-error]
-mercurial/utils/procutil.py   # [attribute-error], [module-attr], 
[bad-return-type]
 mercurial/utils/memorytop.py  # not 3.6 compatible
 mercurial/win32.py# [not-callable]
 mercurial/wireprotoframing.py # [unsupported-operands], [attribute-error], 
[import-error]
@@ -68,7 +67,6 @@
   >-x mercurial/thirdparty \
   >-x mercurial/ui.py \
   >-x mercurial/unionrepo.py \
-  >-x mercurial/utils/procutil.py \
   >-x mercurial/utils/memorytop.py \
   >-x mercurial/win32.py \
   >-x mercurial/wireprotoframing.py \
diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -75,7 +75,9 @@
 return res
 
 
+# pytype: disable=attribute-error
 io.BufferedIOBase.register(LineBufferedWrapper)
+# pytype: enable=attribute-error
 
 
 def make_line_buffered(stream):
@@ -114,7 +116,9 @@
 return total_written
 
 
+# pytype: disable=attribute-error
 io.IOBase.register(WriteAllWrapper)
+# pytype: enable=attribute-error
 
 
 def _make_write_all(stream):
@@ -767,6 +771,7 @@
 raise
 finally:
 if stdin_bytes is not None:
+assert not isinstance(stdin, int)
 stdin.close()
 if not ensurestart:
 # Even though we're not waiting on the child process,



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11928: procutil: avoid an uninitialized variable usage on tempfile exception

2021-12-15 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If `pycompat.unnamedtempfile()` raises an exception, it would have called
  `stdin.close()` in the `finally` block without it being initialized first.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11928

AFFECTED FILES
  mercurial/utils/procutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -742,6 +742,8 @@
 start_new_session = False
 ensurestart = True
 
+stdin = None
+
 try:
 if stdin_bytes is None:
 stdin = subprocess.DEVNULL
@@ -770,7 +772,7 @@
 record_wait(255)
 raise
 finally:
-if stdin_bytes is not None:
+if stdin_bytes is not None and stdin is not None:
 assert not isinstance(stdin, int)
 stdin.close()
 if not ensurestart:
@@ -852,6 +854,8 @@
 return
 
 returncode = 255
+stdin = None
+
 try:
 if record_wait is None:
 # Start a new session
@@ -894,7 +898,8 @@
 finally:
 # mission accomplished, this child needs to exit and not
 # continue the hg process here.
-stdin.close()
+if stdin is not None:
+stdin.close()
 if record_wait is None:
 os._exit(returncode)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11926: pytype: stop excluding chgserver.py

2021-12-15 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This teaches pytype about some lazy initialization, and avoids the following:
  
File "/mnt/c/Users/Matt/hg/mercurial/chgserver.py", line 666, in 
_checkextensions:
No attribute '_hashstate' on chgunixservicehandler [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/chgserver.py", line 672, in 
_checkextensions:
No attribute '_hashstate' on chgunixservicehandler [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/chgserver.py", line 677, in _bind:
No attribute '_realaddress' on chgunixservicehandler [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/chgserver.py", line 683, in _bind:
No attribute '_realaddress' on chgunixservicehandler [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/chgserver.py", line 686, in 
_createsymlink:
No attribute '_baseaddress' on chgunixservicehandler [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/chgserver.py", line 686, in 
_createsymlink:
No attribute '_realaddress' on chgunixservicehandler [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/chgserver.py", line 688, in 
_createsymlink:
No attribute '_baseaddress' on chgunixservicehandler [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/chgserver.py", line 689, in 
_createsymlink:
No attribute '_realaddress' on chgunixservicehandler [attribute-error]
File "/mnt/c/Users/Matt/hg/mercurial/chgserver.py", line 690, in 
_createsymlink:
No attribute '_baseaddress' on chgunixservicehandler [attribute-error]

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11926

AFFECTED FILES
  mercurial/chgserver.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -10,7 +10,6 @@
 probably hiding real problems.
 
 mercurial/bundlerepo.py   # no vfs and ui attrs on bundlerepo
-mercurial/chgserver.py# [attribute-error]
 mercurial/context.py  # many [attribute-error]
 mercurial/crecord.py  # tons of [attribute-error], [module-attr]
 mercurial/debugcommands.py# [wrong-arg-types]
@@ -46,7 +45,6 @@
 
   $ pytype -V 3.6 --keep-going --jobs auto mercurial \
   >-x mercurial/bundlerepo.py \
-  >-x mercurial/chgserver.py \
   >-x mercurial/context.py \
   >-x mercurial/crecord.py \
   >-x mercurial/debugcommands.py \
diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -643,6 +643,13 @@
 
 def __init__(self, ui):
 self.ui = ui
+
+# TODO: use PEP 526 syntax (`_hashstate: hashstate` at the class level)
+#  when 3.5 support is dropped.
+self._hashstate = None  # type: hashstate
+self._baseaddress = None  # type: bytes
+self._realaddress = None  # type: bytes
+
 self._idletimeout = ui.configint(b'chgserver', b'idletimeout')
 self._lastactive = time.time()
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11922: pytype: stop excluding patch.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The underlying `email.generator.BytesGenerator` is documented as requiring an
  `fp` that accepts bytes, so I'm not sure why pytype is getting confused:
  
File "/mnt/c/Users/Matt/hg/mercurial/patch.py", line 112, in msgfp:
Function Generator.__init__ was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, outfp: TextIO, ...)
  Actually passed: (self, outfp: io.BytesIO, ...)

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11922

AFFECTED FILES
  mercurial/patch.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -26,7 +26,6 @@
 mercurial/localrepo.py# [attribute-error]
 mercurial/manifest.py # [unsupported-operands], [wrong-arg-types]
 mercurial/minirst.py  # [unsupported-operands], [attribute-error]
-mercurial/patch.py# [wrong-arg-types]
 mercurial/pure/osutil.py  # [invalid-typevar], [not-callable]
 mercurial/pure/parsers.py # [attribute-error]
 mercurial/pycompat.py # bytes vs str issues
@@ -65,7 +64,6 @@
   >-x mercurial/localrepo.py \
   >-x mercurial/manifest.py \
   >-x mercurial/minirst.py \
-  >-x mercurial/patch.py \
   >-x mercurial/pure/osutil.py \
   >-x mercurial/pure/parsers.py \
   >-x mercurial/pycompat.py \
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -109,7 +109,9 @@
 def mimesplit(stream, cur):
 def msgfp(m):
 fp = stringio()
+# pytype: disable=wrong-arg-types
 g = mail.Generator(fp, mangle_from_=False)
+# pytype: enable=wrong-arg-types
 g.flatten(m)
 fp.seek(0)
 return fp



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11924: pytype: stop excluding webcommands.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I have no idea why, but asserting that each value added to `emptydirs` is not
  None didn't fix this:
  
File "/mnt/c/Users/Matt/hg/mercurial/hgweb/webcommands.py", line 621, in 
dirlist:
Function bytes.join was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, iterable: Iterable[bytes])
  Actually passed: (self, iterable: List[None])

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11924

AFFECTED FILES
  mercurial/hgweb/webcommands.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -18,7 +18,6 @@
 mercurial/exchange.py # [attribute-error]
 mercurial/hgweb/hgweb_mod.py  # [attribute-error], [name-error], 
[wrong-arg-types]
 mercurial/hgweb/server.py # [attribute-error], [name-error], [module-attr]
-mercurial/hgweb/webcommands.py  # [missing-parameter]
 mercurial/hgweb/wsgicgi.py# confused values in os.environ
 mercurial/httppeer.py # [attribute-error], [wrong-arg-types]
 mercurial/interfaces  # No attribute 'capabilities' on peer 
[attribute-error]
@@ -55,7 +54,6 @@
   >-x mercurial/exchange.py \
   >-x mercurial/hgweb/hgweb_mod.py \
   >-x mercurial/hgweb/server.py \
-  >-x mercurial/hgweb/webcommands.py \
   >-x mercurial/hgweb/wsgicgi.py \
   >-x mercurial/httppeer.py \
   >-x mercurial/interfaces \
diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -519,6 +519,7 @@
 
 
 def decodepath(path):
+# type: (bytes) -> bytes
 """Hook for mapping a path in the repository to a path in the
 working copy.
 
@@ -616,7 +617,9 @@
 yield {
 b"parity": next(parity),
 b"path": path,
+# pytype: disable=wrong-arg-types
 b"emptydirs": b"/".join(emptydirs),
+# pytype: enable=wrong-arg-types
 b"basename": d,
 }
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11921: pytype: stop excluding statprof.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This seems to have worked fine before (at least on Linux).  We could just add
  suppression comments, but this file already imports from the mercurial 
package,
  which seems to prevent this from running as a standalone program because of 
the
  relative import of `pycompat`.  PyCharm isn't happy either way.
  
File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 501, in display:
Function TextIO.write was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, s: str)
  Actually passed: (self, s: bytes)
Called from (traceback):
  line 1091, in main
File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 501, in display:
Function TextIO.write was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, s: str)
  Actually passed: (self, s: bytes)
Called from (traceback):
  line 431, in profile
File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 522, in display:
Function TextIO.write was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, s: str)
  Actually passed: (self, s: bytes)
Called from (traceback):
  line 1091, in main
File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 522, in display:
Function TextIO.write was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, s: str)
  Actually passed: (self, s: bytes)
Called from (traceback):
  line 431, in profile
File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 523, in display:
Function TextIO.write was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, s: str)
  Actually passed: (self, s: bytes)
Called from (traceback):
  line 1091, in main
File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 523, in display:
Function TextIO.write was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, s: str)
  Actually passed: (self, s: bytes)
Called from (traceback):
  line 431, in profile
File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 524, in display:
Function TextIO.write was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, s: str)
  Actually passed: (self, s: bytes)
Called from (traceback):
  line 1091, in main
File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 524, in display:
Function TextIO.write was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, s: str)
  Actually passed: (self, s: bytes)
Called from (traceback):
  line 431, in profile
File "/mnt/c/Users/Matt/hg/mercurial/statprof.py", line 796, in _write:
Function TextIO.write was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, s: str)
  Actually passed: (self, s: bytes)

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11921

AFFECTED FILES
  mercurial/statprof.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -32,7 +32,6 @@
 mercurial/pycompat.py # bytes vs str issues
 mercurial/repoview.py # [attribute-error]
 mercurial/sslutil.py  # [attribute-error]
-mercurial/statprof.py # bytes vs str on TextIO.write() 
[wrong-arg-types]
 mercurial/testing/storage.py  # tons of [attribute-error]
 mercurial/ui.py   # [attribute-error], [wrong-arg-types]
 mercurial/unionrepo.py# ui, svfs, unfiltered [attribute-error]
@@ -72,7 +71,6 @@
   >-x mercurial/pycompat.py \
   >-x mercurial/repoview.py \
   >-x mercurial/sslutil.py \
-  >-x mercurial/statprof.py \
   >-x mercurial/testing/storage.py \
   >-x mercurial/thirdparty \
   >-x mercurial/ui.py \
diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -494,9 +494,9 @@
 data = state
 
 if fp is None:
-import sys
+from .utils import procutil
 
-fp = sys.stdout
+fp = procutil.stdout
 if len(data.samples) == 0:
 fp.write(b'No samples recorded.\n')
 return



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11923: tests: drop an obsolete comment about a pytype failure

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11923

AFFECTED FILES
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -34,7 +34,6 @@
 mercurial/testing/storage.py  # tons of [attribute-error]
 mercurial/ui.py   # [attribute-error], [wrong-arg-types]
 mercurial/unionrepo.py# ui, svfs, unfiltered [attribute-error]
-mercurial/util.py # [attribute-error], [wrong-arg-count]
 mercurial/utils/procutil.py   # [attribute-error], [module-attr], 
[bad-return-type]
 mercurial/utils/memorytop.py  # not 3.6 compatible
 mercurial/win32.py# [not-callable]



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11919: pytype: stop excluding wireprotov2server.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This fixes:
  
File "/mnt/c/Users/Matt/hg/mercurial/wireprotov2server.py", line 584, in 
_capabilitiesv2:
unsupported operand type(s) for item assignment: Set[bytes] 
[unsupported-operands]
  No attribute '__setitem__' on Set[bytes]
File "/mnt/c/Users/Matt/hg/mercurial/wireprotov2server.py", line 611, in 
_capabilitiesv2:
No attribute 'append' on dict [attribute-error]
  In Union[List[bytes], List[nothing], dict]
Called from (traceback):
  line 543, in httpv2apidescriptor

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11919

AFFECTED FILES
  mercurial/wireprotov2server.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -44,7 +44,6 @@
 mercurial/wireprotoserver.py  # line 253, in _availableapis: No attribute 
'__iter__' on Callable[[Any, Any], Any] [attribute-error]
 mercurial/wireprotov1peer.py  # [attribute-error]
 mercurial/wireprotov1server.py  # BUG?: BundleValueError handler accesses 
subclass's attrs
-mercurial/wireprotov2server.py  # [unsupported-operands], [attribute-error]
 
 TODO: use --no-cache on test server?  Caching the files locally helps during
 development, but may be a hinderance for CI testing.
@@ -85,7 +84,6 @@
   >-x mercurial/wireprotoserver.py \
   >-x mercurial/wireprotov1peer.py \
   >-x mercurial/wireprotov1server.py \
-  >-x mercurial/wireprotov2server.py \
   >  > $TESTTMP/pytype-output.txt || cat $TESTTMP/pytype-output.txt
 
 Only show the results on a failure, because the output on success is also
diff --git a/mercurial/wireprotov2server.py b/mercurial/wireprotov2server.py
--- a/mercurial/wireprotov2server.py
+++ b/mercurial/wireprotov2server.py
@@ -579,10 +579,12 @@
 ):
 continue
 
+# pytype: disable=unsupported-operands
 caps[b'commands'][command] = {
 b'args': args,
 b'permissions': [entry.permission],
 }
+# pytype: enable=unsupported-operands
 
 if entry.extracapabilitiesfn:
 extracaps = entry.extracapabilitiesfn(repo, proto)
@@ -608,7 +610,9 @@
 if key in target:
 entry[key] = target[key]
 
+# pytype: disable=attribute-error
 caps[b'redirect'][b'targets'].append(entry)
+# pytype: enable=attribute-error
 
 return proto.addcapabilities(repo, caps)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11920: statprof: convert a few exception byte strings to str

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  That way these display without the b'' prefix.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11920

AFFECTED FILES
  mercurial/statprof.py

CHANGE DETAILS

diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -516,7 +516,7 @@
 elif format == DisplayFormats.Chrome:
 write_to_chrome(data, fp, **kwargs)
 else:
-raise Exception(b"Invalid display format")
+raise Exception("Invalid display format")
 
 if format not in (DisplayFormats.Json, DisplayFormats.Chrome):
 fp.write(b'---\n')
@@ -625,7 +625,7 @@
 
 def display_about_method(data, fp, function=None, **kwargs):
 if function is None:
-raise Exception(b"Invalid function")
+raise Exception("Invalid function")
 
 filename = None
 if b':' in function:
@@ -1080,7 +1080,7 @@
 printusage()
 return 0
 else:
-assert False, b"unhandled option %s" % o
+assert False, "unhandled option %s" % o
 
 if not path:
 print('must specify --file to load')



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11918: pytype: stop excluding stringutil.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This fixes the following:
  
File "/mnt/c/Users/Matt/hg/mercurial/utils/stringutil.py", line 267, in 
prettyrepr:
Function bytes.startswith expects 2 arg(s), got 3 [wrong-arg-count]
 Expected: (self, prefix)
  Actually passed: (self, prefix, _)
File "/mnt/c/Users/Matt/hg/mercurial/utils/stringutil.py", line 695, in 
escapestr:
No attribute 'escape_encode' on module 'codecs' [module-attr]
File "/mnt/c/Users/Matt/hg/mercurial/utils/stringutil.py", line 699, in 
unescapestr:
No attribute 'escape_decode' on module 'codecs' [module-attr]

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11918

AFFECTED FILES
  mercurial/utils/stringutil.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -38,7 +38,6 @@
 mercurial/unionrepo.py# ui, svfs, unfiltered [attribute-error]
 mercurial/util.py # [attribute-error], [wrong-arg-count]
 mercurial/utils/procutil.py   # [attribute-error], [module-attr], 
[bad-return-type]
-mercurial/utils/stringutil.py # [module-attr], [wrong-arg-count]
 mercurial/utils/memorytop.py  # not 3.6 compatible
 mercurial/win32.py# [not-callable]
 mercurial/wireprotoframing.py # [unsupported-operands], [attribute-error], 
[import-error]
@@ -80,7 +79,6 @@
   >-x mercurial/ui.py \
   >-x mercurial/unionrepo.py \
   >-x mercurial/utils/procutil.py \
-  >-x mercurial/utils/stringutil.py \
   >-x mercurial/utils/memorytop.py \
   >-x mercurial/win32.py \
   >-x mercurial/wireprotoframing.py \
diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py
--- a/mercurial/utils/stringutil.py
+++ b/mercurial/utils/stringutil.py
@@ -264,7 +264,11 @@
 q1 = rs.find(b'<', p1 + 1)
 if q1 < 0:
 q1 = len(rs)
+# pytype: disable=wrong-arg-count
+# TODO: figure out why pytype doesn't recognize the optional start
+#  arg
 elif q1 > p1 + 1 and rs.startswith(b'=', q1 - 1):
+# pytype: enable=wrong-arg-count
 # backtrack for ' field=<'
 q0 = rs.rfind(b' ', p1 + 1, q1 - 1)
 if q0 < 0:
@@ -692,11 +696,11 @@
 s = bytes(s)
 # call underlying function of s.encode('string_escape') directly for
 # Python 3 compatibility
-return codecs.escape_encode(s)[0]
+return codecs.escape_encode(s)[0]  # pytype: disable=module-attr
 
 
 def unescapestr(s):
-return codecs.escape_decode(s)[0]
+return codecs.escape_decode(s)[0]  # pytype: disable=module-attr
 
 
 def forcebytestr(obj):



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11916: pytype: stop excluding copies.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I can't prove that `targetrev` is always in `all_copies`, but it would have 
been
  a runtime error before too if it's not.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11916

AFFECTED FILES
  mercurial/copies.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -13,7 +13,6 @@
 mercurial/chgserver.py# [attribute-error]
 mercurial/cmdutil.py  # No attribute 'markcopied' on 
mercurial.context.filectx [attribute-error]
 mercurial/context.py  # many [attribute-error]
-mercurial/copies.py   # No attribute 'items' on None [attribute-error]
 mercurial/crecord.py  # tons of [attribute-error], [module-attr]
 mercurial/debugcommands.py# [wrong-arg-types]
 mercurial/dispatch.py # initstdio: No attribute ... on TextIO 
[attribute-error]
@@ -57,7 +56,6 @@
   >-x mercurial/chgserver.py \
   >-x mercurial/cmdutil.py \
   >-x mercurial/context.py \
-  >-x mercurial/copies.py \
   >-x mercurial/crecord.py \
   >-x mercurial/debugcommands.py \
   >-x mercurial/dispatch.py \
diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -448,7 +448,11 @@
 
 # filter out internal details and return a {dest: source mapping}
 final_copies = {}
-for dest, (tt, source) in all_copies[targetrev].items():
+
+targetrev_items = all_copies[targetrev]
+assert targetrev_items is not None  # help pytype
+
+for dest, (tt, source) in targetrev_items.items():
 if source is not None:
 final_copies[dest] = source
 if not alwaysmatch:



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11917: pytype: stop excluding cmdutil.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Whatever was broken here seems to have been previously fixed.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11917

AFFECTED FILES
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -11,7 +11,6 @@
 
 mercurial/bundlerepo.py   # no vfs and ui attrs on bundlerepo
 mercurial/chgserver.py# [attribute-error]
-mercurial/cmdutil.py  # No attribute 'markcopied' on 
mercurial.context.filectx [attribute-error]
 mercurial/context.py  # many [attribute-error]
 mercurial/crecord.py  # tons of [attribute-error], [module-attr]
 mercurial/debugcommands.py# [wrong-arg-types]
@@ -54,7 +53,6 @@
   $ pytype -V 3.6 --keep-going --jobs auto mercurial \
   >-x mercurial/bundlerepo.py \
   >-x mercurial/chgserver.py \
-  >-x mercurial/cmdutil.py \
   >-x mercurial/context.py \
   >-x mercurial/crecord.py \
   >-x mercurial/debugcommands.py \



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11912: pytype: stop excluding changegroup.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The false positives that were detected seem to be related to what happens to 
the
  variables after the local methods are used:
  
File "/mnt/c/Users/Matt/hg/mercurial/changegroup.py", line 353, in 
ondupchangelog:
No attribute 'append' on range [attribute-error]
  In Union[List[nothing], range]
File "/mnt/c/Users/Matt/hg/mercurial/changegroup.py", line 357, in 
onchangelog:
No attribute 'update' on None [attribute-error]

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11912

AFFECTED FILES
  mercurial/changegroup.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -10,7 +10,6 @@
 probably hiding real problems.
 
 mercurial/bundlerepo.py   # no vfs and ui attrs on bundlerepo
-mercurial/changegroup.py  # mysterious incorrect type detection
 mercurial/chgserver.py# [attribute-error]
 mercurial/cmdutil.py  # No attribute 'markcopied' on 
mercurial.context.filectx [attribute-error]
 mercurial/context.py  # many [attribute-error]
@@ -56,7 +55,6 @@
 
   $ pytype -V 3.6 --keep-going --jobs auto mercurial \
   >-x mercurial/bundlerepo.py \
-  >-x mercurial/changegroup.py \
   >-x mercurial/chgserver.py \
   >-x mercurial/cmdutil.py \
   >-x mercurial/context.py \
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -354,6 +354,7 @@
 
 def onchangelog(cl, rev):
 ctx = cl.changelogrevision(rev)
+assert efilesset is not None  # help pytype
 efilesset.update(ctx.files)
 repo.register_changeset(rev, ctx)
 
@@ -531,12 +532,13 @@
 if added:
 phases.registernew(repo, tr, targetphase, added)
 if phaseall is not None:
-if duprevs:
-duprevs.extend(added)
+duplicates = duprevs
+if duplicates:
+duplicates.extend(added)
 else:
-duprevs = added
-phases.advanceboundary(repo, tr, phaseall, [], revs=duprevs)
-duprevs = []
+duplicates = added
+phases.advanceboundary(repo, tr, phaseall, [], revs=duplicates)
+duprevs = duplicates = []
 
 if changesets > 0:
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11915: copies: fix some documentation typos

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11915

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -289,7 +289,7 @@
 # no common revision to track copies from
 return {}
 if has_graph_roots:
-# this deal with the special case mentionned in the [1] footnotes. We
+# this deal with the special case mentioned in the [1] footnotes. We
 # must filter out revisions that leads to non-common graphroots.
 roots = list(roots)
 m = min(roots)
@@ -300,11 +300,11 @@
 
 if repo.filecopiesmode == b'changeset-sidedata':
 # When using side-data, we will process the edges "from" the children.
-# We iterate over the childre, gathering previous collected data for
+# We iterate over the children, gathering previous collected data for
 # the parents. Do know when the parents data is no longer necessary, we
 # keep a counter of how many children each revision has.
 #
-# An interresting property of `children_count` is that it only contains
+# An interesting property of `children_count` is that it only contains
 # revision that will be relevant for a edge of the graph. So if a
 # children has parent not in `children_count`, that edges should not be
 # processed.



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11914: copies: drop an unused variable

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11914

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -246,7 +246,6 @@
 return {}
 
 repo = a.repo().unfiltered()
-children = {}
 
 cl = repo.changelog
 isancestor = cl.isancestorrev



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11913: pytype: stop excluding lsprof.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Whatever was previously flagged in this file appears to have been fixed.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11913

AFFECTED FILES
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -26,7 +26,6 @@
 mercurial/interfaces  # No attribute 'capabilities' on peer 
[attribute-error]
 mercurial/keepalive.py# [attribute-error]
 mercurial/localrepo.py# [attribute-error]
-mercurial/lsprof.py   # unguarded import
 mercurial/manifest.py # [unsupported-operands], [wrong-arg-types]
 mercurial/minirst.py  # [unsupported-operands], [attribute-error]
 mercurial/patch.py# [wrong-arg-types]
@@ -71,7 +70,6 @@
   >-x mercurial/interfaces \
   >-x mercurial/keepalive.py \
   >-x mercurial/localrepo.py \
-  >-x mercurial/lsprof.py \
   >-x mercurial/manifest.py \
   >-x mercurial/minirst.py \
   >-x mercurial/patch.py \



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11911: pytype: stop excluding upgrade.py

2021-12-14 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The sole failure here was this, which is fixed by simply creating a set like 
the
  caller, instead of a dict:
  
File "/mnt/c/Users/Matt/hg/mercurial/upgrade.py", line 73, in upgraderepo:
No attribute 'discard' on Dict[nothing, nothing] [attribute-error]
  In Union[Any, Dict[nothing, nothing]]

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11911

AFFECTED FILES
  mercurial/upgrade.py
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
--- a/tests/test-check-pytype.t
+++ b/tests/test-check-pytype.t
@@ -40,7 +40,6 @@
 mercurial/testing/storage.py  # tons of [attribute-error]
 mercurial/ui.py   # [attribute-error], [wrong-arg-types]
 mercurial/unionrepo.py# ui, svfs, unfiltered [attribute-error]
-mercurial/upgrade.py  # line 84, in upgraderepo: No attribute 
'discard' on Dict[nothing, nothing] [attribute-error]
 mercurial/util.py # [attribute-error], [wrong-arg-count]
 mercurial/utils/procutil.py   # [attribute-error], [module-attr], 
[bad-return-type]
 mercurial/utils/stringutil.py # [module-attr], [wrong-arg-count]
@@ -88,7 +87,6 @@
   >-x mercurial/thirdparty \
   >-x mercurial/ui.py \
   >-x mercurial/unionrepo.py \
-  >-x mercurial/upgrade.py \
   >-x mercurial/utils/procutil.py \
   >-x mercurial/utils/stringutil.py \
   >-x mercurial/utils/memorytop.py \
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -42,7 +42,7 @@
 ):
 """Upgrade a repository in place."""
 if optimize is None:
-optimize = {}
+optimize = set()
 repo = repo.unfiltered()
 
 specified_revlogs = {}



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11906: hghave: fix the check for suid on platforms lacking support

2021-12-12 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The mac tests were raising an AttributeError without the default arg.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11906

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -266,7 +266,10 @@
 
 @check("suidbit", "setuid and setgid bit")
 def has_suidbit():
-if getattr(os, "statvfs", None) is None or getattr(os, "ST_NOSUID") is 
None:
+if (
+getattr(os, "statvfs", None) is None
+or getattr(os, "ST_NOSUID", None) is None
+):
 return False
 return bool(os.statvfs('.').f_flag & os.ST_NOSUID)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11905: upgrade: byteify a few error messages

2021-12-12 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  These were flagged by pytype (which is currently disabled on this file due to
  another failure).

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11905

AFFECTED FILES
  mercurial/upgrade.py

CHANGE DETAILS

diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -323,7 +323,7 @@
 ui.warn(_(b'repository upgraded to use share-safe mode\n'))
 except error.LockError as e:
 hint = _(
-"see `hg help config.format.use-share-safe` for more information"
+b"see `hg help config.format.use-share-safe` for more information"
 )
 if mismatch_config == b'upgrade-abort':
 raise error.Abort(
@@ -380,7 +380,7 @@
 ui.warn(_(b'repository downgraded to not use share-safe mode\n'))
 except error.LockError as e:
 hint = _(
-"see `hg help config.format.use-share-safe` for more information"
+b"see `hg help config.format.use-share-safe` for more information"
 )
 # If upgrade-abort is set, abort when upgrade fails, else let the
 # process continue as `upgrade-allow` is set



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11805: packaging: bump pygit2 to 1.7.1

2021-11-24 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11805

AFFECTED FILES
  contrib/packaging/requirements-windows-py3.txt

CHANGE DETAILS

diff --git a/contrib/packaging/requirements-windows-py3.txt 
b/contrib/packaging/requirements-windows-py3.txt
--- a/contrib/packaging/requirements-windows-py3.txt
+++ b/contrib/packaging/requirements-windows-py3.txt
@@ -20,41 +20,57 @@
 
--hash=sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee \
 
--hash=sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8
 # via dulwich
-cffi==1.14.4 \
-
--hash=sha256:00a1ba5e2e95684448de9b89888ccd02c98d512064b4cb987d48f4b40aa0421e \
-
--hash=sha256:00e28066507bfc3fe865a31f325c8391a1ac2916219340f87dfad602c3e48e5d \
-
--hash=sha256:045d792900a75e8b1e1b0ab6787dd733a8190ffcf80e8c8ceb2fb10a29ff238a \
-
--hash=sha256:0638c3ae1a0edfb77c6765d487fee624d2b1ee1bdfeffc1f0b58c64d149e7eec \
-
--hash=sha256:105abaf8a6075dc96c1fe5ae7aae073f4696f2905fde6aeada4c9d2926752362 \
-
--hash=sha256:155136b51fd733fa94e1c2ea5211dcd4c8879869008fc811648f16541bf99668 \
-
--hash=sha256:1a465cbe98a7fd391d47dce4b8f7e5b921e6cd805ef421d04f5f66ba8f06086c \
-
--hash=sha256:1d2c4994f515e5b485fd6d3a73d05526aa0fcf248eb135996b088d25dfa1865b \
-
--hash=sha256:2c24d61263f511551f740d1a065eb0212db1dd241db758f5244281590c06 \
-
--hash=sha256:51a8b381b16ddd370178a65360ebe15fbc1c71cf6f584613a7ea08bfad946698 \
-
--hash=sha256:594234691ac0e9b770aee9fcdb8fa02c22e43e5c619456efd0d6c2bf276f3eb2 \
-
--hash=sha256:5cf4be6c304ad0b6602f5c4e90e2f59b47653ac1ed9c662ed379fe48a8f26b0c \
-
--hash=sha256:64081b3f8f6f3c3de6191ec89d7dc6c86a8a43911f7ecb422c60e90c70be41c7 \
-
--hash=sha256:6bc25fc545a6b3d57b5f8618e59fc13d3a3a68431e8ca5fd4c13241cd70d0009 \
-
--hash=sha256:798caa2a2384b1cbe8a2a139d80734c9db54f9cc155c99d7cc92441a23871c03 \
-
--hash=sha256:7c6b1dece89874d9541fc974917b631406233ea0440d0bdfbb8e03bf39a49b3b \
-
--hash=sha256:840793c68105fe031f34d6a086eaea153a0cd5c491cde82a74b420edd0a2b909 \
-
--hash=sha256:8d6603078baf4e11edc4168a514c5ce5b3ba6e3e9c374298cb88437957960a53 \
-
--hash=sha256:9cc46bc107224ff5b6d04369e7c595acb700c3613ad7bcf2e2012f62ece80c35 \
-
--hash=sha256:9f7a31251289b2ab6d4012f6e83e58bc3b96bd151f5b5262467f4bb6b34a7c26 \
-
--hash=sha256:9ffb888f19d54a4d4dfd4b3f29bc2c16aa4972f1c2ab9c4ab09b8ab8685b9c2b \
-
--hash=sha256:a7711edca4dcef1a75257b50a2fbfe92a65187c47dab5a0f1b9b332c5919a3fb \
-
--hash=sha256:af5c59122a011049aad5dd87424b8e65a80e4a6477419c0c1015f73fb5ea0293 \
-
--hash=sha256:b18e0a9ef57d2b41f5c68beefa32317d286c3d6ac0484efd10d6e07491bb95dd \
-
--hash=sha256:b4e248d1087abf9f4c10f3c398896c87ce82a9856494a7155823eb45a892395d \
-
--hash=sha256:ba4e9e0ae13fc41c6b23299545e5ef73055213e466bd107953e4a013a5ddd7e3 \
-
--hash=sha256:c6332685306b6417a91b1ff9fae889b3ba65c2292d64bd9245c093b1b284809d \
-
--hash=sha256:d9efd8b7a3ef378dd61a1e77367f1924375befc2eba06168b6ebfa903a5e59ca \
-
--hash=sha256:df5169c4396adc04f9b0a05f13c074df878b6052430e03f50e68adf3a57aa28d \
-
--hash=sha256:ebb253464a5d0482b191274f1c8bf00e33f7e0b9c66405fbffc61ed2c839c775 \
-
--hash=sha256:ec80dc47f54e6e9a78181ce05feb71a0353854cc26999db963695f950b5fb375 \
-
--hash=sha256:f032b34669220030f905152045dfa27741ce1a6db3324a5bc0b96b6c7420c87b \
-
--hash=sha256:f60567825f791c6f8a592f3c6e3bd93dd2934e3f9dac189308426bd76b00ef3b \
-
--hash=sha256:f803eaa94c2fcda012c047e62bc7a51b0bdabda1cad7a92a522694ea2d76e49f
+cffi==1.15.0 \
+
--hash=sha256:00c878c90cb53ccfaae6b8bc18ad05d2036553e6d9d1d9dbcf323bbe83854ca3 \
+
--hash=sha256:0104fb5ae2391d46a4cb082abdd5c69ea4eab79d8d44eaaf79f1b1fd806ee4c2 \
+
--hash=sha256:06c48159c1abed75c2e721b1715c379fa3200c7784271b3c46df01383b593636 \
+
--hash=sha256:0808014eb713677ec1292301ea4c81ad277b6cdf2fdd90fd540af98c0b101d20 \
+
--hash=sha256:10dffb601ccfb65262a27233ac273d552ddc4d8ae1bf93b21c94b8511bffe728 \
+
--hash=sha256:14cd121ea63ecdae71efa69c15c5543a4b5fbcd0bbe2aad864baca0063cecf27 \
+
--hash=sha256:17771976e82e9f94976180f76468546834d22a7cc404b17c22df2a2c81db0c66 \
+
--hash=sha256:181dee03b1170ff1969489acf1c26533710231c58f95534e3edac87fff06c443 \
+
--hash=sha256:23cfe892bd5dd8941608f93348c0737e369e51c100d03718f108bf1add7bd6d0 \
+
--hash=sha256:263cc3d821c4ab2213cbe8cd8b355a7f72a8324577dc865ef98487c1aeee2bc7 \
+
--hash=sha256:2756c88cbb94231c7a147402476be2c4df2f6078099a6f4a480d239a8817ae39 \
+
--hash=sha256:27c219baf94952ae9d50ec19651a687b826792055353d07648a5695413e0c605 \
+
--hash=sha256:2a23af14f408d53d5e6cd4e3d9a24ff9e05906ad574822a10563efcef137979a \
+
--hash=sha256:31fb708d9d7c3f49a60f04cf5b119aeefe5644daba1cd2a0fe389b674fd1de37 \
+
--hash=sha256:3415c89f9204ee60cd09b235810be700e993e343a

D11804: packaging: bump windows_curses to 2.3.0

2021-11-24 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is required for Python 3.10 support.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11804

AFFECTED FILES
  contrib/packaging/requirements-windows-py3.txt

CHANGE DETAILS

diff --git a/contrib/packaging/requirements-windows-py3.txt 
b/contrib/packaging/requirements-windows-py3.txt
--- a/contrib/packaging/requirements-windows-py3.txt
+++ b/contrib/packaging/requirements-windows-py3.txt
@@ -248,15 +248,17 @@
 
--hash=sha256:12c3fcdae7b88ecf11fc0d3e6d77586549d4575a2ceee18e82eee75c1f626162 \
 
--hash=sha256:57095bf22fc0a2d99ee9674cdafebed0f3ba763018582450706f7d3a74fff599
 # via pytest-vcr
-windows-curses==2.2.0 \
-
--hash=sha256:1452d771ec6f9b3fef037da2b169196a9a12be4e86a6c27dd579adac70c42028 \
-
--hash=sha256:267544e4f60c09af6505e50a69d7f01d7f8a281cf4bd4fc7efc3b32b9a4ef64e \
-
--hash=sha256:389228a3df556102e72450f599283094168aa82eee189f501ad9f131a0fc92e1 \
-
--hash=sha256:84336fe470fa07288daec5c684dec74c0766fec6b3511ccedb4c494804acfbb7 \
-
--hash=sha256:9aa6ff60be76f5de696dc6dbf7897e3b1e6abcf4c0f741e9a0ee22cd6ef382f8 \
-
--hash=sha256:c4a8ce00e82635f06648cc40d99f470be4e3ffeb84f9f7ae9d6a4f68ec6361e7 \
-
--hash=sha256:c5cd032bc7d0f03224ab55c925059d98e81795098d59bbd10f7d05c7ea9677ce \
-
--hash=sha256:fc0be372fe6da3c39d7093154ce029115a927bf287f34b4c615e2b3f8c23dfaa
+windows-curses==2.3.0 \
+
--hash=sha256:170c0d941c2e0cdf864e7f0441c1bdf0709232bf4aa7ce7f54d90fc76a4c0504 \
+
--hash=sha256:4d5fb991d1b90a41c2332f02241a1f84c8a1e6bc8f6e0d26f532d0da7a9f7b51 \
+
--hash=sha256:7a35eda4cb120b9e1a5ae795f3bc06c55b92c9d391baba6be1903285a05f3551 \
+
--hash=sha256:935be95cfdb9213f6f5d3d5bcd489960e3a8fbc9b574e7b2e8a3a3cc46efff49 \
+
--hash=sha256:a3a63a0597729e10f923724c2cf972a23ea677b400d2387dee1d668cf7116177 \
+
--hash=sha256:c860f596d28377e47f322b7382be4d3573fd76d1292234996bb7f72e0bc0ed0d \
+
--hash=sha256:cc5fa913780d60f4a40824d374a4f8ca45b4e205546e83a2d85147315a57457e \
+
--hash=sha256:d5cde8ec6d582aa77af791eca54f60858339fb3f391945f9cad11b1ab71062e3 \
+
--hash=sha256:e913dc121446d92b33fe4f5bcca26d3a34e4ad19f2af160370d57c3d1e93b4e1 \
+
--hash=sha256:fbc2131cec57e422c6660e6cdb3420aff5be5169b8e45bb7c471f884b0590a2b
 # via -r contrib/packaging/requirements-windows.txt.in
 wrapt==1.12.1 \
 
--hash=sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11803: packaging: regenerate the requirements files with pip-tools 6.4.0

2021-11-24 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Somewhere along the line, the formatting changed.  There's no change in 
package
  content here- it's just some minor text changes.  Py2 doesn't have any 
packages
  we'll be updating, so I'm not bothering there.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11803

AFFECTED FILES
  contrib/packaging/requirements-windows-py3.txt
  contrib/packaging/requirements.txt

CHANGE DETAILS

diff --git a/contrib/packaging/requirements.txt 
b/contrib/packaging/requirements.txt
--- a/contrib/packaging/requirements.txt
+++ b/contrib/packaging/requirements.txt
@@ -1,16 +1,16 @@
 #
-# This file is autogenerated by pip-compile
+# This file is autogenerated by pip-compile with python 3.7
 # To update, run:
 #
 #pip-compile --generate-hashes 
--output-file=contrib/packaging/requirements.txt 
contrib/packaging/requirements.txt.in
 #
 docutils==0.16 \
 
--hash=sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af \
-
--hash=sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc \
+
--hash=sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc
 # via -r contrib/packaging/requirements.txt.in
 jinja2==2.11.2 \
 
--hash=sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0 \
-
--hash=sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035 \
+
--hash=sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035
 # via -r contrib/packaging/requirements.txt.in
 markupsafe==1.1.1 \
 
--hash=sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473 \
@@ -45,5 +45,5 @@
 
--hash=sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f \
 
--hash=sha256:cdb132fc825c38e1aeec2c8aa9338310d29d337bebbd7baa06889d09a60a1fa2 \
 
--hash=sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7 \
-
--hash=sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be \
+
--hash=sha256:e8313f01ba26fbbe36c7be1966a7b7424942f670f38e666995b88d012765b9be
 # via jinja2
diff --git a/contrib/packaging/requirements-windows-py3.txt 
b/contrib/packaging/requirements-windows-py3.txt
--- a/contrib/packaging/requirements-windows-py3.txt
+++ b/contrib/packaging/requirements-windows-py3.txt
@@ -1,24 +1,24 @@
 #
-# This file is autogenerated by pip-compile
+# This file is autogenerated by pip-compile with python 3.7
 # To update, run:
 #
 #pip-compile --generate-hashes 
--output-file=contrib/packaging/requirements-windows-py3.txt 
contrib/packaging/requirements-windows.txt.in
 #
 atomicwrites==1.4.0 \
 
--hash=sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197 \
-
--hash=sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a \
+
--hash=sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a
 # via pytest
 attrs==21.2.0 \
 
--hash=sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1 \
-
--hash=sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb \
+
--hash=sha256:ef6aaac3ca6cd92904cdd0d83f629a15f18053ec84e6432106f7a4d04ae4f5fb
 # via pytest
 cached-property==1.5.2 \
 
--hash=sha256:9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130 \
-
--hash=sha256:df4f613cf7ad9a588cc381aaf4a512d26265ecebd5eb9e1ba12f1319eb85a6a0 \
+
--hash=sha256:df4f613cf7ad9a588cc381aaf4a512d26265ecebd5eb9e1ba12f1319eb85a6a0
 # via pygit2
 certifi==2021.5.30 \
 
--hash=sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee \
-
--hash=sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8 \
+
--hash=sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8
 # via dulwich
 cffi==1.14.4 \
 
--hash=sha256:00a1ba5e2e95684448de9b89888ccd02c98d512064b4cb987d48f4b40aa0421e \
@@ -54,15 +54,15 @@
 
--hash=sha256:ec80dc47f54e6e9a78181ce05feb71a0353854cc26999db963695f950b5fb375 \
 
--hash=sha256:f032b34669220030f905152045dfa27741ce1a6db3324a5bc0b96b6c7420c87b \
 
--hash=sha256:f60567825f791c6f8a592f3c6e3bd93dd2934e3f9dac189308426bd76b00ef3b \
-
--hash=sha256:f803eaa94c2fcda012c047e62bc7a51b0bdabda1cad7a92a522694ea2d76e49f \
+
--hash=sha256:f803eaa94c2fcda012c047e62bc7a51b0bdabda1cad7a92a522694ea2d76e49f
 # via pygit2
 colorama==0.4.4 \
 
--hash=sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b \
-
--hash=sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2 \
+
--hash=sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2
 # via pytest
 docutils==0.16 \
 
--hash=sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af \
-
--hash=sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06

D11719: typing: add more type hints to the errors module

2021-10-23 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  These were found by looking for `Any` types in the generated `*.pyi` file 
after
  running the tests.  There are some more complicated types that I'm not sure 
of,
  and am leaving untyped.  I also can't figure out how to get `self.hint` to be
  anything other than `Any` in most classes.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11719

AFFECTED FILES
  mercurial/error.py

CHANGE DETAILS

diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -31,6 +31,7 @@
 
 
 def _tobytes(exc):
+# type: (...) -> bytes
 """Byte-stringify exception in the same way as BaseException_str()"""
 if not exc.args:
 return b''
@@ -47,7 +48,7 @@
 """
 
 def __init__(self, *args, **kw):
-self.hint = kw.pop('hint', None)
+self.hint = kw.pop('hint', None)  # type: Optional[bytes]
 super(Hint, self).__init__(*args, **kw)
 
 
@@ -71,6 +72,7 @@
 if pycompat.ispy3:
 
 def __str__(self):
+# type: () -> str
 # the output would be unreadable if the message was translated,
 # but do not replace it with encoding.strfromlocal(), which
 # may raise another exception.
@@ -105,6 +107,7 @@
 
 class SidedataHashError(RevlogError):
 def __init__(self, key, expected, got):
+# type: (int, bytes, bytes) -> None
 self.hint = None
 self.sidedatakey = key
 self.expecteddigest = expected
@@ -117,6 +120,7 @@
 
 class LookupError(RevlogError, KeyError):
 def __init__(self, name, index, message):
+# type: (bytes, bytes, bytes) -> None
 self.name = name
 self.index = index
 # this can't be called 'message' because at least some installs of
@@ -343,6 +347,7 @@
 """Exception raised when a remote repo reports failure"""
 
 def __init__(self, message=None, hint=None):
+# type: (Optional[bytes], Optional[bytes]) -> None
 from .i18n import _
 
 if message:



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11718: typing: add a few assertions to revlog.py to help pytype

2021-10-23 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I've seen this before, but this was seen as potentially `None` with pytype
  2021.10.18.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11718

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2581,10 +2581,15 @@
 self._enforceinlinesize(transaction)
 if self._docket is not None:
 # revlog-v2 always has 3 writing handles, help Pytype
-assert self._writinghandles[2] is not None
-self._docket.index_end = self._writinghandles[0].tell()
-self._docket.data_end = self._writinghandles[1].tell()
-self._docket.sidedata_end = self._writinghandles[2].tell()
+wh1 = self._writinghandles[0]
+wh2 = self._writinghandles[1]
+wh3 = self._writinghandles[2]
+assert wh1 is not None
+assert wh2 is not None
+assert wh3 is not None
+self._docket.index_end = wh1.tell()
+self._docket.data_end = wh2.tell()
+self._docket.sidedata_end = wh3.tell()
 
 nodemaputil.setup_persistent_nodemap(transaction, self)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11609: packaging: update the certifi dependency

2021-10-03 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Not sure if this helps with recent certificate issues[1], but we might as well
  keep this modern.
  
  Note that certifi no longer claims py2 support, and there's a PR to add it 
back
  in[2].  Py2 support was dropped in 2020.04.05.2 (which predates what's being
  updated here).  None of the *.py files have changed since the 2020.6.20 
release,
  and I was able to call `certifi.where()` in both a virtualenv and with
  `hg debugshell` from an MSI install with this version, so we shouldn't be any
  worse off than before.
  
  [1] https://foss.heptapod.net/mercurial/tortoisehg/thg/-/issues/5745
  [2] https://github.com/certifi/python-certifi/pull/154

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11609

AFFECTED FILES
  contrib/automation/requirements.txt
  contrib/packaging/requirements-windows-py2.txt
  contrib/packaging/requirements-windows-py3.txt

CHANGE DETAILS

diff --git a/contrib/packaging/requirements-windows-py3.txt 
b/contrib/packaging/requirements-windows-py3.txt
--- a/contrib/packaging/requirements-windows-py3.txt
+++ b/contrib/packaging/requirements-windows-py3.txt
@@ -16,9 +16,9 @@
 
--hash=sha256:9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130 \
 
--hash=sha256:df4f613cf7ad9a588cc381aaf4a512d26265ecebd5eb9e1ba12f1319eb85a6a0 \
 # via pygit2
-certifi==2020.6.20 \
-
--hash=sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3 \
-
--hash=sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41 \
+certifi==2021.5.30 \
+
--hash=sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee \
+
--hash=sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8 \
 # via dulwich
 cffi==1.14.4 \
 
--hash=sha256:00a1ba5e2e95684448de9b89888ccd02c98d512064b4cb987d48f4b40aa0421e \
diff --git a/contrib/packaging/requirements-windows-py2.txt 
b/contrib/packaging/requirements-windows-py2.txt
--- a/contrib/packaging/requirements-windows-py2.txt
+++ b/contrib/packaging/requirements-windows-py2.txt
@@ -4,9 +4,9 @@
 #
 #pip-compile --generate-hashes 
--output-file=contrib/packaging/requirements-windows-py2.txt 
contrib/packaging/requirements-windows.txt.in
 #
-certifi==2020.6.20 \
-
--hash=sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3 \
-
--hash=sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41 \
+certifi==2021.5.30 \
+
--hash=sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee \
+
--hash=sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8 \
 # via dulwich
 configparser==4.0.2 \
 
--hash=sha256:254c1d9c79f60c45dfde850850883d5aaa7f19a23f13561243a050d5a7c3fe4c \
diff --git a/contrib/automation/requirements.txt 
b/contrib/automation/requirements.txt
--- a/contrib/automation/requirements.txt
+++ b/contrib/automation/requirements.txt
@@ -37,9 +37,9 @@
 
--hash=sha256:397585a7881230274afb8d1877ef69a661b0a311745cd324f14a052fb2a2863a \
 
--hash=sha256:4496f8da89cb496462a831897ad248e13e431d9fa7e41e06d426fd6658ab6e59 \
 # via boto3, s3transfer
-certifi==2019.9.11 \
-
--hash=sha256:e4f3620cfea4f83eedc95b24abd9cd56f3c4b146dd0177e83a21b4eb49e21e50 \
-
--hash=sha256:fd7c7c74727ddcf00e9acd26bba8da604ffec95bf1c2144e67aff7a8b50e6cef \
+certifi==2021.5.30 \
+
--hash=sha256:2bbf76fd432960138b3ef6dda3dde0544f27cbf8546c458e60baf371917ba9ee \
+
--hash=sha256:50b1e4f8446b06f41be7dd6338db18e0990601dce795c2b1686458aa7e8fa7d8 \
 # via requests
 cffi==1.12.3 \
 
--hash=sha256:041c81822e9f84b1d9c401182e174996f0bae9991f33725d059b771744290774 \



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11476: extensions: prevent a crash on py3 with a `minimumhgversion` str value

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The expectation is that this field is bytes, but unported extensions are a 
thing
  and it shouldn't explode on a bad value.  We already do this transformation in
  the version reporting mechanism.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11476

AFFECTED FILES
  mercurial/extensions.py
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1692,12 +1692,13 @@
   $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep 
'\(third'
   [1]
 
-Don't explode on py3 with a bad version number
+Don't explode on py3 with a bad version number (both str vs bytes, and not 
enough
+parts)
 
   $ cat > minversion4.py << EOF
   > from mercurial import util
   > util.version = lambda: b'3.5'
-  > minimumhgversion = b'3'
+  > minimumhgversion = '3'
   > EOF
   $ hg --config extensions.minversion=minversion4.py version -v
   Mercurial Distributed SCM (version 3.5)
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -224,7 +224,7 @@
 minver = getattr(mod, 'minimumhgversion', None)
 if minver:
 curver = util.versiontuple(n=2)
-extmin = util.versiontuple(minver, 2)
+extmin = util.versiontuple(stringutil.forcebytestr(minver), 2)
 
 if None in extmin:
 extmin = (extmin[0] or 0, extmin[1] or 0)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11473: util: eliminate the possibility of returning None from `versiontuple()`

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This fixes the following error flagged by pytype:
  
File "/mnt/c/Users/Matt/hg/mercurial/extensions.py", line 228, in load: 
unsupported operand types for > [unsupported-operands]
  Primitive types 'Optional[tuple]' and 'curver: Optional[tuple]' are not 
comparable.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11473

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1225,6 +1225,8 @@
 if n == 4:
 return (vints[0], vints[1], vints[2], extra)
 
+raise error.ProgrammingError(b"invalid version part request: %d" % n)
+
 
 def cachefunc(func):
 '''cache the result of function calls'''



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11475: extensions: prevent a crash on py3 when testing a bad extension minimum

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  A `None` placeholder is populated for each missing component by
  `util.versiontuple()`, which could safely be used with `>` on py2, but not 
py3.
  I guess there's another hole here where if the string is entirely bogus (i.e 
no
  numbers), it will be treated as 0.0, and always load.  But that's always been
  the case.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11475

AFFECTED FILES
  mercurial/extensions.py
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1692,6 +1692,25 @@
   $ hg --config extensions.minversion=minversion3.py version 2>&1 | egrep 
'\(third'
   [1]
 
+Don't explode on py3 with a bad version number
+
+  $ cat > minversion4.py << EOF
+  > from mercurial import util
+  > util.version = lambda: b'3.5'
+  > minimumhgversion = b'3'
+  > EOF
+  $ hg --config extensions.minversion=minversion4.py version -v
+  Mercurial Distributed SCM (version 3.5)
+  (see https://mercurial-scm.org for more information)
+  
+  Copyright (C) 2005-* Olivia Mackall and others (glob)
+  This is free software; see the source for copying conditions. There is NO
+  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  
+  Enabled extensions:
+  
+minversion  external  
+
 Restore HGRCPATH
 
   $ HGRCPATH=$ORGHGRCPATH
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -224,8 +224,12 @@
 minver = getattr(mod, 'minimumhgversion', None)
 if minver:
 curver = util.versiontuple(n=2)
+extmin = util.versiontuple(minver, 2)
 
-if None in curver or util.versiontuple(minver, 2) > curver:
+if None in extmin:
+extmin = (extmin[0] or 0, extmin[1] or 0)
+
+if None in curver or extmin > curver:
 msg = _(
 b'(third party extension %s requires version %s or newer '
 b'of Mercurial (current: %s); disabling)\n'



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11474: typing: drop annotations on `mercurial/logcmdutil.walkopts` attributes

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Pytype 2021-09-09 must have learned some things about `@attr`, because while
  these were presumably required to help it before (c1d0f83d62c4 
::9a26fea2b518
  
and
  c11099cc1de4 
::224c786f4fce
 ), 
these instances now get flagged as an assignment
  mismatch:
  
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 717, in walkopts: 
Type annotation for pats does not match type of assignment 
[annotation-type-mismatch]
  Annotation: List[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 718, in walkopts: 
Type annotation for opts does not match type of assignment 
[annotation-type-mismatch]
  Annotation: Dict[bytes, Any]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 722, in walkopts: 
Type annotation for revspec does not match type of assignment 
[annotation-type-mismatch]
  Annotation: List[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 725, in walkopts: 
Type annotation for bookmarks does not match type of assignment 
[annotation-type-mismatch]
  Annotation: List[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 726, in walkopts: 
Type annotation for branches does not match type of assignment 
[annotation-type-mismatch]
  Annotation: List[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 727, in walkopts: 
Type annotation for date does not match type of assignment 
[annotation-type-mismatch]
  Annotation: Optional[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 728, in walkopts: 
Type annotation for keywords does not match type of assignment 
[annotation-type-mismatch]
  Annotation: List[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 729, in walkopts: 
Type annotation for no_merges does not match type of assignment 
[annotation-type-mismatch]
  Annotation: bool
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 730, in walkopts: 
Type annotation for only_merges does not match type of assignment 
[annotation-type-mismatch]
  Annotation: bool
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 731, in walkopts: 
Type annotation for prune_ancestors does not match type of assignment 
[annotation-type-mismatch]
  Annotation: List[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 732, in walkopts: 
Type annotation for users does not match type of assignment 
[annotation-type-mismatch]
  Annotation: List[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 735, in walkopts: 
Type annotation for include_pats does not match type of assignment 
[annotation-type-mismatch]
  Annotation: List[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 736, in walkopts: 
Type annotation for exclude_pats does not match type of assignment 
[annotation-type-mismatch]
  Annotation: List[bytes]
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 739, in walkopts: 
Type annotation for follow does not match type of assignment 
[annotation-type-mismatch]
  Annotation: int
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 743, in walkopts: 
Type annotation for force_changelog_traversal does not match type of assignment 
[annotation-type-mismatch]
  Annotation: bool
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Matt/hg/mercurial/logcmdutil.py", line 747, in walkopts: 
Type annotation for filter_revisions_by_pats does not match type of assignment 
[annotation-type-mismatch]
  Annotation: bool
  Assignment: mercurial.thirdparty.attr._make._CountingAttr
File "/mnt/c/Users/Mat

D11470: util: avoid a name-error warning in the `mmapread` exception handler

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Newly caught by pytype 2021-09-09.
  
File "/mnt/c/Users/Matt/hg/mercurial/util.py", line 458, in mmapread: Name 
'fd' is not defined [name-error]

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11470

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -449,8 +449,8 @@
 return b''
 elif size is None:
 size = 0
+fd = getattr(fp, 'fileno', lambda: fp)()
 try:
-fd = getattr(fp, 'fileno', lambda: fp)()
 return mmap.mmap(fd, size, access=mmap.ACCESS_READ)
 except ValueError:
 # Empty files cannot be mmapped, but mmapread should still work.  Check



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11472: archival: force a `CompressionError` to bytes before passing to `error.Abort`

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'm not sure what changed before pytype 09-09-2021 (from 04-15-2021), but this
  started getting flagged.
  
  This fixes:
  
File "/mnt/c/Users/Matt/hg/mercurial/archival.py", line 199, in taropen: 
Function bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
 Expected: (self, ints: Iterable[int])
  Actually passed: (self, ints: tarfile.CompressionError)
  Attributes of protocol Iterable[int] are not implemented on 
tarfile.CompressionError: __iter__

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11472

AFFECTED FILES
  mercurial/archival.py

CHANGE DETAILS

diff --git a/mercurial/archival.py b/mercurial/archival.py
--- a/mercurial/archival.py
+++ b/mercurial/archival.py
@@ -29,6 +29,8 @@
 vfs as vfsmod,
 )
 
+from .utils import stringutil
+
 stringio = util.stringio
 
 # from unzip source code:
@@ -196,7 +198,7 @@
 name, pycompat.sysstr(mode + kind), fileobj
 )
 except tarfile.CompressionError as e:
-raise error.Abort(pycompat.bytestr(e))
+raise error.Abort(stringutil.forcebytestr(e))
 
 if isinstance(dest, bytes):
 self.z = taropen(b'w:', name=dest)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11471: parser: force a `ValueError` to bytes before passing to `error.ParseError`

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'm not sure what changed before pytype 09-09-2021 (from 04-15-2021), but this
  started getting flagged.  I think there's a pytype bug here, because I don't
  see how `.lower()` can be getting called on a `ValueError` after it is forced 
to
  a byte string.  That's suppressed for now to make progress.
  
  This fixes:
  
File "/mnt/c/Users/Matt/hg/mercurial/parser.py", line 219, in unescapestr: 
Function bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
 Expected: (self, ints: Iterable[int])
  Actually passed: (self, ints: ValueError)
  Attributes of protocol Iterable[int] are not implemented on ValueError: 
__iter__
File "/mnt/c/Users/Matt/hg/mercurial/parser.py", line 219, in unescapestr: 
No attribute 'lower' on ValueError [attribute-error]
  In Union[ValueError, mercurial.pycompat.bytestr]

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11471

AFFECTED FILES
  mercurial/parser.py

CHANGE DETAILS

diff --git a/mercurial/parser.py b/mercurial/parser.py
--- a/mercurial/parser.py
+++ b/mercurial/parser.py
@@ -21,7 +21,6 @@
 from .i18n import _
 from . import (
 error,
-pycompat,
 util,
 )
 from .utils import stringutil
@@ -216,7 +215,11 @@
 return stringutil.unescapestr(s)
 except ValueError as e:
 # mangle Python's exception into our format
-raise error.ParseError(pycompat.bytestr(e).lower())
+# TODO: remove this suppression.  For some reason, pytype 2021.09.09
+#   thinks .lower() is being called on Union[ValueError, bytes].
+# pytype: disable=attribute-error
+raise error.ParseError(stringutil.forcebytestr(e).lower())
+# pytype: enable=attribute-error
 
 
 def _prettyformat(tree, leafnodes, level, lines):



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11469: typing: suppress an name-error warning in `mercurial/windows.py`

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Newly caught by pytype 2021-09-09.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11469

AFFECTED FILES
  mercurial/windows.py

CHANGE DETAILS

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -175,7 +175,7 @@
 return mixedfilemodewrapper(fp)
 
 return fp
-except WindowsError as err:
+except WindowsError as err:  # pytype: disable=name-error
 # convert to a friendlier exception
 raise IOError(
 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11468: typing: suppress an import-error warning in `mercurial/utils/resourceutil.py`

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Newly caught by pytype 2021-09-09.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11468

AFFECTED FILES
  mercurial/utils/resourceutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/resourceutil.py b/mercurial/utils/resourceutil.py
--- a/mercurial/utils/resourceutil.py
+++ b/mercurial/utils/resourceutil.py
@@ -57,7 +57,7 @@
 try:
 # importlib.resources exists from Python 3.7; see fallback in except clause
 # further down
-from importlib import resources
+from importlib import resources  # pytype: disable=import-error
 
 # Force loading of the resources module
 resources.open_binary  # pytype: disable=module-attr



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11467: encoding: force a few Errors to bytes before passing to `error.Abort`

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'm not sure what changed before pytype 09-09-2021 (from 04-15-2021), but 
these
  started getting flagged.  PyCharm also flagged these.  This fixes the 
following:
  
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 243, in fromlocal: 
Function Abort.__init__ was called with the wrong arguments [wrong-arg-types]
 Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
  Actually passed: (self, message: LookupError, ...)
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 309, in lower: 
Function Abort.__init__ was called with the wrong arguments [wrong-arg-types]
 Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
  Actually passed: (self, message: LookupError, ...)
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 336, in 
upperfallback: Function Abort.__init__ was called with the wrong arguments 
[wrong-arg-types]
 Expected: (self, message: Union[bytearray, bytes, memoryview], ...)
  Actually passed: (self, message: LookupError, ...)
Called from (traceback):
  line 391, in current file
  line 348, in get
  line 318, in upper

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11467

AFFECTED FILES
  mercurial/encoding.py

CHANGE DETAILS

diff --git a/mercurial/encoding.py b/mercurial/encoding.py
--- a/mercurial/encoding.py
+++ b/mercurial/encoding.py
@@ -240,7 +240,9 @@
 b"decoding near '%s': %s!" % (sub, pycompat.bytestr(inst))
 )
 except LookupError as k:
-raise error.Abort(k, hint=b"please check your locale settings")
+raise error.Abort(
+pycompat.bytestr(k), hint=b"please check your locale settings"
+)
 
 
 def unitolocal(u):
@@ -306,7 +308,9 @@
 except UnicodeError:
 return s.lower()  # we don't know how to fold this except in ASCII
 except LookupError as k:
-raise error.Abort(k, hint=b"please check your locale settings")
+raise error.Abort(
+pycompat.bytestr(k), hint=b"please check your locale settings"
+)
 
 
 def upper(s):
@@ -333,7 +337,9 @@
 except UnicodeError:
 return s.upper()  # we don't know how to fold this except in ASCII
 except LookupError as k:
-raise error.Abort(k, hint=b"please check your locale settings")
+raise error.Abort(
+pycompat.bytestr(k), hint=b"please check your locale settings"
+)
 
 
 if not _nativeenviron:



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11466: typing: add a fake `__init__()` to bytestr to distract pytype

2021-09-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I'm not sure what changed before pytype 09-09-2021 (from 04-15-2021), but 
these
  started getting flagged.  This wrapping an exception in a `bytestr` pattern 
has
  been flagged before, and I've fixed it then with `stringutil.forcebytestr()`.
  But that doesn't work here, because it would create a circular import.
  
  I suspect the issue is `bytes.__new__()` wants `Iterable[int]`, so it just
  assumes the subclass will also take that.  The referenced pytype bug isn't an
  exact match, but seems related and the suggested workaround helps.
  
  The specific warnings fixed are:
  
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 212, in tolocal: 
Function bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
 Expected: (self, ints: Iterable[int])
  Actually passed: (self, ints: LookupError)
  Attributes of protocol Iterable[int] are not implemented on LookupError: 
__iter__
Called from (traceback):
  line 353, in current file
File "/mnt/c/Users/Matt/hg/mercurial/encoding.py", line 240, in fromlocal: 
Function bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
 Expected: (self, ints: Iterable[int])
  Actually passed: (self, ints: UnicodeDecodeError)
  Attributes of protocol Iterable[int] are not implemented on 
UnicodeDecodeError: __iter__

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11466

AFFECTED FILES
  mercurial/pycompat.py

CHANGE DETAILS

diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py
--- a/mercurial/pycompat.py
+++ b/mercurial/pycompat.py
@@ -222,6 +222,15 @@
 >>> assert type(t) is bytes
 """
 
+# Trick pytype into not demanding Iterable[int] be passed to __new__(),
+# since the appropriate bytes format is done internally.
+#
+# https://github.com/google/pytype/issues/500
+if TYPE_CHECKING:
+
+def __init__(self, s=b''):
+pass
+
 def __new__(cls, s=b''):
 if isinstance(s, bytestr):
 return s



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11455: setup: stop packaging python3.dll and python3X.dll in the wheel distribution

2021-09-19 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Now that exewrapper is smart enough to find the DLLs it needs without help 
from
  the build script, backout ed286d150aa8 
 
and 2960b7fac966 
.  
Note that this will
  require deleting the build/lib.win-amd64-3.X directory to actually remove it
  from the final wheel.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11455

AFFECTED FILES
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -780,9 +780,6 @@
 
 pythonlib = None
 
-dir = os.path.dirname(self.get_ext_fullpath('dummy'))
-self.hgtarget = os.path.join(dir, 'hg')
-
 if getattr(sys, 'dllhandle', None):
 # Different Python installs can have different Python library
 # names. e.g. the official CPython distribution uses pythonXY.dll
@@ -808,35 +805,6 @@
 )
 pythonlib = dllbasename[:-4]
 
-# Copy the pythonXY.dll next to the binary so that it runs
-# without tampering with PATH.
-fsdecode = lambda x: x
-if sys.version_info[0] >= 3:
-fsdecode = os.fsdecode
-dest = os.path.join(
-os.path.dirname(self.hgtarget),
-fsdecode(dllbasename),
-)
-
-if not os.path.exists(dest):
-shutil.copy(buf.value, dest)
-
-# Also overwrite python3.dll so that hgext.git is usable.
-# TODO: also handle the MSYS flavor
-if sys.version_info[0] >= 3:
-python_x = os.path.join(
-os.path.dirname(fsdecode(buf.value)),
-"python3.dll",
-)
-
-if os.path.exists(python_x):
-dest = os.path.join(
-os.path.dirname(self.hgtarget),
-os.path.basename(python_x),
-)
-
-shutil.copy(python_x, dest)
-
 if not pythonlib:
 log.warn(
 'could not determine Python DLL filename; assuming pythonXY'
@@ -859,6 +827,8 @@
 output_dir=self.build_temp,
 macros=macros,
 )
+dir = os.path.dirname(self.get_ext_fullpath('dummy'))
+self.hgtarget = os.path.join(dir, 'hg')
 self.compiler.link_executable(
 objects, self.hgtarget, libraries=[], output_dir=self.build_temp
 )



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11454: exewrapper: find the proper python3X.dll in the registry

2021-09-19 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Previously, we relied on the default library lookup[1], which for us is
  essentially to look on `PATH`.  That has issues- the Python installations are
  not necessarily on `PATH`, so I started copying the DLLs locally in 
2960b7fac966 

  and ed286d150aa8 
 
during the build to work around that.  However, it's been
  discovered that causes `python3.dll` and `python3X.dll` to get slipped into 
the
  wheel that gets distributed on PyPI.  Additionally, Mercurial would fail to 
run
  in a venv if the Python environment that created it isn't on `PATH`, because
  venv creation doesn't copy the DLLs locally.
  
  The logic here is inspired by the `py.exe` launcher[2], though this is simpler
  because we don't care about the architecture- if this is a 32 bit process
  running on Win64, the registry reflection will redirect to where the 32 bit
  Python process wrote its keys.  A nice unintended side effect is to also make
  venvs that don't have their root Python on `PATH` work without all of the code
  required to read `pyvenv.cfg`[3].  I don't see any reasonable way to create a
  venv without Python being installed (other than maybe building Python from
  source?), so punt on trying to read that file for now and save a bunch of 
string
  manipulation code.
  
  I somehow managed to corrupt my Windows user profile, and that makes the
  Microsoft Store python not run (even loading the DLL gives an access error), 
so
  I'm giving priority to both global and user specific python.org installations.
  
  Loading python3.dll is new, but when I went down the rabbit hole of 
implementing
  `pyvenv.cfg` support, I saw a comment[4] that led me to think we could have
  trouble if we don't.  The comment in ed286d150aa8 
 
confirms this, so we should
  probably bail out completely if Python3 can't be loaded from the registry,
  rather than getting something random on `PATH`.  But I'll leave that for the
  default branch.
  
  [1] 
https://docs.microsoft.com/en-us/windows/win32/Dlls/dynamic-link-library-search-order#standard-search-order-for-desktop-applications
  [2] 
https://github.com/python/cpython/blob/adcd2205565f91c6719f4141ab4e1da6d7086126/PC/launcher.c#L249
  [3] 
https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/PC/getpathp.c#L707
  [4] 
https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/PC/getpathp.c#L1098

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11454

AFFECTED FILES
  mercurial/exewrapper.c

CHANGE DETAILS

diff --git a/mercurial/exewrapper.c b/mercurial/exewrapper.c
--- a/mercurial/exewrapper.c
+++ b/mercurial/exewrapper.c
@@ -29,6 +29,134 @@
 #define _countof(array) (sizeof(array) / sizeof(array[0]))
 #endif
 
+#if PY_MAJOR_VERSION >= 3
+
+#pragma comment(lib, "Advapi32.lib")
+
+/* python.org installations */
+#define CORE_PATH L"SOFTWARE\\Python\\PythonCore"
+
+/* Microsoft Store installations */
+#define LOOKASIDE_PATH 
\
+   L"SOFTWARE\\Microsoft\\AppModel\\Lookaside\\user\\Software\\Python\\"  \
+   L"PythonCore"
+
+static wchar_t *_locate_python_for_key(HKEY root, LPCWSTR subkey, size_t *size)
+{
+   wchar_t installPathKey[512];
+   wchar_t *executable = NULL;
+   DWORD type;
+   DWORD sz = 0;
+   HKEY ip_key;
+   LSTATUS status;
+
+   _snwprintf_s(installPathKey, sizeof(installPathKey), _TRUNCATE,
+L"%ls\\%d.%d\\InstallPath", subkey, PY_MAJOR_VERSION,
+PY_MINOR_VERSION);
+
+   status =
+   RegOpenKeyExW(root, installPathKey, 0, KEY_QUERY_VALUE, &ip_key);
+
+   if (status != ERROR_SUCCESS)
+   return NULL;
+
+   status = RegQueryValueExW(ip_key, L"ExecutablePath", NULL, &type,
+ (LPBYTE)executable, &sz);
+   if (status == ERROR_SUCCESS) {
+   /* Allocate extra space so path\to\python.exe can be converted
+* to path\to\python39.dll + NUL.
+*/
+   *size = sz + sizeof(_T(HGPYTHONLIB ".dll")) + sizeof(wchar_t);
+   executable = malloc(*size);
+
+   if (executable) {
+   status =
+   RegQueryValueExW(ip_key, L"ExecutablePath", NULL,
+&type, (LPBYTE)executable, &sz);
+
+   if (status != ERROR_SUCCESS) {
+   free(executable);
+   executable = NULL;
+   } else {
+

D11452: pyoxidizer: add the user site to `sys.path` on macOS

2021-09-17 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This allows 3rd party extensions that are installed with `pip` to be picked 
up,
  similar to what we do on Windows.  PyOxidizer has a bug that prevents this 
from
  working without this extra help (see 95af358fcdfe 
), 
though it appears there's
  another wrinkle here with `sys._framework` too.
  
  I needed this to see if the problem[1] loading the keyring extension on 
Windows
  also occurs on macOS (it doesn't).
  
  [1] https://github.com/indygreg/PyOxidizer/issues/445

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11452

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -58,6 +58,20 @@
 'site-packages',
 )
 )
+elif sys.platform == "darwin":
+vi = sys.version_info
+
+def joinuser(*args):
+return os.path.expanduser(os.path.join(*args))
+
+# Note: site.py uses `sys._framework` instead of hardcoding "Python" as the
+#   3rd arg, but that is set to an empty string in an oxidized binary.  It
+#   has a fallback to ~/.local when `sys._framework` isn't set, but we want
+#   to match what the system python uses, so it sees pip installed stuff.
+usersite = joinuser("~", "Library", "Python",
+"%d.%d" % vi[:2], "lib/python/site-packages")
+
+sys.path.append(usersite)
 import hgdemandimport;
 hgdemandimport.enable();
 from mercurial import dispatch;



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11451: pyoxidizer: don't use in-memory for resources on macOS

2021-09-17 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  When trying to debug something else on macOS, pyoxidized builds were failing
  with the following message about pywatchman (and then cext.base85 when I
  commented out pywatchman):
  
"cannot be loaded from memory but memory loading required"
  
  I don't have any immediate plans to do more work on macOS, but maybe this will
  save someone else time debugging this.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11451

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -33,6 +33,7 @@
 TIME_STAMP_SERVER_URL = VARS.get("TIME_STAMP_SERVER_URL", 
"http://timestamp.digicert.com";)
 
 IS_WINDOWS = "windows" in BUILD_TARGET_TRIPLE
+IS_MACOS = "darwin" in BUILD_TARGET_TRIPLE
 
 # Code to run in Python interpreter.
 RUN_CODE = """
@@ -69,7 +70,7 @@
 return default_python_distribution(python_version = "3.9")
 
 def resource_callback(policy, resource):
-if not IS_WINDOWS:
+if not (IS_WINDOWS or IS_MACOS):
 resource.add_location = "in-memory"
 return
 
@@ -100,7 +101,7 @@
 # extensions.
 packaging_policy.extension_module_filter = "all"
 packaging_policy.resources_location = "in-memory"
-if IS_WINDOWS:
+if IS_WINDOWS or IS_MACOS:
 packaging_policy.resources_location_fallback = 
"filesystem-relative:lib"
 packaging_policy.register_resource_callback(resource_callback)
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11354: hg: don't attempt to extend `sys.path` with the user site without `APPDATA`

2021-08-26 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This variable is created by the system and *should* be available, but
  test-lfs-bundle.t has a test where it is explicitly unset.  It wasn't caught
  before because prior to 95af358fcdfe 
, 
it was limited to the py2exe binary.  As a
  precaution, fix both that and the pyoxidizer case that was causing the test to
  fail.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11354

AFFECTED FILES
  hg
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -47,14 +47,16 @@
 # Add user site to sys.path to load extensions without the full path
 if os.name == 'nt':
 vi = sys.version_info
-sys.path.append(
-os.path.join(
-os.environ['APPDATA'],
-'Python',
-'Python%d%d' % (vi[0], vi[1]),
-'site-packages',
+appdata = os.environ.get('APPDATA')
+if appdata:
+sys.path.append(
+os.path.join(
+appdata,
+'Python',
+'Python%d%d' % (vi[0], vi[1]),
+'site-packages',
+)
 )
-)
 import hgdemandimport;
 hgdemandimport.enable();
 from mercurial import dispatch;
diff --git a/hg b/hg
--- a/hg
+++ b/hg
@@ -28,14 +28,16 @@
 # to the documentation.
 if getattr(sys, 'frozen', None) == 'console_exe':
 vi = sys.version_info
-sys.path.append(
-os.path.join(
-os.environ['APPDATA'],
-'Python',
-'Python%d%d' % (vi[0], vi[1]),
-'site-packages',
+appdata = os.environ.get('APPDATA')
+if appdata:
+sys.path.append(
+os.path.join(
+appdata,
+'Python',
+'Python%d%d' % (vi[0], vi[1]),
+'site-packages',
+)
 )
-)
 
 from hgdemandimport import tracing
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11333: windows: degrade to py2 behavior when reading a non-symlink as a symlink

2021-08-22 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  While waiting for the push to hg-committed in WSL to complete, I ran a
  `phabimport` from Windows and got this traceback:
  
$ hg phabimport 11313
** Unknown exception encountered with possibly-broken third-party extension 
"mercurial_keyring" (version N/A)
** which supports versions unknown of Mercurial.
** Please disable "mercurial_keyring" and try your action again.
** If that fixes the bug please report it to 
https://foss.heptapod.net/mercurial/mercurial_keyring/issues
** Python 3.9.5 (default, May  6 2021, 17:29:31) [MSC v.1928 64 bit (AMD64)]
** Mercurial Distributed SCM (version 5.9rc1+hg32.0e2f5733563d)
** Extensions loaded: absorb, blackbox, evolve 10.3.3, extdiff, 
fastannotate, fix, mercurial_keyring, mq, phabblocker 20210126, phabricator, 
rebase, show, strip, topic 0.22.3
Traceback (most recent call last):
  File "mercurial.lock", line 279, in _trylock
  File "mercurial.vfs", line 202, in makelock
  File "mercurial.util", line 2147, in makelock
FileExistsError: [WinError 183] Cannot create a file when that file already 
exists: b'hp-omen:78348' -> b'C:\\Users\\Matt\\hg/.hg/store/lock'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 24, in 
  File "mercurial.dispatch", line 144, in run
  File "mercurial.dispatch", line 250, in dispatch
  File "mercurial.dispatch", line 294, in _rundispatch
  File "mercurial.dispatch", line 470, in _runcatch
  File "mercurial.dispatch", line 480, in _callcatch
  File "mercurial.scmutil", line 153, in callcatch
  File "mercurial.dispatch", line 460, in _runcatchfunc
  File "mercurial.dispatch", line 1273, in _dispatch
  File "mercurial.dispatch", line 918, in runcommand
  File "mercurial.dispatch", line 1285, in _runcommand
  File "mercurial.dispatch", line 1271, in 
  File "mercurial.util", line 1886, in check
  File "mercurial.util", line 1886, in check
  File "hgext.mq", line 4239, in mqcommand
  File "mercurial.util", line 1886, in check
  File "mercurial.util", line 1886, in check
  File "hgext.phabricator", line 314, in inner
  File "hgext.phabricator", line , in phabimport
  File "hgext.phabricator", line 2123, in readpatch
  File "hgext.phabricator", line 2199, in _write
  File "mercurial.localrepo", line 2956, in lock
  File "mercurial.localrepo", line 2918, in _lock
  File "mercurial.lock", line 152, in trylock
  File "mercurial.lock", line 283, in _trylock
  File "mercurial.lock", line 314, in _readlock
  File "mercurial.vfs", line 221, in readlock
  File "mercurial.util", line 2163, in readlock
  File "mercurial.windows", line 619, in readlink
ValueError: not a symbolic link
  
  Both exceptions look accurate (the file exists, and the Windows side can't 
read
  WSL side symlinks).  I didn't try to reproduce this entirely within the 
Windows
  side, but we can do better than a cryptic stacktrace.  With this change, the
  same scenario results in this abort:
  
abort: C:\Users\Matt\hg/.hg/store/lock: The file cannot be accessed by the 
system
  
  When both the `push` and `phabimport` are done on the Windows side, it prints 
a
  message about waiting for the lock, and successfully applies the patch after 
the
  push completes.
  
  I'm not sure if there's enough info to be able to convert the abort into the
  wait scenario.  As it stands now, we don't support symlinks on Windows, which
  requires either a UAC Administrator level process or an opt-in in developer
  mode, and there are several places where the new symlink on Windows support in
  py3 was explicitly disabled in order to get tests to pass quicker.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11333

AFFECTED FILES
  mercurial/windows.py

CHANGE DETAILS

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -616,7 +616,16 @@
 
 
 def readlink(pathname):
-return pycompat.fsencode(os.readlink(pycompat.fsdecode(pathname)))
+path = pycompat.fsdecode(pathname)
+try:
+link = os.readlink(path)
+except ValueError as e:
+# On py2, os.readlink() raises an AttributeError since it is
+# unsupported.  On py3, reading a non-link raises a ValueError.  Simply
+# treat this as the error the locking code has been expecting up to now
+# until an effort can be made to enable symlink support on Windows.
+raise AttributeError(e)
+return pycompat.fsencode(link)
 
 
 def removedirs(name):



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Me

D11308: pyoxidizer: add user-site to `sys.path` on Windows

2021-08-18 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is a port of 53221078e0de 
 to 
Windows to allow pip-installed extensions to
  be loaded without specifying a path.  It's a major headache to have an hg.exe 
on
  `PATH` that needs to have the path to the extensions specified, because WSL
  doesn't see the same path.
  
  This is only for Windows for now, to match the currently shipping py2 
behavior.
  There is a better solution with using the `site` package, but this needs 
support
  in PyOxidizer[1].
  
  [1] https://github.com/indygreg/PyOxidizer/issues/430

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11308

AFFECTED FILES
  rust/hgcli/pyoxidizer.bzl

CHANGE DETAILS

diff --git a/rust/hgcli/pyoxidizer.bzl b/rust/hgcli/pyoxidizer.bzl
--- a/rust/hgcli/pyoxidizer.bzl
+++ b/rust/hgcli/pyoxidizer.bzl
@@ -44,6 +44,17 @@
 # We do not prepend the values because the Mercurial library wants to be in
 # the front of the sys.path to avoid picking up other installations.
 sys.path.extend(extra_path.split(os.pathsep))
+# Add user site to sys.path to load extensions without the full path
+if os.name == 'nt':
+vi = sys.version_info
+sys.path.append(
+os.path.join(
+os.environ['APPDATA'],
+'Python',
+'Python%d%d' % (vi[0], vi[1]),
+'site-packages',
+)
+)
 import hgdemandimport;
 hgdemandimport.enable();
 from mercurial import dispatch;



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11307: run-tests: avoid silently switching the hg executable used

2021-08-18 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I noticed an issue testing the installed pyoxidizer binary using `--with-hg`
  where it would pass more tests than if the tests are run with `--pyoxidized`.
  It turns out that `_usecorrectpython()` augments `PATH` to include the python
  binary and its `Scripts` directory on Windows, and I happen to have `pip`
  installed Mercurial in that version of python.  Therefore, the `which()` 
method
  picked up this installed executable, and wrote that to the generated `hg` 
script
  in the custom `bin` directory.
  
  There's an issue here when running `test-run-tests.t` with `--local`, as noted
  in the comments.  I suspect that some stuff from the main instance of
  `run-tests.py` is bleeding into the *.t file's instances of `run-tests.py`
  because when I print `opts.with_hg` at the point where is complains that
  "--with-hg must specify an executable hg script", the path is in the form
  "C:UsersMatt...".  (Two of those slashes are escapes the test 
runner
  puts into printed lines.)  If I hardcode r"C:\Users\Matt\..." in 
`run-tests.py`,
  then it works fine.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11307

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3679,8 +3679,19 @@
 def _use_correct_mercurial(self):
 target_exec = os.path.join(self._custom_bin_dir, b'hg')
 if self._hgcommand != b'hg':
-# shutil.which only accept bytes from 3.8
-real_exec = which(self._hgcommand)
+# _usecorrectpython() may have augmented PATH, so don't used 
`which`
+# on the basename of the explicitly provided executable, since that
+# may end up using another one.
+#
+# TODO: figure how why test-run-tests.t fails on Windows if we
+#  unconditionally join with bindir, and run with --local.  Not
+#  using --local will run the *.t fine.
+if self.options.with_hg:
+real_exec = os.path.join(self._bindir, self._hgcommand)
+else:
+# shutil.which only accept bytes from 3.8
+real_exec = which(self._hgcommand)
+
 if real_exec is None:
 raise ValueError('could not find exec path for "%s"', 
real_exec)
 if real_exec == target_exec:



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11303: zeroconf: fix an issue concatenating bytes and str

2021-08-18 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `bytes(length)` doesn't do what we want, so use `str`.
  
  There appear to be a ton more issues in this extension, including:
  
  - globals()[b'_GLOBAL_DONE'] using bytes as the key
  - `__author__` and similar using bytes
  - `BadDomainName` is feeding bytes to the Exception constructor
  - DNSRecord.toString() has the wrong signature (should be str, not bytes)

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11303

AFFECTED FILES
  hgext/zeroconf/Zeroconf.py

CHANGE DETAILS

diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py
--- a/hgext/zeroconf/Zeroconf.py
+++ b/hgext/zeroconf/Zeroconf.py
@@ -770,7 +770,7 @@
 
 def writeString(self, value, length):
 """Writes a string to the packet"""
-format = b'!' + str(length) + b's'
+format = '!' + str(length) + 's'
 self.data.append(struct.pack(format, value))
 self.size += length
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11275: contrib: switch the Windows bootstrap environment to py3.9

2021-08-09 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Use the built in `venv` module instead of `virtualenv` for simplicity, and
  upgrade to a modern Mercurial that supports py3.
  
  One issue here is that `venv` doesn't copy `python3{,Y}.dll` into the 
`Scripts`
  subdirectory, so running the `hg.exe` that gets installed immediately fails 
on a
  clean system because Python isn't in `PATH`.  There is code in `python.exe` to
  detect when it is in a venv and add the original python install to the DLL
  lookup path, which we don't do in `hg.exe` yet. The simple workaround for now 
is
  to run the `hg` script with `python.exe`.  Typically 
`PYTHONLEGACYWINDOWSSTDIO`
  must be set in the environment on Windows, but the clone process works without
  it.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11275

AFFECTED FILES
  contrib/install-windows-dependencies.ps1

CHANGE DETAILS

diff --git a/contrib/install-windows-dependencies.ps1 
b/contrib/install-windows-dependencies.ps1
--- a/contrib/install-windows-dependencies.ps1
+++ b/contrib/install-windows-dependencies.ps1
@@ -38,18 +38,15 @@
 $PIP_URL = 
"https://github.com/pypa/get-pip/raw/309a56c5fd94bd1134053a541cb4657a4e47e09d/get-pip.py";
 $PIP_SHA256 = 
"57e3643ff19f018f8a00dfaa6b7e4620e3c1a7a2171fd218425366ec006b3bfe"
 
-$VIRTUALENV_URL = 
"https://files.pythonhosted.org/packages/66/f0/6867af06d2e2f511e4e1d7094ff663acdebc4f15d4a0cb0fed1007395124/virtualenv-16.7.5.tar.gz";
-$VIRTUALENV_SHA256 = 
"f78d81b62d3147396ac33fc9d77579ddc42cc2a98dd9ea38886f616b33bc7fb2"
-
 $INNO_SETUP_URL = 
"http://files.jrsoftware.org/is/5/innosetup-5.6.1-unicode.exe";
 $INNO_SETUP_SHA256 = 
"27D49E9BC769E9D1B214C153011978DB90DC01C2ACD1DDCD9ED7B3FE3B96B538"
 
 $MINGW_BIN_URL = 
"https://osdn.net/frs/redir.php?m=constant&f=mingw%2F68260%2Fmingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip";
 $MINGW_BIN_SHA256 = 
"2AB8EFD7C7D1FC8EAF8B2FA4DA4EEF8F3E47768284C021599BC7435839A046DF"
 
-$MERCURIAL_WHEEL_FILENAME = "mercurial-5.1.2-cp27-cp27m-win_amd64.whl"
-$MERCURIAL_WHEEL_URL = 
"https://files.pythonhosted.org/packages/6d/47/e031e47f7fe9b16e4e3383da47e2b0a7eae6e603996bc67a03ec4fa1b3f4/$MERCURIAL_WHEEL_FILENAME";
-$MERCURIAL_WHEEL_SHA256 = 
"1d18c7f6ca1456f0f62ee65c9a50c14cbba48ce6e924930cdb10537f5c9eaf5f"
+$MERCURIAL_WHEEL_FILENAME = "mercurial-5.8.1-cp39-cp39-win_amd64.whl"
+$MERCURIAL_WHEEL_URL = 
"https://files.pythonhosted.org/packages/5c/b5/a5fa664761eef29b6c90eb24cb09ab8fe2c9b4b86af41d42c17476aff29b/$MERCURIAL_WHEEL_FILENAME";
+$MERCURIAL_WHEEL_SHA256 = 
"cbf3efa68fd7ebf94691bd00d2c86bbd47ca73620c8faa4f18b6c394bf5f82b0"
 
 $RUSTUP_INIT_URL = 
"https://static.rust-lang.org/rustup/archive/1.21.1/x86_64-pc-windows-gnu/rustup-init.exe";
 $RUSTUP_INIT_SHA256 = 
"d17df34ba974b9b19cf5c75883a95475aa22ddc364591d75d174090d55711c72"
@@ -136,7 +133,6 @@
 Secure-Download $PYTHON39_x86_URL ${prefix}\assets\python39-x86.exe 
$PYTHON39_x86_SHA256
 Secure-Download $PYTHON39_x64_URL ${prefix}\assets\python39-x64.exe 
$PYTHON39_x64_SHA256
 Secure-Download $PIP_URL ${pip} $PIP_SHA256
-Secure-Download $VIRTUALENV_URL ${prefix}\assets\virtualenv.tar.gz 
$VIRTUALENV_SHA256
 Secure-Download $VS_BUILD_TOOLS_URL ${prefix}\assets\vs_buildtools.exe 
$VS_BUILD_TOOLS_SHA256
 Secure-Download $INNO_SETUP_URL ${prefix}\assets\InnoSetup.exe 
$INNO_SETUP_SHA256
 Secure-Download $MINGW_BIN_URL ${prefix}\assets\mingw-get-bin.zip 
$MINGW_BIN_SHA256
@@ -174,7 +170,7 @@
 # Construct a virtualenv useful for bootstrapping. It conveniently 
contains a
 # Mercurial install.
 Write-Output "creating bootstrap virtualenv with Mercurial"
-Invoke-Process "$prefix\python27-x64\Scripts\virtualenv.exe" 
"${prefix}\venv-bootstrap"
+Invoke-Process "$prefix\python39-x64\python.exe" "-m venv 
${prefix}\venv-bootstrap"
 Invoke-Process "${prefix}\venv-bootstrap\Scripts\pip.exe" "install 
${prefix}\assets\${MERCURIAL_WHEEL_FILENAME}"
 }
 
@@ -182,7 +178,7 @@
 Write-Output "cloning $repo_url to $dest"
 # TODO Figure out why CA verification isn't working in EC2 and remove
 # --insecure.
-Invoke-Process "${prefix}\venv-bootstrap\Scripts\hg.exe" "clone --insecure 
$repo_url $dest"
+Invoke-Process "${prefix}\venv-bootstrap\Scripts\python.exe" 
"${prefix}\venv-bootstrap\Scripts\hg clone --insecure $repo_url $dest"
 
 # Mark repo as non-publishing by default for convenience.
 Add-Content -Path "$dest\.hg\hgrc" -Value "`n[phases]`npublish = false"



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11274: contrib: comment out the 64-bit py38 dependency installation on Windows

2021-08-09 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Not sure what is going on here, but it appears to not install py3.8 x64 in the
  usual `C:\hgdev` directory.  The x32 installer works fine.  I'm assuming this 
is
  a bug in this version of the installer, but didn't look into it too much.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11274

AFFECTED FILES
  contrib/install-windows-dependencies.ps1

CHANGE DETAILS

diff --git a/contrib/install-windows-dependencies.ps1 
b/contrib/install-windows-dependencies.ps1
--- a/contrib/install-windows-dependencies.ps1
+++ b/contrib/install-windows-dependencies.ps1
@@ -147,7 +147,7 @@
 Install-Python3 "Python 3.7 32-bit" ${prefix}\assets\python37-x86.exe 
${prefix}\python37-x86 ${pip}
 Install-Python3 "Python 3.7 64-bit" ${prefix}\assets\python37-x64.exe 
${prefix}\python37-x64 ${pip}
 Install-Python3 "Python 3.8 32-bit" ${prefix}\assets\python38-x86.exe 
${prefix}\python38-x86 ${pip}
-Install-Python3 "Python 3.8 64-bit" ${prefix}\assets\python38-x64.exe 
${prefix}\python38-x64 ${pip}
+#Install-Python3 "Python 3.8 64-bit" ${prefix}\assets\python38-x64.exe 
${prefix}\python38-x64 ${pip}
 Install-Python3 "Python 3.9 32-bit" ${prefix}\assets\python39-x86.exe 
${prefix}\python39-x86 ${pip}
 Install-Python3 "Python 3.9 64-bit" ${prefix}\assets\python39-x64.exe 
${prefix}\python39-x64 ${pip}
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11273: contrib: drop python2.7 from the Windows dependency install script

2021-08-09 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  While we aren't quite ready to drop py27 yet, the MS compiler is no longer
  available from MS (there is a copy on github if it's really needed), and that
  causes the script to fail.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11273

AFFECTED FILES
  contrib/install-windows-dependencies.ps1

CHANGE DETAILS

diff --git a/contrib/install-windows-dependencies.ps1 
b/contrib/install-windows-dependencies.ps1
--- a/contrib/install-windows-dependencies.ps1
+++ b/contrib/install-windows-dependencies.ps1
@@ -19,14 +19,6 @@
 $VS_BUILD_TOOLS_URL = 
"https://download.visualstudio.microsoft.com/download/pr/a1603c02-8a66-4b83-b821-811e3610a7c4/aa2db8bb39e0cbd23e9940d8951e0bc3/vs_buildtools.exe";
 $VS_BUILD_TOOLS_SHA256 = 
"911E292B8E6E5F46CBC17003BDCD2D27A70E616E8D5E6E69D5D489A605CAA139"
 
-$VC9_PYTHON_URL = 
"https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi";
-$VC9_PYTHON_SHA256 = 
"070474db76a2e625513a5835df4595df9324d820f9cc97eab2a596dcbc2f5cbf"
-
-$PYTHON27_x64_URL = 
"https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi";
-$PYTHON27_x64_SHA256 = 
"b74a3afa1e0bf2a6fc566a7b70d15c9bfabba3756fb077797d16fffa27800c05"
-$PYTHON27_X86_URL = 
"https://www.python.org/ftp/python/2.7.18/python-2.7.18.msi";
-$PYTHON27_X86_SHA256 = 
"d901802e90026e9bad76b8a81f8dd7e43c7d7e8269d9281c9e9df7a9c40480a9"
-
 $PYTHON37_x86_URL = "https://www.python.org/ftp/python/3.7.9/python-3.7.9.exe";
 $PYTHON37_x86_SHA256 = 
"769bb7c74ad1df6d7d74071cc16a984ff6182e4016e11b8949b93db487977220"
 $PYTHON37_X64_URL = 
"https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe";
@@ -137,9 +129,6 @@
 
 $pip = "${prefix}\assets\get-pip.py"
 
-Secure-Download $VC9_PYTHON_URL ${prefix}\assets\VCForPython27.msi 
$VC9_PYTHON_SHA256
-Secure-Download $PYTHON27_x86_URL ${prefix}\assets\python27-x86.msi 
$PYTHON27_x86_SHA256
-Secure-Download $PYTHON27_x64_URL ${prefix}\assets\python27-x64.msi 
$PYTHON27_x64_SHA256
 Secure-Download $PYTHON37_x86_URL ${prefix}\assets\python37-x86.exe 
$PYTHON37_x86_SHA256
 Secure-Download $PYTHON37_x64_URL ${prefix}\assets\python37-x64.exe 
$PYTHON37_x64_SHA256
 Secure-Download $PYTHON38_x86_URL ${prefix}\assets\python38-x86.exe 
$PYTHON38_x86_SHA256
@@ -155,16 +144,6 @@
 Secure-Download $RUSTUP_INIT_URL ${prefix}\assets\rustup-init.exe 
$RUSTUP_INIT_SHA256
 Secure-Download $PYOXIDIZER_URL ${prefix}\assets\PyOxidizer.msi 
$PYOXIDIZER_SHA256
 
-Write-Output "installing Python 2.7 32-bit"
-Invoke-Process msiexec.exe "/i ${prefix}\assets\python27-x86.msi /l* 
${prefix}\assets\python27-x86.log /q TARGETDIR=${prefix}\python27-x86 ALLUSERS="
-Invoke-Process ${prefix}\python27-x86\python.exe 
${prefix}\assets\get-pip.py
-Invoke-Process ${prefix}\python27-x86\Scripts\pip.exe "install 
${prefix}\assets\virtualenv.tar.gz"
-
-Write-Output "installing Python 2.7 64-bit"
-Invoke-Process msiexec.exe "/i ${prefix}\assets\python27-x64.msi /l* 
${prefix}\assets\python27-x64.log /q TARGETDIR=${prefix}\python27-x64 ALLUSERS="
-Invoke-Process ${prefix}\python27-x64\python.exe 
${prefix}\assets\get-pip.py
-Invoke-Process ${prefix}\python27-x64\Scripts\pip.exe "install 
${prefix}\assets\virtualenv.tar.gz"
-
 Install-Python3 "Python 3.7 32-bit" ${prefix}\assets\python37-x86.exe 
${prefix}\python37-x86 ${pip}
 Install-Python3 "Python 3.7 64-bit" ${prefix}\assets\python37-x64.exe 
${prefix}\python37-x64 ${pip}
 Install-Python3 "Python 3.8 32-bit" ${prefix}\assets\python38-x86.exe 
${prefix}\python38-x86 ${pip}
@@ -180,9 +159,6 @@
 
 Install-Rust ${prefix}
 
-Write-Output "installing Visual C++ 9.0 for Python 2.7"
-Invoke-Process msiexec.exe "/i ${prefix}\assets\VCForPython27.msi /l* 
${prefix}\assets\VCForPython27.log /q"
-
 Write-Output "installing Inno Setup"
 Invoke-Process ${prefix}\assets\InnoSetup.exe "/SP- /VERYSILENT 
/SUPPRESSMSGBOXES"
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11272: contrib: log the command and args for every process installing windows deps

2021-08-09 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is a little noisier, but makes it simple to debug when things fail.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11272

AFFECTED FILES
  contrib/install-windows-dependencies.ps1

CHANGE DETAILS

diff --git a/contrib/install-windows-dependencies.ps1 
b/contrib/install-windows-dependencies.ps1
--- a/contrib/install-windows-dependencies.ps1
+++ b/contrib/install-windows-dependencies.ps1
@@ -91,6 +91,8 @@
 }
 
 function Invoke-Process($path, $arguments) {
+echo "$path $arguments"
+
 $p = Start-Process -FilePath $path -ArgumentList $arguments -Wait 
-PassThru -WindowStyle Hidden
 
 if ($p.ExitCode -ne 0) {



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11240: windows: avoid a bytes vs unicode crash reading passwords on py2

2021-08-02 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This broke in 5b3513177f2b 
.  
Specifically, after typing in the password on py2,
  it would crash with:
  
TypeError: putwch() argument 1 must be cannot convert raw buffers, not str

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11240

AFFECTED FILES
  mercurial/windows.py

CHANGE DETAILS

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -200,20 +200,20 @@
 This shouldn't be called directly- use ``ui.getpass()`` instead, which
 checks if the session is interactive first.
 """
-pw = ""
+pw = u""
 while True:
 c = msvcrt.getwch()  # pytype: disable=module-attr
-if c == '\r' or c == '\n':
+if c == u'\r' or c == u'\n':
 break
-if c == '\003':
+if c == u'\003':
 raise KeyboardInterrupt
-if c == '\b':
+if c == u'\b':
 pw = pw[:-1]
 else:
 pw = pw + c
-msvcrt.putwch('\r')  # pytype: disable=module-attr
-msvcrt.putwch('\n')  # pytype: disable=module-attr
-return encoding.strtolocal(pw)
+msvcrt.putwch(u'\r')  # pytype: disable=module-attr
+msvcrt.putwch(u'\n')  # pytype: disable=module-attr
+return encoding.unitolocal(pw)
 
 
 class winstdout(object):



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11235: typing: add several assertions to dirstatemap to appease pytype

2021-07-29 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I think it's been mentioned in IRC that these can't be None in this case.  
This
  fixes:
  
File "/mnt/c/Users/Matt/hg/mercurial/dirstatemap.py", line 213, in addfile: 
unsupported operand type(s) for &: 'None' and 'int' [unsupported-operands]
  No attribute '__and__' on None or '__rand__' on int
Called from (traceback):
  line 290, in reset_state
File "/mnt/c/Users/Matt/hg/mercurial/dirstatemap.py", line 214, in addfile: 
unsupported operand type(s) for &: 'None' and 'int' [unsupported-operands]
  No attribute '__and__' on None or '__rand__' on int
Called from (traceback):
  line 290, in reset_state

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D11235

AFFECTED FILES
  mercurial/dirstatemap.py

CHANGE DETAILS

diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py
--- a/mercurial/dirstatemap.py
+++ b/mercurial/dirstatemap.py
@@ -209,6 +209,9 @@
 else:
 assert size != FROM_P2
 assert size != NONNORMAL
+assert size is not None
+assert mtime is not None
+
 state = b'n'
 size = size & rangemask
 mtime = mtime & rangemask



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11206: typing: convert an annotation to an assertion in commands.py

2021-07-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Pytype was happy with the annotation at one point, but 2021.04.15 now 
complains.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11206

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3341,7 +3341,8 @@
 )
 # checking that newnodes exist because old state files won't have 
it
 elif statedata.get(b'newnodes') is not None:
-nn = statedata[b'newnodes']  # type: List[bytes]
+nn = statedata[b'newnodes']
+assert isinstance(nn, list)  # list of bytes
 nn.append(node)
 
 # remove state when we complete successfully



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11207: upgrade: byteify an i18n message

2021-07-21 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11207

AFFECTED FILES
  mercurial/upgrade_utils/engine.py

CHANGE DETAILS

diff --git a/mercurial/upgrade_utils/engine.py 
b/mercurial/upgrade_utils/engine.py
--- a/mercurial/upgrade_utils/engine.py
+++ b/mercurial/upgrade_utils/engine.py
@@ -66,7 +66,7 @@
 # drop the extension and the `data/` prefix
 path_part = path.rsplit(b'.', 1)[0].split(b'/', 1)
 if len(path_part) < 2:
-msg = _('cannot recognize revlog from filename: %s')
+msg = _(b'cannot recognize revlog from filename: %s')
 msg %= path
 raise error.Abort(msg)
 path = path_part[1]



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D11036: doc: wrap the help text for the purge extension

2021-07-09 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Not sure why `black` or some other checker didn't complain about this.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11036

AFFECTED FILES
  hgext/purge.py

CHANGE DETAILS

diff --git a/hgext/purge.py b/hgext/purge.py
--- a/hgext/purge.py
+++ b/hgext/purge.py
@@ -25,7 +25,8 @@
 '''command to delete untracked files from the working directory (DEPRECATED)
 
 The functionality of this extension has been included in core Mercurial since
-version 5.7. Please use :hg:`purge ...` instead. :hg:`purge --confirm` is now 
the default, unless the extension is enabled for backward compatibility.
+version 5.7. Please use :hg:`purge ...` instead. :hg:`purge --confirm` is now
+the default, unless the extension is enabled for backward compatibility.
 '''
 
 # This empty extension looks pointless, but core mercurial checks if it's 
loaded



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10895: purge: restore the `testedwith` declaration

2021-06-22 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Otherwise, this extension gets highlighted as a 3rd party extension when an
  exception occurs.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10895

AFFECTED FILES
  hgext/purge.py

CHANGE DETAILS

diff --git a/hgext/purge.py b/hgext/purge.py
--- a/hgext/purge.py
+++ b/hgext/purge.py
@@ -30,3 +30,9 @@
 
 # This empty extension looks pointless, but core mercurial checks if it's 
loaded
 # to implement the slightly different behavior documented above.
+
+# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
+# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
+# be specifying the version(s) of Mercurial they are tested with, or
+# leave the attribute unspecified.
+testedwith = b'ships-with-hg-core'



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10876: typing: suppress a false error in mercurial/revlogutils/docket.py on py2

2021-06-12 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  `ord()` wants bytes or str on py3, so I'm guessing it got confused by passing 
a
  single byte instead of a one byte string.  But this seems to work on 2.7.18
  anyway.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10876

AFFECTED FILES
  mercurial/revlogutils/docket.py

CHANGE DETAILS

diff --git a/mercurial/revlogutils/docket.py b/mercurial/revlogutils/docket.py
--- a/mercurial/revlogutils/docket.py
+++ b/mercurial/revlogutils/docket.py
@@ -60,7 +60,9 @@
 if pycompat.ispy3:
 iter_seed = iter(seed)
 else:
+# pytype: disable=wrong-arg-types
 iter_seed = (ord(c) for c in seed)
+# pytype: enable=wrong-arg-types
 # some basic circular sum hashing on 64 bits
 int_seed = 0
 low_mask = int('1' * 35, 2)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10873: py3: byteify the version string passed to the deprecation warning method

2021-06-11 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The other callers were already correct.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10873

AFFECTED FILES
  mercurial/localrepo.py
  mercurial/ui.py
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -688,7 +688,7 @@
 path to a repo.
 """
 msg = b'getpath is deprecated, use `get_*` functions from urlutil'
-ui.deprecwarn(msg, '6.0')
+ui.deprecwarn(msg, b'6.0')
 # Only fall back to default if no path was requested.
 if name is None:
 if not default:
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1065,7 +1065,7 @@
 This method exist as `getpath` need a ui for potential warning message.
 """
 msg = b'ui.getpath is deprecated, use `get_*` functions from urlutil'
-self.deprecwarn(msg, '6.0')
+self.deprecwarn(msg, b'6.0')
 return self.paths.getpath(self, *args, **kwargs)
 
 @property
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -2759,7 +2759,7 @@
 "`full` argument for `repo.updatecaches` is deprecated\n"
 "(use `caches=repository.CACHE_ALL` instead)"
 )
-self.ui.deprecwarn(msg, "5.9")
+self.ui.deprecwarn(msg, b"5.9")
 caches = repository.CACHES_ALL
 if full == b"post-clone":
 caches = repository.CACHES_POST_CLONE



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10875: revlog: byteify a few error strings

2021-06-11 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10875

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1760,7 +1760,7 @@
 elif compression_mode == COMP_MODE_INLINE:
 return self.decompress(data)
 else:
-msg = 'unknown compression mode %d'
+msg = b'unknown compression mode %d'
 msg %= compression_mode
 raise error.RevlogError(msg)
 
@@ -1826,7 +1826,7 @@
 elif comp_mode == COMP_MODE_DEFAULT:
 ladd(def_decomp(c))
 else:
-msg = 'unknown compression mode %d'
+msg = b'unknown compression mode %d'
 msg %= comp_mode
 raise error.RevlogError(msg)
 
@@ -2054,7 +2054,7 @@
 elif comp == COMP_MODE_INLINE:
 segment = self.decompress(comp_segment)
 else:
-msg = 'unknown compression mode %d'
+msg = b'unknown compression mode %d'
 msg %= comp
 raise error.RevlogError(msg)
 



To: mharbison72, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10874: revlog: fix a typo closing the wrong file

2021-06-11 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Caught by pytype as possibly being None, but the file is closed in the 
previous
  conditional.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10874

AFFECTED FILES
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -2243,7 +2243,7 @@
 if dfh is not None:
 dfh.close()
 if sdfh is not None:
-dfh.close()
+sdfh.close()
 # closing the index file last to avoid exposing referent to
 # potential unflushed data content.
 if ifh is not None:



To: mharbison72, indygreg, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10872: urlutil: byteify several localized messages

2021-06-11 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Flagged by pytype.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10872

AFFECTED FILES
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -538,10 +538,12 @@
 dests = list(get_push_paths(repo, ui, dests))
 if len(dests) != 1:
 if dest is None:
-msg = _("default path points to %d urls while %s only supports 
one")
+msg = _(
+b"default path points to %d urls while %s only supports one"
+)
 msg %= (len(dests), action)
 else:
-msg = _("path points to %d urls while %s only supports one: %s")
+msg = _(b"path points to %d urls while %s only supports one: %s")
 msg %= (len(dests), action, dest)
 raise error.Abort(msg)
 return dests[0]
@@ -577,10 +579,12 @@
 urls.append(source)
 if len(urls) != 1:
 if source is None:
-msg = _("default path points to %d urls while %s only supports 
one")
+msg = _(
+b"default path points to %d urls while %s only supports one"
+)
 msg %= (len(urls), action)
 else:
-msg = _("path points to %d urls while %s only supports one: %s")
+msg = _(b"path points to %d urls while %s only supports one: %s")
 msg %= (len(urls), action, source)
 raise error.Abort(msg)
 return parseurl(urls[0], default_branches)
@@ -609,11 +613,11 @@
 if len(urls) != 1:
 if source is None:
 msg = _(
-"default path points to %d urls while only one is supported"
+b"default path points to %d urls while only one is supported"
 )
 msg %= len(urls)
 else:
-msg = _("path points to %d urls while only one is supported: %s")
+msg = _(b"path points to %d urls while only one is supported: %s")
 msg %= (len(urls), source)
 raise error.Abort(msg)
 url = urls[0]



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10871: urlutil: use the deprecation warning function on the `ui` object

2021-06-11 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  PyCharm flagged this as not existing, and I suspect a copy/paste error.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10871

AFFECTED FILES
  mercurial/utils/urlutil.py

CHANGE DETAILS

diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py
--- a/mercurial/utils/urlutil.py
+++ b/mercurial/utils/urlutil.py
@@ -684,7 +684,7 @@
 path to a repo.
 """
 msg = b'getpath is deprecated, use `get_*` functions from urlutil'
-self.deprecwarn(msg, '6.0')
+ui.deprecwarn(msg, '6.0')
 # Only fall back to default if no path was requested.
 if name is None:
 if not default:



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10870: typing: disable warnings for a couple of Windows specific attributes

2021-06-11 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10870

AFFECTED FILES
  mercurial/windows.py

CHANGE DETAILS

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -202,7 +202,7 @@
 """
 pw = ""
 while True:
-c = msvcrt.getwch()
+c = msvcrt.getwch()  # pytype: disable=module-attr
 if c == '\r' or c == '\n':
 break
 if c == '\003':
@@ -211,8 +211,8 @@
 pw = pw[:-1]
 else:
 pw = pw + c
-msvcrt.putwch('\r')
-msvcrt.putwch('\n')
+msvcrt.putwch('\r')  # pytype: disable=module-attr
+msvcrt.putwch('\n')  # pytype: disable=module-attr
 return encoding.strtolocal(pw)
 
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10763: tests: partially fix test-transaction-rollback-on-revlog-split.t on Windows

2021-05-20 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  For whatever reason, the extra space causes different output on Windows:
  
$ printf '% 20d' '1' | xxd -
000: 2020 2020 2020 2020 2020 2020 2020 2020
010: 2020 2020 31 1
  
  vs WSL:
  
/mnt/c/Users/Matt/hg/tests$ printf '% 20d' '1' | xxd -
: 2020 2020 2020 2020 2020 2020 2020 2020
0010: 2020 2031
  
  Without the space, they both agree the last word is 2031.  There are other
  failures on Windows that I don't understand that are introduced by 
46b828b85eb7 

  and 18415fc918a1 
.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10763

AFFECTED FILES
  tests/test-transaction-rollback-on-revlog-split.t

CHANGE DETAILS

diff --git a/tests/test-transaction-rollback-on-revlog-split.t 
b/tests/test-transaction-rollback-on-revlog-split.t
--- a/tests/test-transaction-rollback-on-revlog-split.t
+++ b/tests/test-transaction-rollback-on-revlog-split.t
@@ -28,9 +28,9 @@
 
   $ hg init troffset-computation --config format.revlog-compression=none
   $ cd troffset-computation
-  $ printf '% 20d' '1' > file
+  $ printf '%20d' '1' > file
   $ hg commit -Aqm_
-  $ printf '% 1024d' '1' > file
+  $ printf '%1024d' '1' > file
   $ hg commit -Aqm_
   $ dd if=/dev/zero of=file bs=1k count=128 > /dev/null 2>&1
   $ hg commit -Aqm_



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10762: tests: fix test-transaction-safety.t on Windows

2021-05-20 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Mostly this is about `C:\dir\sub` style paths being turned into `C:dirsub` by
  MSYS, and not being about to execute shell scripts in hooks directly.  See 
also
  a12819559ccb 
::9e3979a25bfe
 .

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10762

AFFECTED FILES
  tests/test-transaction-safety.t

CHANGE DETAILS

diff --git a/tests/test-transaction-safety.t b/tests/test-transaction-safety.t
--- a/tests/test-transaction-safety.t
+++ b/tests/test-transaction-safety.t
@@ -54,17 +54,15 @@
   $ export HG_TEST_FILE_EXT_DONE
   $ cat << EOF > script/external.sh
   > #!/bin/sh
-  > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_UNLOCK 
$HG_TEST_FILE_EXT_WAITING
-  > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > 
$TESTTMP/output/external.out
-  > touch $HG_TEST_FILE_EXT_DONE
+  > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_UNLOCK" 
"$HG_TEST_FILE_EXT_WAITING"
+  > hg log --rev 'tip' -T 'external: {rev} {desc}\n' > 
"$TESTTMP/output/external.out"
+  > touch "$HG_TEST_FILE_EXT_DONE"
   > EOF
-  $ chmod +x script/external.sh
   $ cat << EOF > script/internal.sh
   > #!/bin/sh
-  > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > 
$TESTTMP/output/internal.out
-  > $RUNTESTDIR/testlib/wait-on-file 5 $HG_TEST_FILE_EXT_DONE 
$HG_TEST_FILE_EXT_UNLOCK
+  > hg log --rev 'tip' -T 'internal: {rev} {desc}\n' > 
"$TESTTMP/output/internal.out"
+  > "$RUNTESTDIR/testlib/wait-on-file" 5 "$HG_TEST_FILE_EXT_DONE" 
"$HG_TEST_FILE_EXT_UNLOCK"
   > EOF
-  $ chmod +x script/internal.sh
 
 
 Automated commands:
@@ -74,7 +72,7 @@
   > rm -f $TESTTMP/output/*
   > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
   > echo x >> a
-  > $TESTTMP/script/external.sh & hg commit -m "$1"
+  > sh $TESTTMP/script/external.sh & hg commit -m "$1"
   > cat $TESTTMP/output/external.out
   > cat $TESTTMP/output/internal.out
   > hg log --rev 'tip' -T 'post-tr:  {rev} {desc}\n'
@@ -86,7 +84,7 @@
   > rm -f $TESTTMP/output/*
   > hg log --rev 'tip' -T 'pre-commit: {rev} {desc}\n'
   > echo x >> a
-  > $TESTTMP/script/external.sh & hg pull ../other-repo/ --rev "$1" --force 
--quiet
+  > sh $TESTTMP/script/external.sh & hg pull ../other-repo/ --rev "$1" --force 
--quiet
   > cat $TESTTMP/output/external.out
   > cat $TESTTMP/output/internal.out
   > hg log --rev 'tip' -T 'post-tr:  {rev} {desc}\n'
@@ -122,7 +120,7 @@
   > [extensions]
   > small_inline=$TESTTMP/ext/small_inline.py
   > [hooks]
-  > pretxnclose = $TESTTMP/script/internal.sh
+  > pretxnclose = sh $TESTTMP/script/internal.sh
   > EOF
 
 check this is true for the initial commit (inline → inline)



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10760: run-tests: enable color on Windows

2021-05-20 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  In setting up the CI for Windows on heptapod, I noticed it was complaining 
about
  color not being enabled because pygments wasn't installed- even though it was.
  I had initially disabled color on Windows when using Windows 7, because that
  didn't understand ANSI color codes and made a mess of the output.  But now 
that
  it's been unsupported for over a year, I don't think we should care about it
  either.
  
  It's admittedly a hack to depend on Mercurial proper to enable color support 
in
  the terminal, but I didn't feel like duplicating that code.  I'm under the
  impression that 3rd party stuff is supposed to use this runner in the 
Mercurial
  repo instead of using their own copy, so I think it's safe to assume the
  Mercurial code is available.  If it's not, it won't break anything.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10760

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -87,21 +87,31 @@
 processlock = threading.Lock()
 
 pygmentspresent = False
-# ANSI color is unsupported prior to Windows 10
-if os.name != 'nt':
-try:  # is pygments installed
-import pygments
-import pygments.lexers as lexers
-import pygments.lexer as lexer
-import pygments.formatters as formatters
-import pygments.token as token
-import pygments.style as style
-
-pygmentspresent = True
-difflexer = lexers.DiffLexer()
-terminal256formatter = formatters.Terminal256Formatter()
-except ImportError:
-pass
+try:  # is pygments installed
+import pygments
+import pygments.lexers as lexers
+import pygments.lexer as lexer
+import pygments.formatters as formatters
+import pygments.token as token
+import pygments.style as style
+
+if os.name == 'nt':
+hgpath = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+sys.path.append(hgpath)
+try:
+from mercurial import win32  # pytype: disable=import-error
+
+# Don't check the result code because it fails on heptapod, but
+# something is able to convert to color anyway.
+win32.enablevtmode()
+finally:
+sys.path = sys.path[:-1]
+
+pygmentspresent = True
+difflexer = lexers.DiffLexer()
+terminal256formatter = formatters.Terminal256Formatter()
+except ImportError:
+pass
 
 if pygmentspresent:
 



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10761: run-tests: disable color in 'auto' mode on Windows if stdout is redirected

2021-05-20 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10761

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2211,7 +2211,13 @@
 self.faildata = {}
 
 if options.color == 'auto':
-self.color = pygmentspresent and self.stream.isatty()
+isatty = self.stream.isatty()
+# For some reason, redirecting stdout on Windows disables the ANSI
+# color processing of stderr, which is what is used to print the
+# output.  Therefore, both must be tty on Windows to enable color.
+if os.name == 'nt':
+isatty = isatty and sys.stdout.isatty()
+self.color = pygmentspresent and isatty
 elif options.color == 'never':
 self.color = False
 else:  # 'always', for testing purposes



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10759: tests: monkeypatch `util.get_password()` to avoid deadlocks on Windows

2021-05-20 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This should have been part of 5b3513177f2b 
.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

REVISION DETAIL
  https://phab.mercurial-scm.org/D10759

AFFECTED FILES
  tests/test-http-bundle1.t
  tests/test-http.t
  tests/test-largefiles-wireproto.t

CHANGE DETAILS

diff --git a/tests/test-largefiles-wireproto.t 
b/tests/test-largefiles-wireproto.t
--- a/tests/test-largefiles-wireproto.t
+++ b/tests/test-largefiles-wireproto.t
@@ -425,10 +425,10 @@
   >  -d -p $HGPORT --pid-file hg.pid -A access.log
   $ cat hg.pid >> $DAEMON_PIDS
   $ cat << EOF > get_pass.py
-  > import getpass
-  > def newgetpass(arg):
+  > from mercurial import util
+  > def newgetpass():
   >   return "pass"
-  > getpass.getpass = newgetpass
+  > util.get_password = newgetpass
   > EOF
   $ hg clone --config ui.interactive=true --config 
extensions.getpass=get_pass.py \
   >  http://user@localhost:$HGPORT credentialclone
diff --git a/tests/test-http.t b/tests/test-http.t
--- a/tests/test-http.t
+++ b/tests/test-http.t
@@ -181,10 +181,10 @@
   $ cat pid >> $DAEMON_PIDS
 
   $ cat << EOF > get_pass.py
-  > import getpass
-  > def newgetpass(arg):
+  > from mercurial import util
+  > def newgetpass():
   >   return "pass"
-  > getpass.getpass = newgetpass
+  > util.get_password = newgetpass
   > EOF
 
   $ hg id http://localhost:$HGPORT2/
diff --git a/tests/test-http-bundle1.t b/tests/test-http-bundle1.t
--- a/tests/test-http-bundle1.t
+++ b/tests/test-http-bundle1.t
@@ -192,10 +192,10 @@
   $ cat pid >> $DAEMON_PIDS
 
   $ cat << EOF > get_pass.py
-  > import getpass
-  > def newgetpass(arg):
+  > from mercurial import util
+  > def newgetpass():
   >   return "pass"
-  > getpass.getpass = newgetpass
+  > util.get_password = newgetpass
   > EOF
 
   $ hg id http://localhost:$HGPORT2/



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D10756: exewrapper: avoid directly linking against python3X.dll

2021-05-20 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Subsequent code calls `LoadLibrary()` to attempt to load the DLL, but because 
of
  this symbol reference, there is an attempt to load the DLL used during the 
build
  prior to `_main()` running.  This causes the whole process to fail if the DLL
  isn't in the standard search path.  That also means it will never load the DLL
  for HackableMercurial.  (Maybe we should get rid of that for py3, since you 
can
  install python for a user without admin rights?)
  
  This could also be resolved by calling `GetProcAddress()` on the symbol and
  dereferencing it, but using the environment variable is consistent with the
  *.bat file since fc8a5c9ecee0 
.  
(The environment variable persists after the
  interpreter is initialized.)
  
  Far more concerning is somehow I've gotten my system into a state where 
setting
  the flag causes any output to the pager to be lost (as if it wasn't set at 
all)
  in MSYS, cmd.exe, WSL, and PowerShell using py3.9.0, but the environment
  variable works properly.  I'm sure this flag worked on some versions of py3, 
so
  I'm not sure what's going on here.  This is using py3.9.0.
  
  With or without the flag/envvar, there is proper output if the command is
  directly paged by piping to `more.com` (in any environment) or `less` (in MSYS
  and WSL), or if paging is disabled with `--pager=no`.  Legacy mode is required
  though when Mercurial decides to spin up a pager.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10756

AFFECTED FILES
  mercurial/exewrapper.c

CHANGE DETAILS

diff --git a/mercurial/exewrapper.c b/mercurial/exewrapper.c
--- a/mercurial/exewrapper.c
+++ b/mercurial/exewrapper.c
@@ -48,7 +48,7 @@
int(__cdecl * Py_Main)(int argc, TCHAR *argv[]);
 
 #if PY_MAJOR_VERSION >= 3
-   Py_LegacyWindowsStdioFlag = 1;
+   _wputenv(L"PYTHONLEGACYWINDOWSSTDIO=1");
 #endif
 
if (GetModuleFileName(NULL, pyscript, _countof(pyscript)) == 0) {



To: mharbison72, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


  1   2   3   4   5   6   7   8   9   10   >