D7144: status: use unfiltered repo if we're getting status of working copy

2019-11-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D7144#108444 , @marmoute 
wrote:
  
  > I took more time to look at your series and at the bigger picture. My 
general position is still that passing the wrong filter level to high level 
function is hacking and will be a significant source of bugs.
  
  I agree that it's a hack.
  
  > For example, `hg status` taks a "PATTERN" argument, that pattern can be 
fileset, that fileset can contains revset. PAssing the wrong filtering will 
result in wrongdoing of that revset.
  > However it might be a good idea to do this hack if:
  >
  > - the performance gain is significant,
  > - the hack is temporary,
  > - there is no reasonable alternative available short terms.
  >
  > I took some time to poke at the issues, and I managed to get all 4 commands 
listed in this series with a first throw of abotu 12 changesets. The idea is to 
recognise pattern that will not be filtered and to have lower level logic skip 
around the filtering in this case. So the higher level logic is still filtered 
with the right semantic. One can have a look at the very first throw here:  
https://dev.heptapod.net/octobus/mercurial-devel/commits/topic/default/filter-trigger
  
  I did something similar (but much smaller in scope) a long time ago: 
https://www.mercurial-scm.org/repo/hg/rev/a9b61dbdb827. That hack has since 
become ineffective, and I think some of your commits aim at restoring its 
effect. I felt that that approach was also fragile since quite subtle code 
changes can make it stop working (as has already happened with my original 
hack). So I'm not convinced that is the right approach either, but I'm fine 
with taking that series instead if you clean it up (I do see the risk of bugs 
with my series).
  
  Relatedly, I would really like to have the filtering applied only when 
walking towards children in the changelog (this is something that Durham has 
mentioned before), so no filtering happens even if you do `hg status -r ` or similar. But that's a much larger change, of course.
  
  > It is getting late so I will stop here for tonight. However, the prototype 
looks promissing enough. I can probably have a clean/consolidate version by the 
end of the week.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7144/new/

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

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


D7376: help: create packages for the help text

2019-11-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  Looks good to me, but I don't know Python well enough to say if 
`mercurial.help` and `mercurial.help.internal` should be "namespace packages" 
(which I think is what you're doing with the `pkgutil.extend_path()` stuff). 
I'd appreciate it if someone who knows Python better can comment.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7376/new/

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

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


Re: [PATCH 6 of 6] patchbomb: fix wrong argument type when calling mail generator.flatten()

2019-11-13 Thread Augie Fackler
queued, thanks

> On Nov 13, 2019, at 16:59, Denis Laxalde  wrote:
> 
> # HG changeset patch
> # User Denis Laxalde 
> # Date 1573661165 -3600
> #  Wed Nov 13 17:06:05 2019 +0100
> # Node ID 9ebd700f9dc4e27c0bd45dce1108f7a2255b
> # Parent  11d514fd71855ace61c549d3154f52569cea9264
> patchbomb: fix wrong argument type when calling mail generator.flatten()
> 
> diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
> --- a/hgext/patchbomb.py
> +++ b/hgext/patchbomb.py
> @@ -958,7 +958,7 @@ def email(ui, repo, *revs, **opts):
> ui.pager(b'email')
> generator = mail.Generator(ui, mangle_from_=False)
> try:
> -generator.flatten(m, 0)
> +generator.flatten(m, False)
> ui.write(b'\n')
> except IOError as inst:
> if inst.errno != errno.EPIPE:
> @@ -973,7 +973,7 @@ def email(ui, repo, *revs, **opts):
> del m['Bcc']
> fp = stringio()
> generator = mail.Generator(fp, mangle_from_=False)
> -generator.flatten(m, 0)
> +generator.flatten(m, False)
> alldests = to + bcc + cc
> sendmail(sender_addr, alldests, fp.getvalue())
> 
> 
> ___
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7387: packaging: add the config file for PyOxidizer

2019-11-13 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.
mharbison72 added a subscriber: martinvonz.
mharbison72 planned changes to this revision.


  This isn't meant to be queued.  I posted this to share with @martinvonz , and 
give it better visibility to anyone else interested than an IRC paste.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7387/new/

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

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


D7387: packaging: add the config file for PyOxidizer

2019-11-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added subscribers: mercurial-devel, mjpieters.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is the current file I'm using on Mac.  It *seems* like we can get away 
with
  a single config file for all platforms, so this platform agnostic location 
might
  work.  I'm not sure how to `pyoxidizer init .` to setup the other things when
  this file exists.
  
  Things mostly work on Mac, but there are a number of `__file__` references 
that
  need to be worked around, and the templates and default.d config needs to be
  moved to a package so that they can be accessed as resources.
  
  `hg config --debug` shows it looking at an extra config path near the
  executable.  This may be a side effect of being frozen, for py2app support.  
The
  executable is ~33MB, so it would be nice to slim it down.  Especially since
  there are a lot of instances of `__file__` in these unused modules that 
trigger
  build warnings.
  
  I'm not sure what the plans are to test this.  I've been using
  
python3 run-tests --with-hg=/path/to/oxidizedhg
  
  That emits a warning that `--with-hg` should point to an hg script, but it
  seems to surface problems.  The recent work has been mostly in test-help*.
  There are other errors in there when doing this, like get-with-headers.py
  complaining that it can't import `mercurial`.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/packaging/pyoxidizer/pyoxidizer.toml

CHANGE DETAILS

diff --git a/contrib/packaging/pyoxidizer/pyoxidizer.toml 
b/contrib/packaging/pyoxidizer/pyoxidizer.toml
new file mode 100644
--- /dev/null
+++ b/contrib/packaging/pyoxidizer/pyoxidizer.toml
@@ -0,0 +1,120 @@
+# This file controls the PyOxidizer build configuration. See the
+# pyoxidizer crate's documentation for extensive documentation
+# on this file format.
+
+[[build]]
+application_name = "hg"
+
+[[embedded_python_config]]
+raw_allocator = "jemalloc"
+
+# dont_write_bytecode = true
+# ignore_environment = true
+
+# TODO: enable one or both of these, so that extensions with a separate python
+#   module like mercurial_keyring can load.
+# no_site = true
+# no_user_site_directory = true
+
+
+# optimize_level = 0
+# stdio_encoding = "utf-8:strict"
+
+# Otherwise `hg pull` status is delayed.  No sign of a progress bar either way.
+unbuffered_stdio = true
+# write_modules_directory_env = "PYOXIDIZER_WRITE_MODULES_DIR"
+sys_frozen = true
+# sys_meipass = false
+
+# Windows doesn't support jemalloc.
+[[embedded_python_config]]
+build_target = "i686-pc-windows-msvc"
+raw_allocator = "system"
+
+[[embedded_python_config]]
+build_target = "x86_64-pc-windows-msvc"
+raw_allocator = "system"
+
+[[packaging_rule]]
+type = "stdlib-extensions-policy"
+
+# Package all available extension modules from the Python distribution.
+# The Python interpreter will be fully featured.
+policy = "all"
+
+# Package the entire Python standard library without sources.
+[[packaging_rule]]
+type = "stdlib"
+include_source = false
+
+# Write out license files next to the produced binary.
+[[packaging_rule]]
+type = "write-license-files"
+path = ""
+
+
+# XXX: This doesn't seem to work? (Or at least it still warns about __file__
+#  in these, both when here and if `type = "stdlib"`)
+[[packaging_rule]]
+type = "stdlib-extensions-explicit-excludes"
+excludes = ["setuptools", "pip", "pip._vendor", "distutils", "lib2to3",
+"unittest" ]
+
+
+# NOTE: in order to successfully bundle the C extensions with this, you must
+# `make -C /path/to/hg/repo clean` and touch this file before *each*
+# `pyoxidizer build`.  This also doesn't currently work on Windows- use
+# `type = "virtualenv"` instead.
+[[packaging_rule]]
+type = "setup-py-install"
+package_path = "/Users/mharbison/mercurial_py3"
+include_source = false
+
+
+[[packaging_rule]]
+type = "pip-install-simple"
+package = "hg-evolve==9.2.1"
+include_source = false
+
+
+# TODO: figure out how to convince it to run the hg script in the repo root.
+[[embedded_python_run]]
+mode = "eval"
+code = "import hgdemandimport; hgdemandimport.enable(); from mercurial import 
dispatch; dispatch.run()"
+
+
+
+[[distribution]]
+type = "wix"
+
+# END OF COMMON USER-ADJUSTED SETTINGS.
+#
+# Everything below this is typically managed by PyOxidizer and doesn't need
+# to be updated by people.
+
+[[python_distribution]]
+build_target = "i686-pc-windows-msvc"
+url = 
"https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-windows-x86-20191025T0549.tar.zst;
+sha256 = "388d37bcffee183bc23f5fec9c263779c59d298d35c9e4445b407d95f94db19c"
+[[python_distribution]]
+build_target = "x86_64-apple-darwin"
+url = 
"https://github.com/indygreg/python-build-standalone/releases/download/20191025/cpython-3.7.5-macos-20191026T0535.tar.zst;
+sha256 = "e8d0710627c017213d9c5c6496577539a5adceb56d3060e07954ce9bf59f39ae"
+[[python_distribution]]
+build_target 

D7386: help: access text files as resources under PyOxidizer

2019-11-13 Thread mharbison72 (Matt Harbison)
mharbison72 added a comment.
mharbison72 added a subscriber: indygreg.


  It looks like py2app puts it's name in `sys.frozen`[1], instead of just 
making it `True`/`False`.  Should PyOxidizer do the same @indygreg ?
  
  I don't have any idea why the error on Windows (I even disabled pager).  I 
know I had trouble with `hg.exe` until I started setting 
`Py_LegacyWindowsStdioFlag = 1`.
  
  [1] https://www.mercurial-scm.org/repo/hg/file/5.2/mercurial/util.py#l1829

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7386/new/

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

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


D7380: encoding: define per-use identity functions only in typechecking mode

2019-11-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  Let's not land this for now: it's breaking a fair amount of typechecking. :(

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7380/new/

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

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


D7386: help: access text files as resources under PyOxidizer

2019-11-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This allows `hg help revsets` to run on an oxidized Mac executable.  I left 
the
  old path in place for py2 support, as well as the other packaging apps.
  
  On Windows, that same command simply prints:
  
abort: Incorrect function
  
  ... and doesn't put out a stacktrace even with `--traceback`.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/help.py

CHANGE DETAILS

diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -10,6 +10,7 @@
 import itertools
 import os
 import re
+import sys
 import textwrap
 
 from .i18n import (
@@ -310,12 +311,26 @@
 def loaddoc(topic, subdir=None):
 """Return a delayed loader for help/topic.txt."""
 
+if getattr(sys, 'oxidized', None):
+from importlib import resources
+
+def _docdata():
+docpkg = b'mercurial.helptext'
+if subdir:
+docpkg += b'.' + subdir
+with resources.open_binary(pycompat.sysstr(docpkg),
+   pycompat.sysstr(topic + b".txt")) as dh:
+return dh.read()
+else:
+def _docdata():
+docdir = os.path.join(util.datapath, b'helptext')
+if subdir:
+docdir = os.path.join(docdir, subdir)
+path = os.path.join(docdir, topic + b".txt")
+return util.readfile(path)
+
 def loader(ui):
-docdir = os.path.join(util.datapath, b'helptext')
-if subdir:
-docdir = os.path.join(docdir, subdir)
-path = os.path.join(docdir, topic + b".txt")
-doc = gettext(util.readfile(path))
+doc = gettext(_docdata())
 for rewriter in helphooks.get(topic, []):
 doc = rewriter(ui, topic, doc)
 return doc



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


D7384: commands: necessary annotations and suppresssions to pass pytype

2019-11-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  As with other places, there are some places where our types are just
  too complicated for pytype, so we put some suppressions in place.

REPOSITORY
  rHG Mercurial

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

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
@@ -72,6 +72,15 @@
 stringutil,
 )
 
+if not globals():
+from typing import (
+Any,
+Dict,
+)
+
+for t in (Any, Dict):
+assert t
+
 table = {}
 table.update(debugcommandsmod.command._table)
 
@@ -1108,7 +1117,14 @@
 finally:
 state[b'current'] = [node]
 hbisect.save_state(repo, state)
-hbisect.printresult(ui, repo, state, displayer, nodes, bgood)
+hbisect.printresult(
+ui,
+repo,
+state,
+displayer,
+nodes,
+bgood,  # pytype: disable=name-error
+)
 return
 
 hbisect.checkstate(state)
@@ -2970,7 +2986,7 @@
 if opts.get(b'base'):
 basectx = scmutil.revsingle(repo, opts[b'base'], None)
 # a dict of data to be stored in state file
-statedata = {}
+statedata = {}  # type: Dict[bytes, Any]
 # list of new nodes created by ongoing graft
 statedata[b'newnodes'] = []
 
@@ -3240,7 +3256,8 @@
 )
 # checking that newnodes exist because old state files won't have 
it
 elif statedata.get(b'newnodes') is not None:
-statedata[b'newnodes'].append(node)
+l = statedata[b'newnodes']
+l.append(node)  # pytype: disable=attribute-error
 
 # remove state when we complete successfully
 if not opts.get(b'dry_run'):
@@ -4731,7 +4748,11 @@
 if copies:
 endrev = None
 if revs:
-endrev = revs.max() + 1
+# If we're here, we know revs is a smartset.baseset
+# because we're not possibly in the linerange mode. Sadly,
+# pytype isn't convinced, so we have to suppress the
+# warning about list not having a max() method.
+endrev = revs.max() + 1  # pytype: disable=attribute-error
 getcopies = scmutil.getcopiesfn(repo, endrev=endrev)
 
 ui.pager(b'log')
@@ -7177,11 +7198,13 @@
 t = []
 if incoming:
 t.append(_(b'1 or more incoming'))
-o = outgoing.missing
+o = outgoing.missing  # pytype: disable=attribute-error
 if o:
 t.append(_(b'%d outgoing') % len(o))
 other = dother or sother
-if b'bookmarks' in other.listkeys(b'namespaces'):
+if b'bookmarks' in other.listkeys(  # pytype: disable=attribute-error
+b'namespaces'
+):
 counts = bookmarks.summary(repo, other)
 if counts[0] > 0:
 t.append(_(b'%d incoming bookmarks') % counts[0])



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


D7385: debugcommands: suppress import errors for pytype

2019-11-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1543,7 +1543,7 @@
 err = None
 try:
 if cext:
-from .cext import (
+from .cext import (  # pytype: disable=import-error
 base85,
 bdiff,
 mpatch,
@@ -1553,7 +1553,7 @@
 # quiet pyflakes
 dir(bdiff), dir(mpatch), dir(base85), dir(osutil)
 if rustext:
-from .rustext import (
+from .rustext import (  # pytype: disable=import-error
 ancestor,
 dirstate,
 )



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


D7295: pytype: add a (very slow) test that executes pytype

2019-11-13 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 18072.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7295?vs=17665=18072

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7295/new/

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

AFFECTED FILES
  tests/test-check-pytype.t

CHANGE DETAILS

diff --git a/tests/test-check-pytype.t b/tests/test-check-pytype.t
new file mode 100644
--- /dev/null
+++ b/tests/test-check-pytype.t
@@ -0,0 +1,37 @@
+#require pytype py3 slow
+
+  $ cd $RUNTESTDIR/..
+
+Many of the individual files that are excluded here confuse pytype
+because they do a mix of Python 2 and Python 3 things
+conditionally. There's no good way to help it out with that as far as
+I can tell, so let's just hide those files from it for now. We should
+endeavor to empty this list out over time, as some of these are
+probably hiding real problems.
+
+
+  $ pytype mercurial \
+  >-x mercurial/bundlerepo.py \
+  >-x mercurial/chgserver.py \
+  >-x mercurial/context.py \
+  >-x mercurial/crecord.py \
+  >-x mercurial/encoding.py \
+  >-x mercurial/error.py \
+  >-x mercurial/lsprof.py \
+  >-x mercurial/policy.py
+  >-x mercurial/pycompat.py \
+  >-x mercurial/urllibcompat.py \
+  >-x mercurial/i18n.py \
+  >-x mercurial/sslutil.py \
+  >-x mercurial/scmwindows.py \
+  >-x mercurial/keepalive.py \
+  >-x mercurial/windows.py \
+  >-x mercurial/wireprotoframing.py \
+  >-x mercurial/utils/stringutil.py \
+  >-x mercurial/hgweb/server.py \
+  >-x mercurial/hgweb/wsgicgi.py \
+  >-x mercurial/minirst.py \
+  >-x mercurial/interfaces \
+  >-x mercurial/cffi \
+  >-x mercurial/pure \
+  >-x mercurial/thirdparty



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


D7381: cmdutil: add a pytype annotation to help out some callsites

2019-11-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I think we could constrain the values here more than Any, but this
  lets us move forward with typechecking commands.py.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/cmdutil.py

CHANGE DETAILS

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -61,6 +61,15 @@
 stringutil,
 )
 
+if not globals():
+from typing import (
+Any,
+Dict,
+)
+
+for t in (Any, Dict):
+assert t
+
 stringio = util.stringio
 
 # templates of common command options
@@ -3958,6 +3967,7 @@
 
 
 def readgraftstate(repo, graftstate):
+# type: (Any, statemod.cmdstate) -> Dict[bytes, Any]
 """read the graft state file and return a dict of the data stored in it"""
 try:
 return graftstate.read()



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


D7377: commands: log --line-range is incompatible with --copies

2019-11-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This was (to my surprise) detected by pytype.

REPOSITORY
  rHG Mercurial

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

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
@@ -4716,6 +4716,9 @@
 raise error.Abort(
 _(b'FILE arguments are not compatible with --line-range option')
 )
+copies = opts.get(b'copies')
+if linerange and copies:
+raise error.Abort(_(b'--line-range is incompatible with --copies'))
 
 repo = scmutil.unhidehashlikerevs(repo, opts.get(b'rev'), b'nowarn')
 revs, differ = logcmdutil.getrevs(repo, pats, opts)
@@ -4725,7 +4728,7 @@
 revs, differ = logcmdutil.getlinerangerevs(repo, revs, opts)
 
 getcopies = None
-if opts.get(b'copies'):
+if copies:
 endrev = None
 if revs:
 endrev = revs.max() + 1



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


D7297: cleanup: remove now-obsolete wrong-arg-type annotations

2019-11-13 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 18067.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7297?vs=17673=18067

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7297/new/

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

AFFECTED FILES
  mercurial/branchmap.py
  mercurial/bundle2.py
  mercurial/dagparser.py

CHANGE DETAILS

diff --git a/mercurial/dagparser.py b/mercurial/dagparser.py
--- a/mercurial/dagparser.py
+++ b/mercurial/dagparser.py
@@ -168,9 +168,7 @@
 if not desc:
 return
 
-wordchars = pycompat.bytestr(
-string.ascii_letters + string.digits
-)  # pytype: disable=wrong-arg-types
+wordchars = pycompat.bytestr(string.ascii_letters + string.digits)
 
 labels = {}
 p1 = -1
@@ -179,9 +177,7 @@
 def resolve(ref):
 if not ref:
 return p1
-elif ref[0] in pycompat.bytestr(
-string.digits
-):  # pytype: disable=wrong-arg-types
+elif ref[0] in pycompat.bytestr(string.digits):
 return r - int(ref)
 else:
 return labels[ref]
@@ -215,9 +211,7 @@
 
 c = nextch()
 while c != b'\0':
-while c in pycompat.bytestr(
-string.whitespace
-):  # pytype: disable=wrong-arg-types
+while c in pycompat.bytestr(string.whitespace):
 c = nextch()
 if c == b'.':
 yield b'n', (r, [p1])
@@ -225,9 +219,7 @@
 r += 1
 c = nextch()
 elif c == b'+':
-c, digs = nextrun(
-nextch(), pycompat.bytestr(string.digits)
-)  # pytype: disable=wrong-arg-types
+c, digs = nextrun(nextch(), pycompat.bytestr(string.digits))
 n = int(digs)
 for i in pycompat.xrange(0, n):
 yield b'n', (r, [p1])
diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -653,9 +653,7 @@
 """add a stream level parameter"""
 if not name:
 raise error.ProgrammingError(b'empty parameter name')
-if name[0:1] not in pycompat.bytestr(
-string.ascii_letters  # pytype: disable=wrong-arg-types
-):
+if name[0:1] not in pycompat.bytestr(string.ascii_letters):
 raise error.ProgrammingError(
 b'non letter first character: %s' % name
 )
@@ -838,9 +836,7 @@
 """
 if not name:
 raise ValueError('empty parameter name')
-if name[0:1] not in pycompat.bytestr(
-string.ascii_letters  # pytype: disable=wrong-arg-types
-):
+if name[0:1] not in pycompat.bytestr(string.ascii_letters):
 raise ValueError('non letter first character: %s' % name)
 try:
 handler = b2streamparamsmap[name.lower()]
diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -269,13 +269,7 @@
 if repo.ui.debugflag:
 msg = b'invalid %s: %s\n'
 repo.ui.debug(
-msg
-% (
-_branchcachedesc(repo),
-pycompat.bytestr(
-inst  # pytype: disable=wrong-arg-types
-),
-)
+msg % (_branchcachedesc(repo), pycompat.bytestr(inst))
 )
 bcache = None
 



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


D7383: state: add a pytype annotation

2019-11-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/state.py

CHANGE DETAILS

diff --git a/mercurial/state.py b/mercurial/state.py
--- a/mercurial/state.py
+++ b/mercurial/state.py
@@ -27,6 +27,15 @@
 )
 from .utils import cborutil
 
+if not globals():
+from typing import (
+Any,
+Dict,
+)
+
+for t in (Any, Dict):
+assert t
+
 
 class cmdstate(object):
 """a wrapper class to store the state of commands like `rebase`, `graft`,
@@ -50,6 +59,7 @@
 self.fname = fname
 
 def read(self):
+# type: () -> Dict[bytes, Any]
 """read the existing state file and return a dict of data stored"""
 return self._read()
 



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


D7382: logcmdutil: add a type annotation

2019-11-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This wasn't actually required in the end, as there was a real bug
  found by pytype, but the annotation helped me figure that out. We can
  drop this patch if that's the preference.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/logcmdutil.py

CHANGE DETAILS

diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py
--- a/mercurial/logcmdutil.py
+++ b/mercurial/logcmdutil.py
@@ -42,6 +42,16 @@
 )
 
 
+if not globals():
+from typing import (
+Any,
+Tuple,
+)
+
+for t in (Any, Tuple):
+assert t
+
+
 def getlimit(opts):
 """get the log limit according to option -l/--limit"""
 limit = opts.get(b'limit')
@@ -840,6 +850,7 @@
 
 
 def getrevs(repo, pats, opts):
+# type: (Any, Any, Any) -> Tuple[smartset.BaseSet, changesetdiffer]
 """Return (revs, differ) where revs is a smartset
 
 differ is a changesetdiffer with pre-configured file matcher.



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


D7378: debugcommands: don't shadow the error module

2019-11-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Caught by pytype.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -480,8 +480,8 @@
 ui.warn(_(b"%s in manifest1, but listed as state %s") % (f, state))
 errors += 1
 if errors:
-error = _(b".hg/dirstate inconsistent with current parent's manifest")
-raise error.Abort(error)
+errstr = _(b".hg/dirstate inconsistent with current parent's manifest")
+raise error.Abort(errstr)
 
 
 @command(



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


D7296: pycompat: kludge around pytype being confused by __new__

2019-11-13 Thread durin42 (Augie Fackler)
Herald added a subscriber: mjpieters.
durin42 updated this revision to Diff 18066.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7296?vs=17672=18066

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7296/new/

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

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
@@ -154,7 +154,7 @@
 bytechr = struct.Struct('>B').pack
 byterepr = b'%r'.__mod__
 
-class bytestr(bytes):
+class _bytestr(bytes):
 """A bytes which mostly acts as a Python 2 str
 
 >>> bytestr(), bytestr(bytearray(b'foo')), bytestr(u'ascii'), 
bytestr(1)
@@ -208,7 +208,7 @@
 """
 
 def __new__(cls, s=b''):
-if isinstance(s, bytestr):
+if isinstance(s, _bytestr):
 return s
 if not isinstance(
 s, (bytes, bytearray)
@@ -398,7 +398,7 @@
 unicode = unicode
 bytechr = chr
 byterepr = repr
-bytestr = str
+_bytestr = str
 iterbytestr = iter
 maybebytestr = identity
 sysbytes = identity
@@ -504,3 +504,29 @@
 return tempfile.NamedTemporaryFile(
 mode, bufsize, suffix=suffix, prefix=prefix, dir=dir, delete=delete
 )
+
+
+try:
+if ispy3:
+import typing
+
+typing.Union
+except ImportError:
+pass
+
+# Hide this from non-pytype users. Note that when we're willing to
+# depend on the `typing` module, we can remove the `if not globals`
+# hack.
+if ispy3 and 'typing' in globals():
+from typing import TYPE_CHECKING
+
+if typing.TYPE_CHECKING:
+_bytestr = Any
+
+def bytestr(s=b''):
+# type: (Union[bytes,str]) -> _bytestr
+return _bytestr(s)
+
+
+else:
+bytestr = _bytestr



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


D7380: encoding: define per-use identity functions only in typechecking mode

2019-11-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This avoids some unfortunate overhead from my previous iteration.

REPOSITORY
  rHG Mercurial

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

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
@@ -25,6 +25,7 @@
 Any,
 Callable,
 List,
+TYPE_CHECKING,
 Text,
 Type,
 TypeVar,
@@ -32,7 +33,7 @@
 )
 
 # keep pyflakes happy
-for t in (Any, Callable, List, Text, Type, Union):
+for t in (Any, Callable, List, Text, Type, Union, TYPE_CHECKING):
 assert t
 
 _Tlocalstr = TypeVar('_Tlocalstr', bound=localstr)
@@ -265,16 +266,20 @@
 strfromlocal = unifromlocal
 strmethod = unimethod
 else:
+strtolocal = pycompat.identity
+strfromlocal = pycompat.identity
+strmethod = pycompat.identity
 
-def strtolocal(s):
-# type: (str) -> bytes
-return s
+if 'TYPE_CHECKING' in globals() and TYPE_CHECKING:
 
-def strfromlocal(s):
-# type: (bytes) -> str
-return s
+def strtolocal(s):
+# type: (str) -> bytes
+return s
 
-strmethod = pycompat.identity
+def strfromlocal(s):
+# type: (bytes) -> str
+return s
+
 
 if not _nativeenviron:
 # now encoding and helper functions are available, recreate the environ



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


D7379: encoding: fix bad type annotation

2019-11-13 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This function returns utf-8 in a bytes, not a unicode.

REPOSITORY
  rHG Mercurial

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

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
@@ -205,7 +205,7 @@
 
 
 def fromlocal(s):
-# type: (bytes) -> Text
+# type: (bytes) -> bytes
 """
 Convert a string from the local character encoding to UTF-8
 



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


D7289: branchmap: always copy closednodes to a set

2019-11-13 Thread durin42 (Augie Fackler)
durin42 updated this revision to Diff 18063.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7289?vs=17659=18063

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7289/new/

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

AFFECTED FILES
  mercurial/branchmap.py

CHANGE DETAILS

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -177,7 +177,7 @@
 if closednodes is None:
 self._closednodes = set()
 else:
-self._closednodes = closednodes
+self._closednodes = set(closednodes)
 self._entries = dict(entries)
 # whether closed nodes are verified or not
 self._closedverified = False



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


D7376: help: create packages for the help text

2019-11-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  These files need to be loaded as resources with PyOxidizer, instead of using
  filesystem representations.  AFAICT, the resource loading mechanisms only work
  for the named package given to it, and can't reach into a subdirectory.
  
  While here, the `help` directory is renamed to `helptext`.  Without this, 
trying
  to load external help text crashed in mercurial/help.py when importing 
`.i18n`,
  saying there's no `mercurial.help.i18n` module.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/help.py
  mercurial/help/bundlespec.txt
  mercurial/help/color.txt
  mercurial/help/common.txt
  mercurial/help/config.txt
  mercurial/help/dates.txt
  mercurial/help/deprecated.txt
  mercurial/help/diffs.txt
  mercurial/help/environment.txt
  mercurial/help/extensions.txt
  mercurial/help/filesets.txt
  mercurial/help/flags.txt
  mercurial/help/glossary.txt
  mercurial/help/hg-ssh.8.txt
  mercurial/help/hg.1.txt
  mercurial/help/hgignore.5.txt
  mercurial/help/hgignore.txt
  mercurial/help/hgrc.5.txt
  mercurial/help/hgweb.txt
  mercurial/help/internals/bundle2.txt
  mercurial/help/internals/bundles.txt
  mercurial/help/internals/cbor.txt
  mercurial/help/internals/censor.txt
  mercurial/help/internals/changegroups.txt
  mercurial/help/internals/config.txt
  mercurial/help/internals/extensions.txt
  mercurial/help/internals/linelog.txt
  mercurial/help/internals/mergestate.txt
  mercurial/help/internals/requirements.txt
  mercurial/help/internals/revlogs.txt
  mercurial/help/internals/wireprotocol.txt
  mercurial/help/internals/wireprotocolrpc.txt
  mercurial/help/internals/wireprotocolv2.txt
  mercurial/help/merge-tools.txt
  mercurial/help/pager.txt
  mercurial/help/patterns.txt
  mercurial/help/phases.txt
  mercurial/help/revisions.txt
  mercurial/help/scripting.txt
  mercurial/help/subrepos.txt
  mercurial/help/templates.txt
  mercurial/help/urls.txt
  mercurial/helptext/__init__.py
  mercurial/helptext/bundlespec.txt
  mercurial/helptext/color.txt
  mercurial/helptext/common.txt
  mercurial/helptext/config.txt
  mercurial/helptext/dates.txt
  mercurial/helptext/deprecated.txt
  mercurial/helptext/diffs.txt
  mercurial/helptext/environment.txt
  mercurial/helptext/extensions.txt
  mercurial/helptext/filesets.txt
  mercurial/helptext/flags.txt
  mercurial/helptext/glossary.txt
  mercurial/helptext/hg-ssh.8.txt
  mercurial/helptext/hg.1.txt
  mercurial/helptext/hgignore.5.txt
  mercurial/helptext/hgignore.txt
  mercurial/helptext/hgrc.5.txt
  mercurial/helptext/hgweb.txt
  mercurial/helptext/internals/__init__.py
  mercurial/helptext/internals/bundle2.txt
  mercurial/helptext/internals/bundles.txt
  mercurial/helptext/internals/cbor.txt
  mercurial/helptext/internals/censor.txt
  mercurial/helptext/internals/changegroups.txt
  mercurial/helptext/internals/config.txt
  mercurial/helptext/internals/extensions.txt
  mercurial/helptext/internals/linelog.txt
  mercurial/helptext/internals/mergestate.txt
  mercurial/helptext/internals/requirements.txt
  mercurial/helptext/internals/revlogs.txt
  mercurial/helptext/internals/wireprotocol.txt
  mercurial/helptext/internals/wireprotocolrpc.txt
  mercurial/helptext/internals/wireprotocolv2.txt
  mercurial/helptext/merge-tools.txt
  mercurial/helptext/pager.txt
  mercurial/helptext/patterns.txt
  mercurial/helptext/phases.txt
  mercurial/helptext/revisions.txt
  mercurial/helptext/scripting.txt
  mercurial/helptext/subrepos.txt
  mercurial/helptext/templates.txt
  mercurial/helptext/urls.txt
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -1191,6 +1191,8 @@
 'mercurial',
 'mercurial.cext',
 'mercurial.cffi',
+'mercurial.helptext',
+'mercurial.helptext.internals',
 'mercurial.hgweb',
 'mercurial.interfaces',
 'mercurial.pure',
@@ -1535,11 +1537,15 @@
 packagedata = {
 'mercurial': [
 'locale/*/LC_MESSAGES/hg.mo',
-'help/*.txt',
-'help/internals/*.txt',
 'default.d/*.rc',
 'dummycert.pem',
-]
+],
+'mercurial.helptext': [
+'*.txt',
+],
+'mercurial.helptext.internals': [
+   '*.txt',
+],
 }
 
 
diff --git a/mercurial/help/urls.txt b/mercurial/helptext/urls.txt
rename from mercurial/help/urls.txt
rename to mercurial/helptext/urls.txt
diff --git a/mercurial/help/templates.txt b/mercurial/helptext/templates.txt
rename from mercurial/help/templates.txt
rename to mercurial/helptext/templates.txt
diff --git a/mercurial/help/subrepos.txt b/mercurial/helptext/subrepos.txt
rename from mercurial/help/subrepos.txt
rename to mercurial/helptext/subrepos.txt
diff --git a/mercurial/help/scripting.txt b/mercurial/helptext/scripting.txt
rename from mercurial/help/scripting.txt
rename to mercurial/helptext/scripting.txt
diff --git 

mercurial@43620: new changeset

2019-11-13 Thread Mercurial Commits
New changeset in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/dd773340a085
changeset:   43620:dd773340a085
bookmark:@
tag: tip
user:Martin von Zweigbergk 
date:Tue Oct 22 23:21:26 2019 -0700
summary: dirstate: respect request to not list unknown/ignored/clean files 
(API)

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7173: packaging: stage files and dynamically generate WiX installer

2019-11-13 Thread indygreg (Gregory Szorc)
Closed by commit rHG94eac340d212: packaging: stage files and dynamically 
generate WiX installer (authored by indygreg).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7173?vs=18033=18059

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7173/new/

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

AFFECTED FILES
  contrib/packaging/hgpackaging/py2exe.py
  contrib/packaging/hgpackaging/wix.py
  contrib/packaging/wix/contrib.wxs
  contrib/packaging/wix/dist.wxs
  contrib/packaging/wix/doc.wxs
  contrib/packaging/wix/guids.wxi
  contrib/packaging/wix/help.wxs
  contrib/packaging/wix/locale.wxs
  contrib/packaging/wix/mercurial.wxs
  contrib/packaging/wix/templates.wxs
  contrib/win32/mercurial.ini
  tests/test-install.t

CHANGE DETAILS

diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -162,75 +162,6 @@
 "fsmonitor-watchman": "false",
 "fsmonitor-watchman-error": "warning: Watchman unavailable: watchman 
exited with code 1",
 
-
-#if test-repo
-  $ . "$TESTDIR/helpers-testrepo.sh"
-
-  $ cat >> wixxml.py << EOF
-  > import os
-  > import subprocess
-  > import sys
-  > import xml.etree.ElementTree as ET
-  > from mercurial import pycompat
-  > 
-  > # MSYS mangles the path if it expands $TESTDIR
-  > testdir = os.environ['TESTDIR']
-  > ns = {'wix' : 'http://schemas.microsoft.com/wix/2006/wi'}
-  > 
-  > def directory(node, relpath):
-  > '''generator of files in the xml node, rooted at relpath'''
-  > dirs = node.findall('./{%(wix)s}Directory' % ns)
-  > 
-  > for d in dirs:
-  > for subfile in directory(d, relpath + d.attrib['Name'] + '/'):
-  > yield subfile
-  > 
-  > files = node.findall('./{%(wix)s}Component/{%(wix)s}File' % ns)
-  > 
-  > for f in files:
-  > yield pycompat.sysbytes(relpath + f.attrib['Name'])
-  > 
-  > def hgdirectory(relpath):
-  > '''generator of tracked files, rooted at relpath'''
-  > hgdir = "%s/../mercurial" % (testdir)
-  > args = ['hg', '--cwd', hgdir, 'files', relpath]
-  > proc = subprocess.Popen(args, stdout=subprocess.PIPE,
-  > stderr=subprocess.PIPE)
-  > output = proc.communicate()[0]
-  > 
-  > for line in output.splitlines():
-  > if os.name == 'nt':
-  > yield line.replace(pycompat.sysbytes(os.sep), b'/')
-  > else:
-  > yield line
-  > 
-  > tracked = [f for f in hgdirectory(sys.argv[1])]
-  > 
-  > xml = ET.parse("%s/../contrib/packaging/wix/%s.wxs" % (testdir, 
sys.argv[1]))
-  > root = xml.getroot()
-  > dir = root.find('.//{%(wix)s}DirectoryRef' % ns)
-  > 
-  > installed = [f for f in directory(dir, '')]
-  > 
-  > print('Not installed:')
-  > for f in sorted(set(tracked) - set(installed)):
-  > print('  %s' % pycompat.sysstr(f))
-  > 
-  > print('Not tracked:')
-  > for f in sorted(set(installed) - set(tracked)):
-  > print('  %s' % pycompat.sysstr(f))
-  > EOF
-
-  $ ( testrepohgenv; "$PYTHON" wixxml.py help )
-  Not installed:
-  Not tracked:
-
-  $ ( testrepohgenv; "$PYTHON" wixxml.py templates )
-  Not installed:
-  Not tracked:
-
-#endif
-
 Verify that Mercurial is installable with pip. Note that this MUST be
 the last test in this file, because we do some nasty things to the
 shell environment in order to make the virtualenv work reliably.
diff --git a/contrib/win32/mercurial.ini b/contrib/win32/mercurial.ini
--- a/contrib/win32/mercurial.ini
+++ b/contrib/win32/mercurial.ini
@@ -16,7 +16,7 @@
 
 [ui]
 ; editor used to enter commit logs, etc.  Most text editors will work.
-editor = notepad
+; editor = notepad
 ; show changed files and be a bit more verbose if True
 ; verbose = True
 ; colorize commands output
diff --git a/contrib/packaging/wix/templates.wxs 
b/contrib/packaging/wix/templates.wxs
deleted file mode 100644
--- a/contrib/packaging/wix/templates.wxs
+++ /dev/null
@@ -1,251 +0,0 @@
-
-http://schemas.microsoft.com/wix/2006/wi;>
-
-  
-  
-
-  
-
-
-  
-
-  
-  
-  
-  
-  
-  
-  
-  
-  
-  
-
-
-  
-
-  
-
-
-  
-
-
-  
-  
-  
-  
-  
-  
-  
-  
-
-
-
-  
-
-
-
-  
-
-
-
-  
-
-
-
-
-
-
-
-
-
-
-
-
-  
-
-
-
-  
-
-
-  
-
-
-
-  
-
-
-
-
-
-
-
-
-
-  

D7371: tests: add optional output when wheel is missing

2019-11-13 Thread indygreg (Gregory Szorc)
Closed by commit rHG45c15ed06f33: tests: add optional output when wheel is 
missing (authored by indygreg).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7371?vs=18038=18058

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7371/new/

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

AFFECTED FILES
  tests/test-install.t

CHANGE DETAILS

diff --git a/tests/test-install.t b/tests/test-install.t
--- a/tests/test-install.t
+++ b/tests/test-install.t
@@ -250,6 +250,7 @@
 Note: we use this weird path to run pip and hg to avoid platform differences,
 since it's bin on most platforms but Scripts on Windows.
   $ ./installenv/*/pip install --no-index $TESTDIR/.. >> pip.log
+Failed building wheel for mercurial (?)
   $ ./installenv/*/hg debuginstall || cat pip.log
   checking encoding (ascii)...
   checking Python executable (*) (glob)



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


D7375: py3: replace "%r" by"'%s'% for py3-compatible (and clearer) quoting in chg

2019-11-13 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG975e517451a6: py3: replace %r 
by%s% for py3-compatible (and clearer) quoting in chg 
(authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7375?vs=18056=18057

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7375/new/

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

AFFECTED FILES
  mercurial/chgserver.py

CHANGE DETAILS

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -505,7 +505,7 @@
 path = self._readstr()
 if not path:
 return
-self.ui.log(b'chgserver', b'chdir to %r\n', path)
+self.ui.log(b'chgserver', b"chdir to '%s'\n", path)
 os.chdir(path)
 
 def setumask(self):



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


D7144: status: use unfiltered repo if we're getting status of working copy

2019-11-13 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  I took more time to look at your series and at the bigger picture. My general 
position is still that passing the wrong filter level to high level function is 
hacking and will be a significant source of bugs.
  
  For example, `hg status` taks a "PATTERN" argument, that pattern can be 
fileset, that fileset can contains revset. PAssing the wrong filtering will 
result in wrongdoing of that revset.
  
  However it might be a good idea to do this hack if:
  
  - the performance gain is significant,
  - the hack is temporary,
  - there is no reasonable alternative available short terms.
  
  I took some time to poke at the issues, and I managed to get all 4 commands 
listed in this series with a first throw of abotu 12 changesets. The idea is to 
recognise pattern that will not be filtered and to have lower level logic skip 
around the filtering in this case. So the higher level logic is still filtered 
with the right semantic. One can have a look at the very first throw here:  
https://dev.heptapod.net/octobus/mercurial-devel/commits/topic/default/filter-trigger
  
  It is getting late so I will stop here for tonight. However, the prototype 
looks promissing enough. I can probably have a clean/consolidate version by the 
end of the week.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7144/new/

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

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


D7257: [RFC] repoview: add a "filter" that just disallows walking to heads

2019-11-13 Thread durin42 (Augie Fackler)
durin42 added a comment.
durin42 accepted this revision as: durin42.


  I'm a big fan of this idea. I'd probably land it if there were some obvious 
usecases as child patches. :)

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7257/new/

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

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


D7375: py3: replace "%r" by"'%s'% for py3-compatible (and clearer) quoting in chg

2019-11-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D7375#108431 , @durin42 wrote:
  
  > I feel obligated to point out that this will result in different (wrong!) 
quoting if `path` contains a `'`, but that's also probably fine since it's just 
a log.
  
  Oh, good to know! I had no idea that `%r` does escaping too.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7375/new/

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

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


D7375: py3: replace "%r" by"'%s'% for py3-compatible (and clearer) quoting in chg

2019-11-13 Thread durin42 (Augie Fackler)
durin42 added a comment.


  I feel obligated to point out that this will result in different (wrong!) 
quoting if `path` contains a `'`, but that's also probably fine since it's just 
a log.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7375/new/

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

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


[PATCH 6 of 6] patchbomb: fix wrong argument type when calling mail generator.flatten()

2019-11-13 Thread Denis Laxalde
# HG changeset patch
# User Denis Laxalde 
# Date 1573661165 -3600
#  Wed Nov 13 17:06:05 2019 +0100
# Node ID 9ebd700f9dc4e27c0bd45dce1108f7a2255b
# Parent  11d514fd71855ace61c549d3154f52569cea9264
patchbomb: fix wrong argument type when calling mail generator.flatten()

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -958,7 +958,7 @@ def email(ui, repo, *revs, **opts):
 ui.pager(b'email')
 generator = mail.Generator(ui, mangle_from_=False)
 try:
-generator.flatten(m, 0)
+generator.flatten(m, False)
 ui.write(b'\n')
 except IOError as inst:
 if inst.errno != errno.EPIPE:
@@ -973,7 +973,7 @@ def email(ui, repo, *revs, **opts):
 del m['Bcc']
 fp = stringio()
 generator = mail.Generator(fp, mangle_from_=False)
-generator.flatten(m, 0)
+generator.flatten(m, False)
 alldests = to + bcc + cc
 sendmail(sender_addr, alldests, fp.getvalue())
 

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 6] mail: use a native string for "subtype" value

2019-11-13 Thread Denis Laxalde
# HG changeset patch
# User Denis Laxalde 
# Date 1573654984 -3600
#  Wed Nov 13 15:23:04 2019 +0100
# Node ID 6f035c6bb911f36cd2459272843388a218be120d
# Parent  f84d980d58cd3e1bdf2b19aa03b419e438eff808
mail: use a native string for "subtype" value

This is somehow similar to previous changeset and avoids one str
conversion.

diff --git a/hgext/patchbomb.py b/hgext/patchbomb.py
--- a/hgext/patchbomb.py
+++ b/hgext/patchbomb.py
@@ -285,7 +285,7 @@ def makepatch(
 if body:
 msg.attach(mail.mimeencode(ui, body, _charsets, opts.get(b'test')))
 p = mail.mimetextpatch(
-b'\n'.join(patchlines), b'x-patch', opts.get(b'test')
+b'\n'.join(patchlines), 'x-patch', opts.get(b'test')
 )
 binnode = nodemod.bin(node)
 # if node is mq patch, it will have the patch file's name as a tag
diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -263,8 +263,8 @@ def codec2iana(cs):
 return cs
 
 
-def mimetextpatch(s, subtype=b'plain', display=False):
-# type: (bytes, bytes, bool) -> email.message.Message
+def mimetextpatch(s, subtype='plain', display=False):
+# type: (bytes, str, bool) -> email.message.Message
 '''Return MIME message suitable for a patch.
 Charset will be detected by first trying to decode as us-ascii, then utf-8,
 and finally the global encodings. If all those fail, fall back to
@@ -290,13 +290,13 @@ def mimetextpatch(s, subtype=b'plain', d
 
 
 def mimetextqp(body, subtype, charset):
-# type: (bytes, bytes, str) -> email.message.Message
+# type: (bytes, str, str) -> email.message.Message
 '''Return MIME message.
 Quoted-printable transfer encoding will be used if necessary.
 '''
 cs = email.charset.Charset(charset)
 msg = email.message.Message()
-msg.set_type(pycompat.sysstr(b'text/' + subtype))
+msg.set_type('text/' + subtype)
 
 for line in body.splitlines():
 if len(line) > 950:
@@ -450,7 +450,7 @@ def mimeencode(ui, s, charsets=None, dis
 cs = 'us-ascii'
 if not display:
 s, cs = _encode(ui, s, charsets)
-return mimetextqp(s, b'plain', cs)
+return mimetextqp(s, 'plain', cs)
 
 
 if pycompat.ispy3:

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 6] mail: let all charset values be native strings

2019-11-13 Thread Denis Laxalde
# HG changeset patch
# User Denis Laxalde 
# Date 1573595550 -3600
#  Tue Nov 12 22:52:30 2019 +0100
# Node ID f84d980d58cd3e1bdf2b19aa03b419e438eff808
# Parent  ff60edae8bb65ef213f9d83b6065c161d57f2a51
mail: let all charset values be native strings

Charset values will typically be used to build email.header.Header
instances, which takes str (though it tolerates bytes) or passed to
decode()/encode() methods of string values (which want str). It seems
that using native str involves less conversions than before and this
also helps type hinting (as illustrates removal of pytype disabling
instructions).

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -253,17 +253,13 @@ def validateconfig(ui):
 
 
 def codec2iana(cs):
-# type: (bytes) -> bytes
+# type: (str) -> str
 ''
-cs = pycompat.sysbytes(
-email.charset.Charset(
-cs  # pytype: disable=wrong-arg-types
-).input_charset.lower()
-)
+cs = email.charset.Charset(cs).input_charset.lower()
 
 # "latin1" normalizes to "iso8859-1", standard calls for "iso-8859-1"
-if cs.startswith(b"iso") and not cs.startswith(b"iso-"):
-return b"iso-" + cs[3:]
+if cs.startswith("iso") and not cs.startswith("iso-"):
+return "iso-" + cs[3:]
 return cs
 
 
@@ -275,27 +271,30 @@ def mimetextpatch(s, subtype=b'plain', d
 ISO-8859-1, an encoding with that allows all byte sequences.
 Transfer encodings will be used if necessary.'''
 
-cs = [b'us-ascii', b'utf-8', encoding.encoding, encoding.fallbackencoding]
+cs = [
+'us-ascii',
+'utf-8',
+pycompat.sysstr(encoding.encoding),
+pycompat.sysstr(encoding.fallbackencoding),
+]
 if display:
-cs = [b'us-ascii']
+cs = ['us-ascii']
 for charset in cs:
 try:
-s.decode(pycompat.sysstr(charset))
+s.decode(charset)
 return mimetextqp(s, subtype, codec2iana(charset))
 except UnicodeDecodeError:
 pass
 
-return mimetextqp(s, subtype, b"iso-8859-1")
+return mimetextqp(s, subtype, "iso-8859-1")
 
 
 def mimetextqp(body, subtype, charset):
-# type: (bytes, bytes, bytes) -> email.message.Message
+# type: (bytes, bytes, str) -> email.message.Message
 '''Return MIME message.
 Quoted-printable transfer encoding will be used if necessary.
 '''
-# Experimentally charset is okay as a bytes even if the type
-# stubs disagree.
-cs = email.charset.Charset(charset)  # pytype: disable=wrong-arg-types
+cs = email.charset.Charset(charset)
 msg = email.message.Message()
 msg.set_type(pycompat.sysstr(b'text/' + subtype))
 
@@ -317,24 +316,25 @@ def mimetextqp(body, subtype, charset):
 
 
 def _charsets(ui):
-# type: (Any) -> List[bytes]
+# type: (Any) -> List[str]
 '''Obtains charsets to send mail parts not containing patches.'''
 charsets = [
-cs.lower() for cs in ui.configlist(b'email', b'charsets')
-]  # type: List[bytes]
+pycompat.sysstr(cs.lower())
+for cs in ui.configlist(b'email', b'charsets')
+]
 fallbacks = [
-encoding.fallbackencoding.lower(),
-encoding.encoding.lower(),
-b'utf-8',
-]  # type: List[bytes]
+pycompat.sysstr(encoding.fallbackencoding.lower()),
+pycompat.sysstr(encoding.encoding.lower()),
+'utf-8',
+]
 for cs in fallbacks:  # find unique charsets while keeping order
 if cs not in charsets:
 charsets.append(cs)
-return [cs for cs in charsets if not cs.endswith(b'ascii')]
+return [cs for cs in charsets if not cs.endswith('ascii')]
 
 
 def _encode(ui, s, charsets):
-# type: (Any, bytes, List[bytes]) -> Tuple[bytes, bytes]
+# type: (Any, bytes, List[str]) -> Tuple[bytes, str]
 '''Returns (converted) string, charset tuple.
 Finds out best charset by cycling through sendcharsets in descending
 order. Tries both encoding and fallbackencoding for input. Only as
@@ -347,14 +347,17 @@ def _encode(ui, s, charsets):
 # wants, and fall back to garbage-in-ascii.
 for ocs in sendcharsets:
 try:
-return s.encode(pycompat.sysstr(ocs)), ocs
+return s.encode(ocs), ocs
 except UnicodeEncodeError:
 pass
 except LookupError:
-ui.warn(_(b'ignoring invalid sendcharset: %s\n') % ocs)
+ui.warn(
+_(b'ignoring invalid sendcharset: %s\n')
+% pycompat.sysbytes(ocs)
+)
 else:
 # Everything failed, ascii-armor what we've got and send it.
-return s.encode('ascii', 'backslashreplace'), b'us-ascii'
+return s.encode('ascii', 'backslashreplace'), 'us-ascii'
 # We have a bytes of unknown encoding. We'll try and guess a valid
 # encoding, falling back to 

[PATCH 5 of 6] mail: move strtolocal call in _addressencode()

2019-11-13 Thread Denis Laxalde
# HG changeset patch
# User Denis Laxalde 
# Date 1573659988 -3600
#  Wed Nov 13 16:46:28 2019 +0100
# Node ID 11d514fd71855ace61c549d3154f52569cea9264
# Parent  6f035c6bb911f36cd2459272843388a218be120d
mail: move strtolocal call in _addressencode()

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -395,8 +395,8 @@ def headencode(ui, s, charsets=None, dis
 
 
 def _addressencode(ui, name, addr, charsets=None):
-# type: (Any, str, bytes, List[str]) -> str
-assert isinstance(addr, bytes)
+# type: (Any, str, str, List[str]) -> str
+addr = encoding.strtolocal(addr)
 name = headencode(ui, name, charsets)
 try:
 acc, dom = addr.split(b'@')
@@ -420,7 +420,7 @@ def addressencode(ui, address, charsets=
 if display or not address:
 return encoding.strfromlocal(address or b'')
 name, addr = email.utils.parseaddr(encoding.strfromlocal(address))
-return _addressencode(ui, name, encoding.strtolocal(addr), charsets)
+return _addressencode(ui, name, addr, charsets)
 
 
 def addrlistencode(ui, addrs, charsets=None, display=False):
@@ -438,7 +438,7 @@ def addrlistencode(ui, addrs, charsets=N
 result = []
 for name, addr in email.utils.getaddresses(straddrs):
 if name or addr:
-r = _addressencode(ui, name, encoding.strtolocal(addr), charsets)
+r = _addressencode(ui, name, addr, charsets)
 result.append(r)
 return result
 

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 6] mail: fix a bad return type in _encode()

2019-11-13 Thread Denis Laxalde
# HG changeset patch
# User Denis Laxalde 
# Date 1573575136 -3600
#  Tue Nov 12 17:12:16 2019 +0100
# Node ID a57f3ab9661af30fd20d6a69d872448afa4612bd
# Parent  c207c46a86b92ad7be05de2bf85bb36757e8ae3a
mail: fix a bad return type in _encode()

This particular instruction returned only a string and omitted the
charset value.

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -336,7 +336,7 @@ def _encode(ui, s, charsets):
 ui.warn(_(b'ignoring invalid sendcharset: %s\n') % ocs)
 else:
 # Everything failed, ascii-armor what we've got and send it.
-return s.encode('ascii', 'backslashreplace')
+return s.encode('ascii', 'backslashreplace'), b'us-ascii'
 # We have a bytes of unknown encoding. We'll try and guess a valid
 # encoding, falling back to pretending we had ascii even though we
 # know that's wrong.

___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 6] mail: add type hints for pytype

2019-11-13 Thread Denis Laxalde
# HG changeset patch
# User Denis Laxalde 
# Date 1573680044 -3600
#  Wed Nov 13 22:20:44 2019 +0100
# Node ID ff60edae8bb65ef213f9d83b6065c161d57f2a51
# Parent  a57f3ab9661af30fd20d6a69d872448afa4612bd
mail: add type hints for pytype

We essentially annotate functions in which handling of bytes/str is not
obvious in order to hopefully clear things out. See also changeset
2ade00f3b03b introducing typing hints in Mercurial.

Most types are straightforward but a few is wrong, and we need to
either disable pytype on respective instructions or use wrong
annotations. These will be fixed in next changesets. Notice the type
Union[bytes, str] of "s" parameter of headencode(), this reflects how
email.header.Header.append() behaves.

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -36,6 +36,12 @@ from .utils import (
 stringutil,
 )
 
+if not globals():  # hide this from non-pytype users
+from typing import Any, List, Tuple, Union
+
+# keep pyflakes happy
+assert all((Any, List, Tuple, Union))
+
 
 class STARTTLS(smtplib.SMTP):
 '''Derived class to verify the peer certificate for STARTTLS.
@@ -99,6 +105,7 @@ class SMTPS(smtplib.SMTP):
 
 
 def _pyhastls():
+# type: () -> bool
 """Returns true iff Python has TLS support, false otherwise."""
 try:
 import ssl
@@ -246,8 +253,13 @@ def validateconfig(ui):
 
 
 def codec2iana(cs):
+# type: (bytes) -> bytes
 ''
-cs = pycompat.sysbytes(email.charset.Charset(cs).input_charset.lower())
+cs = pycompat.sysbytes(
+email.charset.Charset(
+cs  # pytype: disable=wrong-arg-types
+).input_charset.lower()
+)
 
 # "latin1" normalizes to "iso8859-1", standard calls for "iso-8859-1"
 if cs.startswith(b"iso") and not cs.startswith(b"iso-"):
@@ -256,6 +268,7 @@ def codec2iana(cs):
 
 
 def mimetextpatch(s, subtype=b'plain', display=False):
+# type: (bytes, bytes, bool) -> email.message.Message
 '''Return MIME message suitable for a patch.
 Charset will be detected by first trying to decode as us-ascii, then utf-8,
 and finally the global encodings. If all those fail, fall back to
@@ -276,6 +289,7 @@ def mimetextpatch(s, subtype=b'plain', d
 
 
 def mimetextqp(body, subtype, charset):
+# type: (bytes, bytes, bytes) -> email.message.Message
 '''Return MIME message.
 Quoted-printable transfer encoding will be used if necessary.
 '''
@@ -303,13 +317,16 @@ def mimetextqp(body, subtype, charset):
 
 
 def _charsets(ui):
+# type: (Any) -> List[bytes]
 '''Obtains charsets to send mail parts not containing patches.'''
-charsets = [cs.lower() for cs in ui.configlist(b'email', b'charsets')]
+charsets = [
+cs.lower() for cs in ui.configlist(b'email', b'charsets')
+]  # type: List[bytes]
 fallbacks = [
 encoding.fallbackencoding.lower(),
 encoding.encoding.lower(),
 b'utf-8',
-]
+]  # type: List[bytes]
 for cs in fallbacks:  # find unique charsets while keeping order
 if cs not in charsets:
 charsets.append(cs)
@@ -317,6 +334,7 @@ def _charsets(ui):
 
 
 def _encode(ui, s, charsets):
+# type: (Any, bytes, List[bytes]) -> Tuple[bytes, bytes]
 '''Returns (converted) string, charset tuple.
 Finds out best charset by cycling through sendcharsets in descending
 order. Tries both encoding and fallbackencoding for input. Only as
@@ -361,15 +379,19 @@ def _encode(ui, s, charsets):
 
 
 def headencode(ui, s, charsets=None, display=False):
+# type: (Any, Union[bytes, str], List[bytes], bool) -> str
 '''Returns RFC-2047 compliant header from given string.'''
 if not display:
 # split into words?
 s, cs = _encode(ui, s, charsets)
-return email.header.Header(s, cs).encode()
+return email.header.Header(
+s, cs  # pytype: disable=wrong-arg-types
+).encode()
 return encoding.strfromlocal(s)
 
 
 def _addressencode(ui, name, addr, charsets=None):
+# type: (Any, str, bytes, List[bytes]) -> str
 assert isinstance(addr, bytes)
 name = headencode(ui, name, charsets)
 try:
@@ -389,6 +411,7 @@ def _addressencode(ui, name, addr, chars
 
 
 def addressencode(ui, address, charsets=None, display=False):
+# type: (Any, bytes, List[bytes], bool) -> str
 '''Turns address into RFC-2047 compliant header.'''
 if display or not address:
 return encoding.strfromlocal(address or b'')
@@ -397,6 +420,7 @@ def addressencode(ui, address, charsets=
 
 
 def addrlistencode(ui, addrs, charsets=None, display=False):
+# type: (Any, List[bytes], List[bytes], bool) -> List[str]
 '''Turns a list of addresses into a list of RFC-2047 compliant headers.
 A single element of input list may contain multiple addresses, but output
 always has one address per item'''
@@ -416,6 +440,7 @@ def addrlistencode(ui, addrs, charsets=N
 
 
 def 

mercurial@43619: 2 new changesets

2019-11-13 Thread Mercurial Commits
2 new changesets in mercurial:

https://www.mercurial-scm.org/repo/hg/rev/c5f6f58f6c71
changeset:   43618:c5f6f58f6c71
user:Daniel Ploch 
date:Tue Nov 12 15:53:58 2019 -0800
summary: remotefilelog: handle **kwargs correctly when overriding 
changelog.add()

https://www.mercurial-scm.org/repo/hg/rev/c207c46a86b9
changeset:   43619:c207c46a86b9
bookmark:@
tag: tip
user:Denis Laxalde 
date:Wed Nov 13 09:09:42 2019 +0100
summary: py3: pass a bytes value for "msg" to nouideprecwarn()

-- 
Repository URL: https://www.mercurial-scm.org/repo/hg
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7375: py3: replace "%r" by"'%s'% for py3-compatible (and clearer) quoting in chg

2019-11-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/chgserver.py

CHANGE DETAILS

diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py
--- a/mercurial/chgserver.py
+++ b/mercurial/chgserver.py
@@ -505,7 +505,7 @@
 path = self._readstr()
 if not path:
 return
-self.ui.log(b'chgserver', b'chdir to %r\n', path)
+self.ui.log(b'chgserver', b"chdir to '%s'\n", path)
 os.chdir(path)
 
 def setumask(self):



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


D7256: repoview: define filteredchangelog as a top-level (non-local) class

2019-11-13 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D7256#107172 , @yuja wrote:
  
  >> +cl.__class__ = type('filteredchangelog',
  >> +(filteredchangelogmixin, cl.__class__),
  >> +{})
  >
  > Nit: maybe this can be just `class filteredchangelog(...): pass` since
  > we don't name the type dynamically.
  
  Done in https://www.mercurial-scm.org/repo/hg/rev/85628a595c37.
  
  > And we might need a class cache like _filteredrepotypes to work around
  > leaks of dynamically-created types.
  
  It seems like there's some caching in `_clcache` already. Maybe that's enough?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7256/new/

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

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


D7374: hghave: add a check for the `xz` compression utility

2019-11-13 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This isn't install by default on Mac, which causes a test failure.  The logic
  for avoiding the command is a little goofy, but nested `#if` isn't supported,
  and it still seems worth running the hg command to see if anything explodes.
  
  With this, the py3 tests run (almost) cleanly on 10.14.6:
  
  1. Ran 835 tests, 58 skipped, 1 failed.
  
  Alas, the mac-packaging test is skipped because it's slow.  The failure here 
is
  in test-releasenotes-merging.t, complaining about not being able to import the
  `fuzzywuzzy` module.  I have it installed on py3 (thus the test isn't 
skipped),
  but not on py2.  So there must be some unintended cross pollination here when
  running `hg` commands.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/hghave.py
  tests/test-archive.t

CHANGE DETAILS

diff --git a/tests/test-archive.t b/tests/test-archive.t
--- a/tests/test-archive.t
+++ b/tests/test-archive.t
@@ -574,8 +574,8 @@
 
 #if py3
   $ hg archive ../archive.txz
-  $ xz -l ../archive.txz | head -n1
-  Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename
+  $ which xz >/dev/null && xz -l ../archive.txz | head -n1 || true
+  Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename (xz !)
   $ rm -f ../archive.txz
 #else
   $ hg archive ../archive.txz
diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -673,6 +673,13 @@
 return False
 
 
+@check("xz", "xz compression utility")
+def has_xz():
+# When Windows invokes a subprocess in shell mode, it uses `cmd.exe`, which
+# only knows `where`, not `which`.  So invoke MSYS shell explicitly.
+return matchoutput("sh -c 'test -x \"`which xz`\"'", b'')
+
+
 @check("msys", "Windows with MSYS")
 def has_msys():
 return os.getenv('MSYSTEM')



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


D7198: lock: refactor in preparation for next commit

2019-11-13 Thread marmoute (Pierre-Yves David)
marmoute added a comment.


  In D7198#108404 , @pulkit wrote:
  
  > @marmoute can you have a look at these two patches?
  
  Yes, I will.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7198/new/

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

To: valentin.gatienbaron, #hg-reviewers
Cc: pulkit, marmoute, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7373: py3: pass a bytes value for "msg" to nouideprecwarn()

2019-11-13 Thread dlax (Denis Laxalde)
Closed by commit rHGc207c46a86b9: py3: pass a bytes value for msg 
to nouideprecwarn() (authored by dlax).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7373?vs=18051=18053

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7373/new/

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

AFFECTED FILES
  mercurial/pure/parsers.py
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -207,7 +207,7 @@
 class revlogoldindex(list):
 @property
 def nodemap(self):
-msg = "index.nodemap is deprecated, " "use 
index.[has_node|rev|get_rev]"
+msg = b"index.nodemap is deprecated, use index.[has_node|rev|get_rev]"
 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
 return self._nodemap
 
@@ -657,15 +657,15 @@
 @property
 def nodemap(self):
 msg = (
-"revlog.nodemap is deprecated, "
-"use revlog.index.[has_node|rev|get_rev]"
+b"revlog.nodemap is deprecated, "
+b"use revlog.index.[has_node|rev|get_rev]"
 )
 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
 return self.index.nodemap
 
 @property
 def _nodecache(self):
-msg = "revlog._nodecache is deprecated, use revlog.index.nodemap"
+msg = b"revlog._nodecache is deprecated, use revlog.index.nodemap"
 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
 return self.index.nodemap
 
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -49,7 +49,7 @@
 class BaseIndexObject(object):
 @property
 def nodemap(self):
-msg = "index.nodemap is deprecated, " "use 
index.[has_node|rev|get_rev]"
+msg = b"index.nodemap is deprecated, use index.[has_node|rev|get_rev]"
 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
 return self._nodemap
 



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


D7150: dirstate: respect request to not list unknown/ignored/clean files (API)

2019-11-13 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGdd773340a085: dirstate: respect request to not list 
unknown/ignored/clean files (API) (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7150?vs=18049=18054

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7150/new/

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1149,16 +1149,19 @@
 )
 return (lookup, status)
 
+def noop(f):
+pass
+
 dcontains = dmap.__contains__
 dget = dmap.__getitem__
 ladd = lookup.append  # aka "unsure"
 madd = modified.append
 aadd = added.append
-uadd = unknown.append
-iadd = ignored.append
+uadd = unknown.append if listunknown else noop
+iadd = ignored.append if listignored else noop
 radd = removed.append
 dadd = deleted.append
-cadd = clean.append
+cadd = clean.append if listclean else noop
 mexact = match.exact
 dirignore = self._dirignore
 checkexec = self._checkexec



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


D7372: remotefilelog: handle **kwargs correctly when overriding changelog.add()

2019-11-13 Thread dploch (Daniel Ploch)
Closed by commit rHGc5f6f58f6c71: remotefilelog: handle **kwargs correctly when 
overriding changelog.add() (authored by dploch).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7372?vs=18050=18052

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7372/new/

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

AFFECTED FILES
  hgext/remotefilelog/__init__.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/__init__.py b/hgext/remotefilelog/__init__.py
--- a/hgext/remotefilelog/__init__.py
+++ b/hgext/remotefilelog/__init__.py
@@ -719,9 +719,9 @@
 remotefilelog.remotefilelog, b'addrawrevision', addrawrevision
 )
 
-def changelogadd(orig, self, *args):
+def changelogadd(orig, self, *args, **kwargs):
 oldlen = len(self)
-node = orig(self, *args)
+node = orig(self, *args, **kwargs)
 newlen = len(self)
 if oldlen != newlen:
 for oldargs in pendingfilecommits:



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


D7198: lock: refactor in preparation for next commit

2019-11-13 Thread pulkit (Pulkit Goyal)
pulkit added a comment.
pulkit added subscribers: marmoute, pulkit.


  @marmoute can you have a look at these two patches?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7198/new/

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

To: valentin.gatienbaron, #hg-reviewers
Cc: pulkit, marmoute, mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 6221] New: pull --bookmark adds too many bookmarks

2019-11-13 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6221

Bug ID: 6221
   Summary: pull --bookmark adds too many bookmarks
   Product: Mercurial
   Version: 4.5.2
  Hardware: PC
OS: Windows
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: bookmarks
  Assignee: bugzi...@mercurial-scm.org
  Reporter: pe...@lucid.ch
CC: mercurial-devel@mercurial-scm.org
Python Version: 2.7

"hg pull --bookmark b" should not add other bookmarks.

hg init Repo1 && hg clone Repo1 Repo2 && cd Repo1
echo a>a
hg add a && hg commit -m "A" && hg bookmark A
echo b>b
hg add b && hg commit -m "B" && hg bookmark B
cd ..\Repo2
hg pull --bookmark B

This causes:
adding remote bookmark A
adding remote bookmark B
But bookmark A is unwanted.

hg bookmarks -d A
hg pull --bookmark B

Again it is added back:
adding remote bookmark A

This even happens for bookmarks on changesets that are marked as obsolete
locally.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D7373: py3: pass a bytes value for "msg" to nouideprecwarn()

2019-11-13 Thread dlax (Denis Laxalde)
dlax added a comment.


  should fix tracebacks in https://ci.octobus.net/job/EvolvePy3/278/console

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7373/new/

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

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


D7373: py3: pass a bytes value for "msg" to nouideprecwarn()

2019-11-13 Thread dlax (Denis Laxalde)
dlax created this revision.
Herald added a reviewer: indygreg.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  That function formats "msg" with the "version" value. On Python 3, this
  leads to "TypeError: can only concatenate str (not "bytes") to str".
  
  Also eliminate spurious strings concatenation in single-line
  declarations.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pure/parsers.py
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -207,7 +207,7 @@
 class revlogoldindex(list):
 @property
 def nodemap(self):
-msg = "index.nodemap is deprecated, " "use 
index.[has_node|rev|get_rev]"
+msg = b"index.nodemap is deprecated, use index.[has_node|rev|get_rev]"
 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
 return self._nodemap
 
@@ -657,15 +657,15 @@
 @property
 def nodemap(self):
 msg = (
-"revlog.nodemap is deprecated, "
-"use revlog.index.[has_node|rev|get_rev]"
+b"revlog.nodemap is deprecated, "
+b"use revlog.index.[has_node|rev|get_rev]"
 )
 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
 return self.index.nodemap
 
 @property
 def _nodecache(self):
-msg = "revlog._nodecache is deprecated, use revlog.index.nodemap"
+msg = b"revlog._nodecache is deprecated, use revlog.index.nodemap"
 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
 return self.index.nodemap
 
diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py
--- a/mercurial/pure/parsers.py
+++ b/mercurial/pure/parsers.py
@@ -49,7 +49,7 @@
 class BaseIndexObject(object):
 @property
 def nodemap(self):
-msg = "index.nodemap is deprecated, " "use 
index.[has_node|rev|get_rev]"
+msg = b"index.nodemap is deprecated, use index.[has_node|rev|get_rev]"
 util.nouideprecwarn(msg, b'5.3', stacklevel=2)
 return self._nodemap
 



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