Re: [PATCH V2] py3: test to check which commands run
On Sun, 09 Oct 2016 18:35:57 +0200, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1476014360 -7200 > # Sun Oct 09 13:59:20 2016 +0200 > # Node ID b2b8c1575415ec60a65833f17730c7f77dbe9f60 > # Parent 3ce847adae982625abac548017e43da189eb5e71 > py3: test to check which commands run Looks good. Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 6 of 8] bisect: factor commonly update sequence
On Mon, 10 Oct 2016 04:32:30 +0200, Pierre-Yves David wrote: > On 10/09/2016 10:40 PM, Yuya Nishihara wrote: > > On Sun, 09 Oct 2016 10:57:40 +0200, Pierre-Yves David wrote: > >> # HG changeset patch > >> # User Pierre-Yves David> >> # Date 1472007886 -7200 > >> # Wed Aug 24 05:04:46 2016 +0200 > >> # Node ID eb7d02debaf5ed831f12b509f4175ebb0cd40143 > >> # Parent 45469b6da789e8d07251c49f41cfef45fc3eba3b > >> # EXP-Topic bisect > >> bisect: factor commonly update sequence > >> > >> For now, This remains a closure in the module to avoid circular import > >> with used > >> module. > >> > >> diff --git a/mercurial/commands.py b/mercurial/commands.py > >> --- a/mercurial/commands.py > >> +++ b/mercurial/commands.py > >> @@ -872,6 +872,13 @@ def bisect(ui, repo, rev=None, extra=Non > >> if not (state['good'] and state['bad']): > >> return > >> > >> +def mayupdate(repo, node, show_stats=True): > >> +"""common used update sequence""" > >> +if noupdate: > >> +return > >> +cmdutil.bailifchanged(repo) > >> +return hg.clean(repo, node, show_stats=show_stats) > > > >> if changesets == 0: > >> @@ -954,9 +956,7 @@ def bisect(ui, repo, rev=None, extra=Non > >> % (rev, short(node), changesets, tests)) > >> state['current'] = [node] > >> hbisect.save_state(repo, state) > >> -if not noupdate: > >> -cmdutil.bailifchanged(repo) > >> -return hg.clean(repo, node) > >> +mayupdate(repo, node) > > > > Missed return value. > > > > Other than that, the patch 1-7 look good to me. Should I fix that in flight? > > Good catch, if you can fix it in flight, that would be great. (I can > reset from patch 6 if that is easier for you) Fixed in flight and queued 1-7, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 2 v2] test-clone: discard lock-related messages
On 10/09/2016 09:32 PM, Augie Fackler wrote: # HG changeset patch # User Augie Fackler# Date 147600 14400 # Sun Oct 09 04:37:02 2016 -0400 # Node ID 932b47efd29bab6270d5aca81a24891380c93629 # Parent 340c57968bc1a37877df68c3ce5105a590129715 test-clone: discard lock-related messages We can't predict where those will show up and they're not super-important for the contents of this particular test, so just drop them. Further reduces the flakiness of the test to zero. Many thanks for nailing this back in place. I've pushed this to hg-commited. Cheers, -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: add an os.fsencode backport to ease path handling
On Sun, 09 Oct 2016 17:45:16 +0200, Martijn Pieters wrote: > # HG changeset patch > # User Martijn Pieters> # Date 1476027863 -7200 > # Sun Oct 09 17:44:23 2016 +0200 > # Node ID 1fef9008cbd2098f058f1458df4d59552da88c16 > # Parent 82489cd912f332be976cf432673ad47af0d04cd7 > py3: add an os.fsencode backport to ease path handling > > diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py > --- a/mercurial/pycompat.py > +++ b/mercurial/pycompat.py > @@ -34,6 +34,7 @@ > if ispy3: > import builtins > import functools > +from os import fsencode > > def sysstr(s): > """Return a keyword str to be passed to Python functions such as > @@ -64,6 +65,34 @@ > def sysstr(s): > return s > > +# Partial backport from os.py in Python 3 > +def _fscodec(): > +encoding = sys.getfilesystemencoding() > +if encoding == 'mbcs': > +errors = 'strict' > +else: > +errors = 'surrogateescape' > + > +def fsencode(filename): > +""" > +Encode filename to the filesystem encoding with 'surrogateescape' > +error handler, return bytes unchanged. On Windows, use 'strict' > +error handler if the file system encoding is 'mbcs' (which is the > +default encoding). > +""" > +if isinstance(filename, str): > +return filename > +elif isinstance(filename, unicode): > +return filename.encode(encoding, errors) It appears that 'surrogateescape' is a Python 3 thing. We have encoding.fromutf8b/toutf8b() which should do the same thing for 'utf-8', but I have no idea how 'surrogateescape' works for the other encodings. https://docs.python.org/3/library/codecs.html ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 6 of 8] bisect: factor commonly update sequence
On Sun, 09 Oct 2016 10:57:40 +0200, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David> # Date 1472007886 -7200 > # Wed Aug 24 05:04:46 2016 +0200 > # Node ID eb7d02debaf5ed831f12b509f4175ebb0cd40143 > # Parent 45469b6da789e8d07251c49f41cfef45fc3eba3b > # EXP-Topic bisect > bisect: factor commonly update sequence > > For now, This remains a closure in the module to avoid circular import with > used > module. > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -872,6 +872,13 @@ def bisect(ui, repo, rev=None, extra=Non > if not (state['good'] and state['bad']): > return > > +def mayupdate(repo, node, show_stats=True): > +"""common used update sequence""" > +if noupdate: > +return > +cmdutil.bailifchanged(repo) > +return hg.clean(repo, node, show_stats=show_stats) > if changesets == 0: > @@ -954,9 +956,7 @@ def bisect(ui, repo, rev=None, extra=Non > % (rev, short(node), changesets, tests)) > state['current'] = [node] > hbisect.save_state(repo, state) > -if not noupdate: > -cmdutil.bailifchanged(repo) > -return hg.clean(repo, node) > +mayupdate(repo, node) Missed return value. Other than that, the patch 1-7 look good to me. Should I fix that in flight? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 8 of 8] bisect: extra a small initialisation outside of a loop
On Sun, 09 Oct 2016 10:57:42 +0200, Pierre-Yves David wrote: > # HG changeset patch > # User Pierre-Yves David> # Date 1472008186 -7200 > # Wed Aug 24 05:09:46 2016 +0200 > # Node ID 4df38a2b962c5cccb1a3f6716a7d6a872832b662 > # Parent e5012181a722d5cb544c935400c676fce2d7b0a8 > # EXP-Topic bisect > bisect: extra a small initialisation outside of a loop > > Having initialisation done during the first iteration is cute, but can be > avoided. > > diff --git a/mercurial/commands.py b/mercurial/commands.py > --- a/mercurial/commands.py > +++ b/mercurial/commands.py > @@ -893,6 +893,8 @@ def bisect(ui, repo, rev=None, extra=Non > node, p2 = repo.dirstate.parents() > if p2 != nullid: > raise error.Abort(_('current bisect revision is a merge')) > +if rev: > +node = repo[scmutil.revsingle(repo, rev, node)].node() It seems we need to initialize node even if --noupdate is specified. > try: > while changesets: > # update state > @@ -910,9 +912,8 @@ def bisect(ui, repo, rev=None, extra=Non > raise error.Abort(_("%s killed") % command) > else: > transition = "bad" > -ctx = scmutil.revsingle(repo, rev, node) > -rev = None # clear for future iterations > -state[transition].append(ctx.node()) > +state[transition].append(node) > +ctx = repo[node] ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 2 v2] test-clone: discard lock-related messages
# HG changeset patch # User Augie Fackler# Date 147600 14400 # Sun Oct 09 04:37:02 2016 -0400 # Node ID 932b47efd29bab6270d5aca81a24891380c93629 # Parent 340c57968bc1a37877df68c3ce5105a590129715 test-clone: discard lock-related messages We can't predict where those will show up and they're not super-important for the contents of this particular test, so just drop them. Further reduces the flakiness of the test to zero. diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -1065,7 +1065,7 @@ don't care which is which, so we just ma one containing "new pooled" first, then one one containing "existing pooled". - $ grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log + $ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) requesting all changes adding changesets @@ -1078,10 +1078,8 @@ pooled". updating working directory 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log + $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) - waiting for lock on repository share-destrace2 held by * (glob) - got lock after \d+ seconds (re) searching for changes no changes found adding remote bookmark bookA ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 2 v2] test-clone: fix some instability in pooled clone race condition test
# HG changeset patch # User Augie Fackler# Date 1476001522 14400 # Sun Oct 09 04:25:22 2016 -0400 # Node ID 340c57968bc1a37877df68c3ce5105a590129715 # Parent 74cd33c9be76c11ba42ba5f2448dcf90419866ba test-clone: fix some instability in pooled clone race condition test Healthy output (one log file mentioning "existing pooled" and one mentioning "new pooled") will now print in a stable order, but unhealthy output will print some sort of error. This reduces the flakiness of the test from 55% to 38%. My next patch makes it completely stable. diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -1060,7 +1060,12 @@ Cloning into pooled storage doesn't race date:Thu Jan 01 00:00:00 1970 + summary: 1a - $ cat race1.log +One repo should be new, the other should be shared from the pool. We +don't care which is which, so we just make sure we always print the +one containing "new pooled" first, then one one containing "existing +pooled". + + $ grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) requesting all changes adding changesets @@ -1073,7 +1078,7 @@ Cloning into pooled storage doesn't race updating working directory 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ cat race2.log + $ grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) waiting for lock on repository share-destrace2 held by * (glob) got lock after \d+ seconds (re) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] eol: on update, only re-check files if filtering changed
On 10/09/2016 04:45 PM, Pierre-Yves David wrote: On 10/09/2016 04:19 PM, Mads Kiilerich wrote: diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -312,10 +312,15 @@ def reposetup(ui, repo): self._eolmatch = util.never return +oldeol = None try: cachemtime = os.path.getmtime(self.join("eol.cache")) This seems like it should live in the "cache/" directory. Any reason not to ? I don't know. I guess it predates the cache directory. I would probably agree it now would be better if it lived there. This patch is backwards compatible and doesn't change that. Changing the location would be a separate independent change - and apparently trivial and backwards compatible. /Mads ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
mercurial@30077: 14 new changesets
14 new changesets in mercurial: http://selenic.com/repo/hg//rev/b24804f72116 changeset: 30064:b24804f72116 user:Pierre-Yves Daviddate:Wed Aug 24 04:31:49 2016 +0200 summary: bisect: access the filesystem through vfs when reseting http://selenic.com/repo/hg//rev/ee21ed7fc7a2 changeset: 30065:ee21ed7fc7a2 user:Pierre-Yves David date:Wed Aug 24 04:13:53 2016 +0200 summary: bisect: extract the 'reset' logic into its own function http://selenic.com/repo/hg//rev/5f93737d0ba8 changeset: 30066:5f93737d0ba8 user:Pierre-Yves David date:Wed Aug 24 04:16:07 2016 +0200 summary: bisect: move the 'extendrange' to the 'hbisect' module http://selenic.com/repo/hg//rev/6e88cd060ba2 changeset: 30067:6e88cd060ba2 user:Pierre-Yves David date:Wed Aug 24 04:19:11 2016 +0200 summary: bisect: move 'printresult' in the 'hbisect' module http://selenic.com/repo/hg//rev/a76d5ba7ac43 changeset: 30068:a76d5ba7ac43 user:Pierre-Yves David date:Tue Aug 23 23:47:59 2016 +0200 summary: pull: grab wlock during pull http://selenic.com/repo/hg//rev/98b9846a131e changeset: 30069:98b9846a131e user:Pierre-Yves David date:Thu Aug 11 14:51:19 2016 +0200 summary: perf: release lock after transaction in perffncachewrite http://selenic.com/repo/hg//rev/3006d0d26ad3 changeset: 30070:3006d0d26ad3 user:Pierre-Yves David date:Thu Aug 11 15:05:17 2016 +0200 summary: mq: release lock after transaction in qrefresh http://selenic.com/repo/hg//rev/2def3d55b1b9 changeset: 30071:2def3d55b1b9 user:Augie Fackler date:Fri Oct 07 08:32:40 2016 -0400 summary: revset: build _syminitletters from a saner source: the string module http://selenic.com/repo/hg//rev/87b8e40eb812 changeset: 30072:87b8e40eb812 user:Pulkit Goyal <7895pul...@gmail.com> date:Fri Oct 07 17:30:11 2016 +0200 summary: mail: handle renamed email.Header http://selenic.com/repo/hg//rev/aa23c93e636d changeset: 30073:aa23c93e636d user:Pulkit Goyal <7895pul...@gmail.com> date:Sat Oct 08 16:10:58 2016 +0200 summary: py3: make format strings unicodes and not bytes http://selenic.com/repo/hg//rev/8f34e217338b changeset: 30074:8f34e217338b user:Tooru Fujisawa date:Sat Oct 08 19:32:54 2016 +0900 summary: hgweb: avoid line wrap between revision and annotate-info (issue5398) http://selenic.com/repo/hg//rev/2c8ec8c2ddfe changeset: 30075:2c8ec8c2ddfe user:Gábor Stefanik date:Mon Oct 03 13:29:59 2016 +0200 summary: copies: don't record divergence for files needing no merge http://selenic.com/repo/hg//rev/400dfded8a29 changeset: 30076:400dfded8a29 user:Mateusz Kwapich date:Sat Oct 08 08:45:28 2016 -0700 summary: py3: make the string unicode so its iterable in py3k http://selenic.com/repo/hg//rev/8f42d8c412c8 changeset: 30077:8f42d8c412c8 bookmark:@ tag: tip user:Mateusz Kwapich date:Sat Oct 08 08:54:05 2016 -0700 summary: py3: make encodefun in store.py compatible with py3k -- Repository URL: http://selenic.com/repo/hg/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V2] py3: a second argument to open can't be bytes
On Sun, Oct 09, 2016 at 02:10:40PM +0200, Martijn Pieters wrote: > # HG changeset patch > # User Martijn Pieters> # Date 1476015001 -7200 > # Sun Oct 09 14:10:01 2016 +0200 > # Node ID 82489cd912f332be976cf432673ad47af0d04cd7 > # Parent a56076f85aa6aa728457ecc571ff58514bc59896 > py3: a second argument to open can't be bytes Queued, thanks! > > diff --git a/mercurial/__init__.py b/mercurial/__init__.py > --- a/mercurial/__init__.py > +++ b/mercurial/__init__.py > @@ -305,6 +305,24 @@ > except IndexError: > pass > > +# Bare open call (not an attribute on something else) > +if (fn == 'open' and not (prevtoken.type == token.OP and > + prevtoken.string == '.')): > +try: > +# (NAME, 'open') > +# (OP, '(') > +# (NAME|STRING, 'filename') > +# (OP, ',') > +# (NAME|STRING, mode) > +st = tokens[i + 4] > +if (st.type == token.STRING and > +st.string[0] in ("'", '"')): > +rt = tokenize.TokenInfo(st.type, 'u%s' % > st.string, > +st.start, st.end, > st.line) > +tokens[i + 4] = rt > +except IndexError: > +pass > + > # It changes iteritems to items as iteritems is not > # present in Python 3 world. > if fn == 'iteritems': > @@ -319,7 +337,7 @@ > # ``replacetoken`` or any mechanism that changes semantics of module > # loading is changed. Otherwise cached bytecode may get loaded without > # the new transformation mechanisms applied. > -BYTECODEHEADER = b'HG\x00\x04' > +BYTECODEHEADER = b'HG\x00\x05' > > class hgloader(importlib.machinery.SourceFileLoader): > """Custom module loader that transforms source code. > ___ > 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
[PATCH] py3: add an os.fsencode backport to ease path handling
# HG changeset patch # User Martijn Pieters# Date 1476027863 -7200 # Sun Oct 09 17:44:23 2016 +0200 # Node ID 1fef9008cbd2098f058f1458df4d59552da88c16 # Parent 82489cd912f332be976cf432673ad47af0d04cd7 py3: add an os.fsencode backport to ease path handling diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -34,6 +34,7 @@ if ispy3: import builtins import functools +from os import fsencode def sysstr(s): """Return a keyword str to be passed to Python functions such as @@ -64,6 +65,34 @@ def sysstr(s): return s +# Partial backport from os.py in Python 3 +def _fscodec(): +encoding = sys.getfilesystemencoding() +if encoding == 'mbcs': +errors = 'strict' +else: +errors = 'surrogateescape' + +def fsencode(filename): +""" +Encode filename to the filesystem encoding with 'surrogateescape' +error handler, return bytes unchanged. On Windows, use 'strict' +error handler if the file system encoding is 'mbcs' (which is the +default encoding). +""" +if isinstance(filename, str): +return filename +elif isinstance(filename, unicode): +return filename.encode(encoding, errors) +else: +raise TypeError( +"expect str or unicode, not %s" % type(filename).__name__) + +return fsencode + +fsencode = _fscodec() +del _fscodec + stringio = io.StringIO empty = _queue.Empty queue = _queue.Queue ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: make check-py3-compat.py import importlib only if necessary
On Sun, Oct 09, 2016 at 05:23:43PM +0200, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara> # Date 1476025354 -7200 > # Sun Oct 09 17:02:34 2016 +0200 > # Node ID 7da151679301cf2a8331e411597f648bf3dce6b2 > # Parent 8e42dfde93d10e099040e9b57c70b7774235d883 > py3: make check-py3-compat.py import importlib only if necessary Queued, many thanks. > > importlib isn't available on Python 2.6, and it isn't necessary for Py2 > checks. > > diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py > --- a/contrib/check-py3-compat.py > +++ b/contrib/check-py3-compat.py > @@ -10,7 +10,6 @@ > from __future__ import absolute_import, print_function > > import ast > -import importlib > import os > import sys > import traceback > @@ -41,6 +40,7 @@ def check_compat_py2(f): > > def check_compat_py3(f): > """Check Python 3 compatibility of a file with Python 3.""" > +import importlib # not available on Python 2.6 > with open(f, 'rb') as fh: > content = fh.read() > > ___ > 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
Re: [PATCH] templater: handle division by zero in arithmetic
On Sun, 9 Oct 2016 08:11:07 -0700, Simon Farnsworth wrote: > # HG changeset patch > # User Simon Farnsworth> # Date 1476025760 25200 > # Sun Oct 09 08:09:20 2016 -0700 > # Node ID ad830281f2cd1a6fd2249813a8a1ceddf3d0d2e8 > # Parent 8e42dfde93d10e099040e9b57c70b7774235d883 > templater: handle division by zero in arithmetic Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] templater: handle division by zero in arithmetic
# HG changeset patch # User Simon Farnsworth# Date 1476025760 25200 # Sun Oct 09 08:09:20 2016 -0700 # Node ID ad830281f2cd1a6fd2249813a8a1ceddf3d0d2e8 # Parent 8e42dfde93d10e099040e9b57c70b7774235d883 templater: handle division by zero in arithmetic For now, just turn it to an abort. diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -439,7 +439,10 @@ _('arithmetic only defined on integers')) right = evalinteger(context, mapping, right, _('arithmetic only defined on integers')) -return func(left, right) +try: +return func(left, right) +except ZeroDivisionError: +raise error.Abort(_('division by zero is not defined')) def buildfunc(exp, context): n = getsymbol(exp[1]) @@ -741,12 +744,8 @@ # i18n: "mod" is a keyword raise error.ParseError(_("mod expects two arguments")) -left = evalinteger(context, mapping, args[0], - _('arithmetic only defined on integers')) -right = evalinteger(context, mapping, args[1], -_('arithmetic only defined on integers')) - -return left % right +func = lambda a, b: a % b +return runarithmetic(context, mapping, (func, args[0], args[1])) @templatefunc('relpath(path)') def relpath(context, mapping, args): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 01 of 11 py3] parsers: move PyInt aliasing out of util.h
> On Oct 9, 2016, at 16:16, Augie Facklerwrote: > > # HG changeset patch > # User Gregory Szorc > # Date 1476013853 -7200 > # Sun Oct 09 13:50:53 2016 +0200 > # Node ID 9b6ff0f940ed2ee33516aac22d5c69914400af7a > # Parent a989fa78dafa228d09c12c48e9e2d85ed7a9beb7 > parsers: move PyInt aliasing out of util.h Ugh, ignore this first patch (but please review the rest of the series). I copied the wrong hash for email. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH v2] templater: provide arithmetic operations on integers
On 09/10/2016 16:51, Yuya Nishihara wrote: On Sun, 9 Oct 2016 05:53:25 -0700, Simon Farnsworth wrote: # HG changeset patch # User Simon Farnsworth# Date 1476017464 25200 # Sun Oct 09 05:51:04 2016 -0700 # Node ID 2e2c959de0fe2c17bf6c5f47c01035a36f13c593 # Parent dbcef8918bbdd8a64d9f79a37bcfa284a26f3a39 templater: provide arithmetic operations on integers Nice. Queued slight modified version, thanks. We'll need to catch ZeroDivisionError as a follow-up. Follow-up incoming to turn ZeroDivisionError into an abort (and to reuse runarithmetic() in mod()). +But negate binds closer still: + + $ hg debugtemplate -r0 -v '{1-3|stringify}\n' + (template +(- + ('integer', '1') + (| +('integer', '3') +('symbol', 'stringify'))) +('string', '\n')) + hg: parse error: arithmetic only defined on integers + [255] For the record, this fails because '3' is taken as a keyword (for backward compatibility), and evaluated to ''. Indeed - the parse tree is the important bit here, not the failure, as it shows that we've parsed '1-3' as a subtraction with the right precedence, not as '1' then '-3'. -- Simon Farnsworth ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 3] eol: store and reuse pattern matchers instead of creating in tight loop
On 10/09/2016 04:19 PM, Mads Kiilerich wrote: # HG changeset patch # User Mads Kiilerich# Date 1476021282 -7200 # Sun Oct 09 15:54:42 2016 +0200 # Node ID 5240a8c9b6289838592f24f4e41a1158a48b951a # Parent 408ddba4689de432fe77e0ba8d27765b63719180 eol: store and reuse pattern matchers instead of creating in tight loop More "right" and more efficient. Pushed, thanks. -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] eol: on update, only re-check files if filtering changed
On 10/09/2016 04:19 PM, Mads Kiilerich wrote: # HG changeset patch # User Mads Kiilerich# Date 1476021289 -7200 # Sun Oct 09 15:54:49 2016 +0200 # Node ID 956e0c953cca045fc2bb57867b8c95f123d66841 # Parent 5240a8c9b6289838592f24f4e41a1158a48b951a eol: on update, only re-check files if filtering changed Before, update would mark all files as 'normallookup' in dirstate if .hgeol changed so all files would get the new filtering applied. That takes some time ... and is pointless if the filtering for that file didn't change. Instead, keep track of the old filtering and only check files where the filtering is changed. To keep the old filtering, change to write the applied .hgeol content to .hg/eol.cache instead of just touching it. That change is backwards/forwards compatible. In a real world test, this takes an update that is changing .hgeol and 3 files from 12s to 4s - where the remaining eol overhead is 1-2s. diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -312,10 +312,15 @@ def reposetup(ui, repo): self._eolmatch = util.never return +oldeol = None try: cachemtime = os.path.getmtime(self.join("eol.cache")) This seems like it should live in the "cache/" directory. Any reason not to ? -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 11 of 11 py3] extensions: fix extension module hunting on Python 3
On Sun, Oct 9, 2016 at 4:35 PM, Martijn Pieterswrote: > On 9 October 2016 at 16:32, Kevin Bullock > wrote: >> >> > On Oct 9, 2016, at 16:16, Augie Fackler wrote: >> > >> > # HG changeset patch >> > # User Augie Fackler >> > # Date 1476019688 14400 >> > # Sun Oct 09 09:28:08 2016 -0400 >> > # Node ID e6a69e778cb02cada23352df512b8580026640d9 >> > # Parent e89f400277d564c4a576ad8e4a6003a201993639 >> > extensions: fix extension module hunting on Python 3 >> > >> > importlib is a firm believer that paths are really strings, not >> > bytes. Fortunately we have os.fsdecode to help us with that. >> >> As I just discovered looking into our current py2.6 breakage on buildbot, >> importlib doesn't exist at all until 2.7. > > > Ick. Urg. Having to backport importlib to 2.6 may hurt. > >> >> Also a question on this series: no test changes in >> test-check-py3-compat.t? Yeah we are now fixing issues by running commands like hg version, debuginstall or trying to make local on Python 3. > > > These are all found by running hg version; Pulkit's patch to add commands to > test-check-py3-compat.t should remedy this issue. Apart from adding a #if py3exe, that patch needs some treatment related to paths, will copy the way we show the message in test-check-py3-compat.t, will need to write a script in contrib, will do that shortly. >> >> pacem in terris / мир / शान्ति / سَلاَم / 平和 >> Kevin R. Bullock >> >> ___ >> Mercurial-devel mailing list >> Mercurial-devel@mercurial-scm.org >> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > > > > > -- > Martijn Pieters > > ___ > 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
Re: [PATCH 11 of 11 py3] extensions: fix extension module hunting on Python 3
> On Oct 9, 2016, at 16:32, Kevin Bullock> wrote: > >> On Oct 9, 2016, at 16:16, Augie Fackler wrote: >> >> # HG changeset patch >> # User Augie Fackler >> # Date 1476019688 14400 >> # Sun Oct 09 09:28:08 2016 -0400 >> # Node ID e6a69e778cb02cada23352df512b8580026640d9 >> # Parent e89f400277d564c4a576ad8e4a6003a201993639 >> extensions: fix extension module hunting on Python 3 >> >> importlib is a firm believer that paths are really strings, not >> bytes. Fortunately we have os.fsdecode to help us with that. > > As I just discovered looking into our current py2.6 breakage on buildbot, > importlib doesn't exist at all until 2.7. Neat. It doesn't actually matter for this series, though the unavailability of os.fsdecode is a bummer for this patch in particular. > > Also a question on this series: no test changes in test-check-py3-compat.t? > > pacem in terris / мир / शान्ति / سَلاَم / 平和 > Kevin R. Bullock > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 11 of 11 py3] extensions: fix extension module hunting on Python 3
On 9 October 2016 at 16:32, Kevin Bullockwrote: > > On Oct 9, 2016, at 16:16, Augie Fackler wrote: > > > > # HG changeset patch > > # User Augie Fackler > > # Date 1476019688 14400 > > # Sun Oct 09 09:28:08 2016 -0400 > > # Node ID e6a69e778cb02cada23352df512b8580026640d9 > > # Parent e89f400277d564c4a576ad8e4a6003a201993639 > > extensions: fix extension module hunting on Python 3 > > > > importlib is a firm believer that paths are really strings, not > > bytes. Fortunately we have os.fsdecode to help us with that. > > As I just discovered looking into our current py2.6 breakage on buildbot, > importlib doesn't exist at all until 2.7. > Ick. Urg. Having to backport importlib to 2.6 may hurt. > Also a question on this series: no test changes in test-check-py3-compat.t? > These are all found by running hg version; Pulkit's patch to add commands to test-check-py3-compat.t should remedy this issue. > pacem in terris / мир / शान्ति / سَلاَم / 平和 > Kevin R. Bullock > > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > -- Martijn Pieters ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 11 of 11 py3] extensions: fix extension module hunting on Python 3
On 9 October 2016 at 16:16, Augie Facklerwrote: > # HG changeset patch > # User Augie Fackler > # Date 1476019688 14400 > # Sun Oct 09 09:28:08 2016 -0400 > # Node ID e6a69e778cb02cada23352df512b8580026640d9 > # Parent e89f400277d564c4a576ad8e4a6003a201993639 > extensions: fix extension module hunting on Python 3 > > importlib is a firm believer that paths are really strings, not > bytes. Fortunately we have os.fsdecode to help us with that. > os.fsdecode exists only in Python 3, I'm afraid. > This also makes a few strings r-strings to make them bytes on Py2 and > str on py3. That might be too clever? > > diff --git a/mercurial/extensions.py b/mercurial/extensions.py > --- a/mercurial/extensions.py > +++ b/mercurial/extensions.py > @@ -18,6 +18,7 @@ from .i18n import ( > from . import ( > cmdutil, > error, > +pycompat, > util, > ) > > @@ -57,8 +58,9 @@ def find(name): > return mod > > def loadpath(path, module_name): > -module_name = module_name.replace('.', '_') > +module_name = module_name.replace(r'.', r'_') > path = util.normpath(util.expandpath(path)) > +path = os.fsdecode(path) > if os.path.isdir(path): > # module/__init__.py style > d, f = os.path.split(path) > @@ -85,7 +87,7 @@ def _importext(name, path=None, reportfu > # the module will be loaded in sys.modules > # choose an unique name so that it doesn't > # conflicts with other modules > -mod = loadpath(path, 'hgext.%s' % name) > +mod = loadpath(path, pycompat.sysstr('hgext.%s' % name)) > else: > try: > mod = _importh("hgext.%s" % name) > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > -- Martijn Pieters ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] eol: store and reuse pattern matchers instead of creating in tight loop
# HG changeset patch # User Mads Kiilerich# Date 1476021282 -7200 # Sun Oct 09 15:54:42 2016 +0200 # Node ID 5240a8c9b6289838592f24f4e41a1158a48b951a # Parent 408ddba4689de432fe77e0ba8d27765b63719180 eol: store and reuse pattern matchers instead of creating in tight loop More "right" and more efficient. diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -175,25 +175,27 @@ class eolfile(object): include = [] exclude = [] +self.patterns = [] for pattern, style in self.cfg.items('patterns'): key = style.upper() if key == 'BIN': exclude.append(pattern) else: include.append(pattern) +m = match.match(root, '', [pattern]) +self.patterns.append((pattern, key, m)) # This will match the files for which we need to care # about inconsistent newlines. self.match = match.match(root, '', [], include, exclude) def copytoui(self, ui): -for pattern, style in self.cfg.items('patterns'): -key = style.upper() +for pattern, key, m in self.patterns: try: ui.setconfig('decode', pattern, self._decode[key], 'eol') ui.setconfig('encode', pattern, self._encode[key], 'eol') except KeyError: ui.warn(_("ignoring unknown EOL style '%s' from %s\n") -% (style, self.cfg.source('patterns', pattern))) +% (key, self.cfg.source('patterns', pattern))) # eol.only-consistent can be specified in ~/.hgrc or .hgeol for k, v in self.cfg.items('eol'): ui.setconfig('eol', k, v, 'eol') @@ -203,10 +205,10 @@ class eolfile(object): for f in (files or ctx.files()): if f not in ctx: continue -for pattern, style in self.cfg.items('patterns'): -if not match.match(repo.root, '', [pattern])(f): +for pattern, key, m in self.patterns: +if not m(f): continue -target = self._encode[style.upper()] +target = self._encode[key] data = ctx[f].data() if (target == "to-lf" and "\r\n" in data or target == "to-crlf" and singlelf.search(data)): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] eol: fix variable naming - call it _eolmatch instead of _eolfile
# HG changeset patch # User Mads Kiilerich# Date 1476020562 -7200 # Sun Oct 09 15:42:42 2016 +0200 # Node ID 408ddba4689de432fe77e0ba8d27765b63719180 # Parent dbcef8918bbdd8a64d9f79a37bcfa284a26f3a39 eol: fix variable naming - call it _eolmatch instead of _eolfile It is not the file but a match object based on it. diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -305,9 +305,9 @@ def reposetup(ui, repo): return eol.match def _hgcleardirstate(self): -self._eolfile = self.loadeol([None, 'tip']) -if not self._eolfile: -self._eolfile = util.never +self._eolmatch = self.loadeol([None, 'tip']) +if not self._eolmatch: +self._eolmatch = util.never return try: @@ -344,7 +344,7 @@ def reposetup(ui, repo): def commitctx(self, ctx, haserror=False): for f in sorted(ctx.added() + ctx.modified()): -if not self._eolfile(f): +if not self._eolmatch(f): continue fctx = ctx[f] if fctx is None: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] eol: on update, only re-check files if filtering changed
# HG changeset patch # User Mads Kiilerich# Date 1476021289 -7200 # Sun Oct 09 15:54:49 2016 +0200 # Node ID 956e0c953cca045fc2bb57867b8c95f123d66841 # Parent 5240a8c9b6289838592f24f4e41a1158a48b951a eol: on update, only re-check files if filtering changed Before, update would mark all files as 'normallookup' in dirstate if .hgeol changed so all files would get the new filtering applied. That takes some time ... and is pointless if the filtering for that file didn't change. Instead, keep track of the old filtering and only check files where the filtering is changed. To keep the old filtering, change to write the applied .hgeol content to .hg/eol.cache instead of just touching it. That change is backwards/forwards compatible. In a real world test, this takes an update that is changing .hgeol and 3 files from 12s to 4s - where the remaining eol overhead is 1-2s. diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -312,10 +312,15 @@ def reposetup(ui, repo): self._eolmatch = util.never return +oldeol = None try: cachemtime = os.path.getmtime(self.join("eol.cache")) except OSError: cachemtime = 0 +else: +olddata = self.vfs.read("eol.cache") +if olddata: +oldeol = eolfile(self.ui, self.root, olddata) try: eolmtime = os.path.getmtime(self.wjoin(".hgeol")) @@ -324,17 +329,37 @@ def reposetup(ui, repo): if eolmtime > cachemtime: self.ui.debug("eol: detected change in .hgeol\n") + +hgeoldata = self.wvfs.read('.hgeol') +neweol = eolfile(self.ui, self.root, hgeoldata) + wlock = None try: wlock = self.wlock() for f in self.dirstate: -if self.dirstate[f] == 'n': -# all normal files need to be looked at -# again since the new .hgeol file might no -# longer match a file it matched before -self.dirstate.normallookup(f) -# Create or touch the cache to update mtime -self.vfs("eol.cache", "w").close() +if self.dirstate[f] != 'n': +continue +if oldeol is not None: +if not oldeol.match(f) and not neweol.match(f): +continue +oldkey = None +for pattern, key, m in oldeol.patterns: +if m(f): +oldkey = key +break +newkey = None +for pattern, key, m in neweol.patterns: +if m(f): +newkey = key +break +if oldkey == newkey: +continue +# all normal files need to be looked at again since +# the new .hgeol file specify a different filter +self.dirstate.normallookup(f) +# Write the cache to update mtime and cache .hgeol +with self.vfs("eol.cache", "w") as f: +f.write(hgeoldata) wlock.release() except error.LockUnavailable: # If we cannot lock the repository and clear the ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[Bug 5402] New: During an RC window, "pip install mercurial" installs an RC version
https://bz.mercurial-scm.org/show_bug.cgi?id=5402 Bug ID: 5402 Summary: During an RC window, "pip install mercurial" installs an RC version Product: Mercurial Version: 3.9-rc Hardware: All OS: All Status: UNCONFIRMED Severity: bug Priority: wish Component: packaging Assignee: bugzi...@selenic.com Reporter: gabor.stefa...@nng.com CC: duri...@gmail.com, mercurial-de...@selenic.com Pip apparently can't recognize Mercurial RCs as pre-release. As a result, "pip install mercurial" with no version specified can inadvertently install an RC version. -- 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
[PATCH 3 of 3] checkcopies: add an inline comment about the '_related' call
# HG changeset patch # User Pierre-Yves David# Date 1475960455 -7200 # Sat Oct 08 23:00:55 2016 +0200 # Node ID 2a472b0c384f95503a6e4aa1c78d6b5c6dc886a9 # Parent 5801b0cd4ec0de5e9fb4129212d08f38fd66716b # EXP-Topic checkcopies checkcopies: add an inline comment about the '_related' call This helps understanding the flow of the function. diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -526,6 +526,8 @@ def _checkcopies(ctx, f, m1, m2, base, l if m2[of] == mb.get(of): return # no merge needed, quit early c2 = getfctx(of, m2[of]) +# c2 might be a plain new file on added on destination side that is +# unrelated to the droids we are looking for. cr = _related(oc, c2, base.rev()) if cr and (of == f or of == c2.path()): # non-divergent copy[f] = of ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 1 of 3] checkcopies: rename 'ca' to 'base'
# HG changeset patch # User Pierre-Yves David# Date 1475944722 -7200 # Sat Oct 08 18:38:42 2016 +0200 # Node ID c06cb63082bf571fb6fc24bac2e23feefe00 # Parent 2c8ec8c2ddfeb2d229b81eb5b11e3639fb34b0a0 # EXP-Topic checkcopies checkcopies: rename 'ca' to 'base' This variable was name after the common ancestor. It is actually the merge base that might differ from the common ancestor in the graft case. We rename the variable before a larger refactoring to clarify the situation. diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -454,7 +454,7 @@ def mergecopies(repo, c1, c2, ca): return copy, movewithdir, diverge, renamedelete -def _checkcopies(ctx, f, m1, m2, ca, limit, diverge, copy, fullcopy): +def _checkcopies(ctx, f, m1, m2, base, limit, diverge, copy, fullcopy): """ check possible copies of f from m1 to m2 @@ -462,7 +462,7 @@ def _checkcopies(ctx, f, m1, m2, ca, lim f = the filename to check m1 = the source manifest m2 = the destination manifest -ca = the changectx of the common ancestor +base = the changectx used as a merge base limit = the rev number to not search beyond diverge = record all diverges in this dict copy = record all non-divergent copies in this dict @@ -474,7 +474,7 @@ def _checkcopies(ctx, f, m1, m2, ca, lim once it "goes behind a certain revision". """ -ma = ca.manifest() +mb = base.manifest() getfctx = _makegetfctx(ctx) def _related(f1, f2, limit): @@ -523,15 +523,15 @@ def _checkcopies(ctx, f, m1, m2, ca, lim fullcopy[f] = of # remember for dir rename detection if of not in m2: continue # no match, keep looking -if m2[of] == ma.get(of): +if m2[of] == mb.get(of): return # no merge needed, quit early c2 = getfctx(of, m2[of]) -cr = _related(oc, c2, ca.rev()) +cr = _related(oc, c2, base.rev()) if cr and (of == f or of == c2.path()): # non-divergent copy[f] = of return -if of in ma: +if of in mb: diverge.setdefault(of, []).append(f) def duplicatecopies(repo, rev, fromrev, skiprev=None): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 11 of 11 py3] extensions: fix extension module hunting on Python 3
# HG changeset patch # User Augie Fackler# Date 1476019688 14400 # Sun Oct 09 09:28:08 2016 -0400 # Node ID e6a69e778cb02cada23352df512b8580026640d9 # Parent e89f400277d564c4a576ad8e4a6003a201993639 extensions: fix extension module hunting on Python 3 importlib is a firm believer that paths are really strings, not bytes. Fortunately we have os.fsdecode to help us with that. This also makes a few strings r-strings to make them bytes on Py2 and str on py3. That might be too clever? diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -18,6 +18,7 @@ from .i18n import ( from . import ( cmdutil, error, +pycompat, util, ) @@ -57,8 +58,9 @@ def find(name): return mod def loadpath(path, module_name): -module_name = module_name.replace('.', '_') +module_name = module_name.replace(r'.', r'_') path = util.normpath(util.expandpath(path)) +path = os.fsdecode(path) if os.path.isdir(path): # module/__init__.py style d, f = os.path.split(path) @@ -85,7 +87,7 @@ def _importext(name, path=None, reportfu # the module will be loaded in sys.modules # choose an unique name so that it doesn't # conflicts with other modules -mod = loadpath(path, 'hgext.%s' % name) +mod = loadpath(path, pycompat.sysstr('hgext.%s' % name)) else: try: mod = _importh("hgext.%s" % name) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 09 of 11 py3] config: open config files as binary explicitly all the time
# HG changeset patch # User Augie Fackler# Date 1476019794 14400 # Sun Oct 09 09:29:54 2016 -0400 # Node ID f3b993e256a8aeba26d2f927da9cf4428f7f1585 # Parent 2f926a3f2409af24260f826ca1823c564ffea03e config: open config files as binary explicitly all the time We had been getting lucky that on posix-like systems the default for files in Python 2 is binary IO, but now we're explicitly using binary IO all the time. diff --git a/mercurial/config.py b/mercurial/config.py --- a/mercurial/config.py +++ b/mercurial/config.py @@ -169,5 +169,5 @@ class config(object): def read(self, path, fp=None, sections=None, remap=None): if not fp: -fp = util.posixfile(path) +fp = util.posixfile(path, r'rb') self.parse(path, fp.read(), sections, remap, self.read) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 07 of 11 py3] dispatch: translate argv back to bytes on Python 3
# HG changeset patch # User Augie Fackler# Date 1476018603 14400 # Sun Oct 09 09:10:03 2016 -0400 # Node ID f2359d649c2164ba5efb3c202850064c7d777848 # Parent 88a5fecb60831eea7c44c6d6025ee23513528501 dispatch: translate argv back to bytes on Python 3 diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -57,7 +57,11 @@ class request(object): def run(): "run the command in sys.argv" -sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) +if sys.version_info > (3,4): +argv = list(map(os.fsencode, sys.argv)) +else: +argv = sys.argv +sys.exit((dispatch(request(argv[1:])) or 0) & 255) def _getsimilar(symbols, value): sim = lambda x: difflib.SequenceMatcher(None, value, x).ratio() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 02 of 11 py3] debuginstall: use %d instead of %s for formatting an int
# HG changeset patch # User Augie Fackler# Date 1476020566 14400 # Sun Oct 09 09:42:46 2016 -0400 # Node ID 826ebebef37bd58fea9abdd4690ea7b5ad6b7552 # Parent 9b6ff0f940ed2ee33516aac22d5c69914400af7a debuginstall: use %d instead of %s for formatting an int % formatting on bytes on Python 3 is pickier about which % character we specify. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2798,7 +2798,7 @@ def debuginstall(ui, **opts): if not problems: fm.data(problems=problems) fm.condwrite(problems, 'problems', - _("%s problems detected," + _("%d problems detected," " please check your install!\n"), problems) fm.end() ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 5] py3: slots should be unicode strings (pywatchman)
Thanks for all the patches related to Python 3. I think we should better don't touch pywatchman because they have already worked on it and will be sending a pull request to Mercurial soon. https://github.com/facebook/watchman/pull/247 On Sun, Oct 9, 2016 at 3:55 PM, Mateusz Kwapichwrote: > # HG changeset patch > # User Mateusz Kwapich > # Date 1476021239 25200 > # Sun Oct 09 06:53:59 2016 -0700 > # Node ID dd705da68bdc7e52ca7a06e92e0fb6e74af6647b > # Parent 9be0fc83663857b8843a781b6418a42fa0b15c65 > py3: slots should be unicode strings (pywatchman) > > like in mercurial/util.py:566 > > diff --git a/hgext/fsmonitor/pywatchman/pybser.py > b/hgext/fsmonitor/pywatchman/pybser.py > --- a/hgext/fsmonitor/pywatchman/pybser.py > +++ b/hgext/fsmonitor/pywatchman/pybser.py > @@ -236,7 +236,7 @@ def _bunser_array(buf, pos, mutable=True > # It provides by getattr accessors and getitem for both index > # and name. > class _BunserDict(object): > -__slots__ = ('_keys', '_values') > +__slots__ = (u'_keys', u'_values') > > def __init__(self, keys, values): > self._keys = keys > ___ > 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
[Bug 5400] New: Build using setup.py fails with Visual C++ compiler for Python 2.7; "pip install" works
https://bz.mercurial-scm.org/show_bug.cgi?id=5400 Bug ID: 5400 Summary: Build using setup.py fails with Visual C++ compiler for Python 2.7; "pip install" works Product: Mercurial Version: default branch Hardware: All OS: Windows Status: UNCONFIRMED Severity: bug Priority: wish Component: packaging Assignee: bugzi...@selenic.com Reporter: gabor.stefa...@nng.com CC: duri...@gmail.com, mercurial-de...@selenic.com On Windows, Visual C++ compiler for Python 2.7 is the recommended compiler to use for building the C parts of Python modules. With this compiler, "pip install mercurial" or "pip install ./hg-clone" works, but not "python setup.py build", as the latter tries to use the old distutils package, which can't find the compiler. Setting FORCE_SETUPTOOLS=1 helps. We should probably default to setuptools, at least for Windows. -- 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
[Bug 5399] New: setup.py needs a command equivalent to "make local"
https://bz.mercurial-scm.org/show_bug.cgi?id=5399 Bug ID: 5399 Summary: setup.py needs a command equivalent to "make local" Product: Mercurial Version: stable branch Hardware: PC OS: Windows Status: UNCONFIRMED Severity: feature Priority: wish Component: packaging Assignee: bugzi...@selenic.com Reporter: gabor.stefa...@nng.com CC: duri...@gmail.com, mercurial-de...@selenic.com On Windows, no first-party "make" command is available. This makes it impossible to do "make local", a command with no setup.py equivalent. It should instead be possible to do "python setup.py build -l" or "python setup.py build local". -- 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
Re: [PATCH 6 of 7] pathencode: use Py_SIZE directly
On Sun, Oct 9, 2016 at 3:28 PM, Yuya Nishiharawrote: > On Sun, 9 Oct 2016 15:15:34 +0200, Gregory Szorc wrote: > > On Sun, Oct 9, 2016 at 2:38 PM, Yuya Nishihara wrote: > > > On Sat, 08 Oct 2016 22:48:12 +0200, Gregory Szorc wrote: > > > > # HG changeset patch > > > > # User Gregory Szorc > > > > # Date 1475958082 -7200 > > > > # Sat Oct 08 22:21:22 2016 +0200 > > > > # Node ID 40775aad0c78f6c1fd07e7160d50426efbe032ed > > > > # Parent a33e93c20bc1290af106a0f077fece735ea05245 > > > > pathencode: use Py_SIZE directly > > > > > > > @@ -637,9 +638,10 @@ static PyObject *hashmangle(const char * > > > > if (lastdot >= 0) > > > > memcopy(dest, , destsize, [lastdot], > > > > len - lastdot - 1); > > > > > > > > - PyBytes_GET_SIZE(ret) = destlen; > > > > + PyBytes_Check(ret); > > > > + Py_SIZE(ret) = destlen; > > > > > > > > return ret; > > > > } > > > > > > > > @@ -749,9 +751,10 @@ PyObject *pathencode(PyObject *self, PyO > > > > > > > > newobj = PyBytes_FromStringAndSize(NULL, newlen); > > > > > > > > if (newobj) { > > > > - PyBytes_GET_SIZE(newobj)--; > > > > + PyBytes_Check(newobj); > > > > + Py_SIZE(newobj)--; > > > > > > Maybe we need to wrap these PyBytes_Check()s by assert() ? > > > > > > > I was going for a literal 1:1 port with this patch. I can submit a > > follow-up to convert to assert(). Is that acceptable? > > Seems fine. I just wondered why only the first PyBytes_Check() had > assert(). > Oh, I may not have amended correctly. Be on the lookout for errant assert()s in my other patches! ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 6 of 7] pathencode: use Py_SIZE directly
On Sun, Oct 9, 2016 at 2:38 PM, Yuya Nishiharawrote: > On Sat, 08 Oct 2016 22:48:12 +0200, Gregory Szorc wrote: > > # HG changeset patch > > # User Gregory Szorc > > # Date 1475958082 -7200 > > # Sat Oct 08 22:21:22 2016 +0200 > > # Node ID 40775aad0c78f6c1fd07e7160d50426efbe032ed > > # Parent a33e93c20bc1290af106a0f077fece735ea05245 > > pathencode: use Py_SIZE directly > > > @@ -637,9 +638,10 @@ static PyObject *hashmangle(const char * > > if (lastdot >= 0) > > memcopy(dest, , destsize, [lastdot], > > len - lastdot - 1); > > > > - PyBytes_GET_SIZE(ret) = destlen; > > + PyBytes_Check(ret); > > + Py_SIZE(ret) = destlen; > > > > return ret; > > } > > > > @@ -749,9 +751,10 @@ PyObject *pathencode(PyObject *self, PyO > > > > newobj = PyBytes_FromStringAndSize(NULL, newlen); > > > > if (newobj) { > > - PyBytes_GET_SIZE(newobj)--; > > + PyBytes_Check(newobj); > > + Py_SIZE(newobj)--; > > Maybe we need to wrap these PyBytes_Check()s by assert() ? > I was going for a literal 1:1 port with this patch. I can submit a follow-up to convert to assert(). Is that acceptable? FWIW, as part of the Python 3 port, I'll likely have to do a line-by-line audit of the C extensions. I imagine I'll be submitting a lot of miscellaneous fixups like converting certain things like this to assert(). ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: test to check which commands run
On Sun, Oct 9, 2016 at 2:48 PM, Kevin Bullockwrote: >> On Oct 9, 2016, at 14:12, Pulkit Goyal <7895pul...@gmail.com> wrote: >> >> # HG changeset patch >> # User Pulkit Goyal <7895pul...@gmail.com> >> # Date 1476014360 -7200 >> # Sun Oct 09 13:59:20 2016 +0200 >> # Node ID 1c8fe0486ff6657929f63f6c354662c6295cfd1d >> # Parent 3ce847adae982625abac548017e43da189eb5e71 >> py3: test to check which commands run >> >> This test helps us to keep track on the commands which runs to Python 3. >> >> diff -r 3ce847adae98 -r 1c8fe0486ff6 tests/test-check-py3-commands.t >> --- /dev/null Thu Jan 01 00:00:00 1970 + >> +++ b/tests/test-check-py3-commands.t Sun Oct 09 13:59:20 2016 +0200 >> @@ -0,0 +1,25 @@ >> +'''This test helps us in keeping track of what commands we can run in >> +Python 3. We can add more commands when this commands work in Python 3.''' >> + >> + >> + $ . "$TESTDIR/helpers-testrepo.sh" >> + $ cd "$TESTDIR"/.. >> + >> + $ $PYTHON3 hg version > > Looks like this needs '#require py3exe' at the top. Yeah otherwise the test will fail in Python 2 everytime. I will send a V2. > > pacem in terris / мир / शान्ति / سَلاَم / 平和 > Kevin R. Bullock > ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] store: get rid of dict comprehension for py2.6 compat
On Sun, Oct 9, 2016 at 3:02 PM, Mateusz Kwapichwrote: > # HG changeset patch > # User Mateusz Kwapich > # Date 1476018084 25200 > # Sun Oct 09 06:01:24 2016 -0700 > # Node ID 801817b85eb04a7d6c9d211b2a34d7e140ce8ecb > # Parent da08f4707282747cef3619341e07bd492470f41e > store: get rid of dict comprehension for py2.6 compat Martijn already fixed this one and that is pushed. > That's my bad. Let's change it to dict(generator). > > diff --git a/mercurial/store.py b/mercurial/store.py > --- a/mercurial/store.py > +++ b/mercurial/store.py > @@ -107,7 +107,7 @@ def _buildencodefun(): > asciistr = map(chr, xrange(127)) > capitals = list(range(ord("A"), ord("Z") + 1)) > > -cmap = {x:x for x in asciistr} > +cmap = dict(((x,x) for x in asciistr)) > for x in _reserved(): > cmap[xchr(x)] = "~%02x" % x > for x in capitals + [ord(e)]: > ___ > 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
[PATCH v2] templater: provide arithmetic operations on integers
# HG changeset patch # User Simon Farnsworth# Date 1476017464 25200 # Sun Oct 09 05:51:04 2016 -0700 # Node ID 2e2c959de0fe2c17bf6c5f47c01035a36f13c593 # Parent dbcef8918bbdd8a64d9f79a37bcfa284a26f3a39 templater: provide arithmetic operations on integers The termwidth template keyword is of limited use without some way to ensure that margins are respected. Provide a full set of arithmetic operators (four basic operations plus the mod function, defined to match Python's // for division), so that you can create termwidth based layouts that match the user's terminal size diff --git a/mercurial/help/templates.txt b/mercurial/help/templates.txt --- a/mercurial/help/templates.txt +++ b/mercurial/help/templates.txt @@ -43,6 +43,12 @@ .. functionsmarker +We provide a limited set of infix arithmetic operations on integers: + + for addition + - for subtraction + * for multiplication + / for floor division (division rounded to integer nearest -infinity) +Division fulfils the law x = x / y + mod(x, y). Also, for any expression that returns a list, there is a list operator:: expr % "{template}" diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -33,6 +33,10 @@ "|": (5, None, None, ("|", 5), None), "%": (6, None, None, ("%", 6), None), ")": (0, None, None, None, None), +"+": (3, None, None, ("+", 3), None), +"-": (3, None, ("negate", 10), ("-", 3), None), +"*": (4, None, None, ("*", 4), None), +"/": (4, None, None, ("/", 4), None), "integer": (0, "integer", None, None, None), "symbol": (0, "symbol", None, None, None), "string": (0, "string", None, None, None), @@ -48,7 +52,7 @@ c = program[pos] if c.isspace(): # skip inter-token whitespace pass -elif c in "(,)%|": # handle simple operators +elif c in "(,)%|+-*/": # handle simple operators yield (c, None, pos) elif c in '"\'': # handle quoted templates s = pos + 1 @@ -70,13 +74,8 @@ pos += 1 else: raise error.ParseError(_("unterminated string"), s) -elif c.isdigit() or c == '-': +elif c.isdigit(): s = pos -if c == '-': # simply take negate operator as part of integer -pos += 1 -if pos >= end or not program[pos].isdigit(): -raise error.ParseError(_("integer literal without digits"), s) -pos += 1 while pos < end: d = program[pos] if not d.isdigit(): @@ -420,6 +419,28 @@ # If so, return the expanded value. yield i +def buildnegate(exp, context): +arg = compileexp(exp[1], context, exprmethods) +return (runnegate, arg) + +def runnegate(context, mapping, data): +data = evalinteger(context, mapping, data, +_('negation needs an integer argument')) +return -data + +def buildarithmetic(exp, context, func): +left = compileexp(exp[1], context, exprmethods) +right = compileexp(exp[2], context, exprmethods) +return (runarithmetic, (func, left, right)) + +def runarithmetic(context, mapping, data): +func, left, right = data +left = evalinteger(context, mapping, left, +_('arithmetic only defined on integers')) +right = evalinteger(context, mapping, right, +_('arithmetic only defined on integers')) +return func(left, right) + def buildfunc(exp, context): n = getsymbol(exp[1]) args = [compileexp(x, context, exprmethods) for x in getlist(exp[2])] @@ -713,6 +734,20 @@ tzoffset = util.makedate()[1] return (date[0], tzoffset) +@templatefunc('mod(a, b)') +def mod(context, mapping, args): +"""Calculate a mod b such that a / b + a mod b == a""" +if not len(args) == 2: +# i18n: "mod" is a keyword +raise error.ParseError(_("mod expects two arguments")) + +left = evalinteger(context, mapping, args[0], +_('arithmetic only defined on integers')) +right = evalinteger(context, mapping, args[1], +_('arithmetic only defined on integers')) + +return left % right + @templatefunc('revset(query[, formatargs...])') def revset(context, mapping, args): """Execute a revision set query. See @@ -906,6 +941,7 @@ # methods to interpret function arguments or inner expressions (e.g. {_(x)}) exprmethods = { "integer": lambda e, c: (runinteger, e[1]), +"negate": lambda e, c: (runinteger, e[1]), "string": lambda e, c: (runstring, e[1]), "symbol": lambda e, c: (runsymbol, e[1]), "template": buildtemplate, @@ -914,6 +950,11 @@ "|": buildfilter, "%": buildmap, "func": buildfunc, +"+": lambda e, c: buildarithmetic(e, c, lambda a, b: a + b), +"-": lambda e, c: buildarithmetic(e, c, lambda a, b: a -
Re: [PATCH] py3: test to check which commands run
> On Oct 9, 2016, at 14:12, Pulkit Goyal <7895pul...@gmail.com> wrote: > > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1476014360 -7200 > # Sun Oct 09 13:59:20 2016 +0200 > # Node ID 1c8fe0486ff6657929f63f6c354662c6295cfd1d > # Parent 3ce847adae982625abac548017e43da189eb5e71 > py3: test to check which commands run > > This test helps us to keep track on the commands which runs to Python 3. > > diff -r 3ce847adae98 -r 1c8fe0486ff6 tests/test-check-py3-commands.t > --- /dev/null Thu Jan 01 00:00:00 1970 + > +++ b/tests/test-check-py3-commands.t Sun Oct 09 13:59:20 2016 +0200 > @@ -0,0 +1,25 @@ > +'''This test helps us in keeping track of what commands we can run in > +Python 3. We can add more commands when this commands work in Python 3.''' > + > + > + $ . "$TESTDIR/helpers-testrepo.sh" > + $ cd "$TESTDIR"/.. > + > + $ $PYTHON3 hg version Looks like this needs '#require py3exe' at the top. pacem in terris / мир / शान्ति / سَلاَم / 平和 Kevin R. Bullock ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 6 of 7] pathencode: use Py_SIZE directly
On Sat, 08 Oct 2016 22:48:12 +0200, Gregory Szorc wrote: > # HG changeset patch > # User Gregory Szorc> # Date 1475958082 -7200 > # Sat Oct 08 22:21:22 2016 +0200 > # Node ID 40775aad0c78f6c1fd07e7160d50426efbe032ed > # Parent a33e93c20bc1290af106a0f077fece735ea05245 > pathencode: use Py_SIZE directly > @@ -637,9 +638,10 @@ static PyObject *hashmangle(const char * > if (lastdot >= 0) > memcopy(dest, , destsize, [lastdot], > len - lastdot - 1); > > - PyBytes_GET_SIZE(ret) = destlen; > + PyBytes_Check(ret); > + Py_SIZE(ret) = destlen; > > return ret; > } > > @@ -749,9 +751,10 @@ PyObject *pathencode(PyObject *self, PyO > > newobj = PyBytes_FromStringAndSize(NULL, newlen); > > if (newobj) { > - PyBytes_GET_SIZE(newobj)--; > + PyBytes_Check(newobj); > + Py_SIZE(newobj)--; Maybe we need to wrap these PyBytes_Check()s by assert() ? ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] store: py26 compat, don't use a dict comprehension
On Sun, 09 Oct 2016 13:04:15 +0200, Martijn Pieters wrote: > # HG changeset patch > # User Martijn Pieters> # Date 1476010702 -7200 > # Sun Oct 09 12:58:22 2016 +0200 > # Node ID b49b0430810e1c398d05835dcebd21edf7596639 > # Parent 74cd33c9be76c11ba42ba5f2448dcf90419866ba > store: py26 compat, don't use a dict comprehension Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] help: backout the boolean flag marking in the help for now
On 10/09/2016 02:11 PM, Kevin Bullock wrote: On Oct 9, 2016, at 14:06, Pierre-Yves Davidwrote: # HG changeset patch # User Pierre-Yves David # Date 1475975478 -7200 # Sun Oct 09 03:11:18 2016 +0200 # Node ID ae009a7425ca52fdffa451506c0e47ff3750a895 # Parent dbcef8918bbdd8a64d9f79a37bcfa284a26f3a39 # EXP-Topic flag.bool help: backout the boolean flag marking in the help for now [...] diff --git a/tests/test-extension.t b/tests/test-extension.t --- a/tests/test-extension.t +++ b/tests/test-extension.t @@ -530,19 +530,19 @@ hide outer repo --cwd DIR change working directory -y --noninteractivedo not prompt, automatically pick the first choice for all prompts - -q --[no-]quietsuppress output - -v --[no-]verbose enable additional output + -q --quiet suppress output + -v --verbose enable additional output Why are these showing up in the backout? I thought the final patch that landed already skipped these flags--is that not true? The initial changeset is f3c4edfd35e1 (this fell of the description during the edition :-/) that changeset contains such line. I'm not sure why they end up being there. Does that answer your question ? We should probably reintroduce the original hash in the description. -- Pierre-Yves David ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: test to check which commands run
On 9 October 2016 at 14:12, Pulkit Goyal <7895pul...@gmail.com> wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1476014360 -7200 > # Sun Oct 09 13:59:20 2016 +0200 > # Node ID 1c8fe0486ff6657929f63f6c354662c6295cfd1d > # Parent 3ce847adae982625abac548017e43da189eb5e71 > py3: test to check which commands run > > This test helps us to keep track on the commands which runs to Python 3. > I like this idea. Easier than teaching people how to "make local PYTHON=python3". > diff -r 3ce847adae98 -r 1c8fe0486ff6 tests/test-check-py3-commands.t > --- /dev/null Thu Jan 01 00:00:00 1970 + > +++ b/tests/test-check-py3-commands.t Sun Oct 09 13:59:20 2016 +0200 > @@ -0,0 +1,25 @@ > +'''This test helps us in keeping track of what commands we can run in > +Python 3. We can add more commands when this commands work in Python 3.''' > + > + > + $ . "$TESTDIR/helpers-testrepo.sh" > + $ cd "$TESTDIR"/.. > + > + $ $PYTHON3 hg version > + Traceback (most recent call last): > +File "hg", line 45, in > + mercurial.dispatch.run() > +File "/home/pulkit/Repositories/MercurialRepositories/hg- > committed/mercurial/dispatch.py", line 60, in run > + sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255) > +File "/home/pulkit/Repositories/MercurialRepositories/hg- > committed/mercurial/dispatch.py", line 102, in dispatch > + req.ui = uimod.ui() > +File > "/home/pulkit/Repositories/MercurialRepositories/hg-committed/mercurial/ui.py", > line 139, in __init__ > + for f in scmutil.rcpath(): > +File "/home/pulkit/Repositories/MercurialRepositories/hg- > committed/mercurial/scmutil.py", line 758, in rcpath > + for p in os.environ['HGRCPATH'].split(os.pathsep): > +File "/usr/lib/python3.5/os.py", line 678, in __getitem__ > + value = self._data[self.encodekey(key)] > +File "/usr/lib/python3.5/os.py", line 754, in encode > + raise TypeError("str expected, not %s" % type(value).__name__) > + TypeError: str expected, not bytes > + [1] > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > -- Martijn Pieters ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] osutil: use PyLongObject on Python 3 for listdir_slot
# HG changeset patch # User Gregory Szorc# Date 1476013666 -7200 # Sun Oct 09 13:47:46 2016 +0200 # Node ID 6bdfe20ea811ac7e873072763d43f29c23edc409 # Parent 0cc68ebd34108cc609328379b46522b81f840851 osutil: use PyLongObject on Python 3 for listdir_slot This code looks performance sensitive. So let's retain PyIntObject on Python 2 and use PyLongObject explicitly on Python 3. diff --git a/mercurial/osutil.c b/mercurial/osutil.c --- a/mercurial/osutil.c +++ b/mercurial/osutil.c @@ -62,13 +62,21 @@ struct listdir_stat { struct stat st; }; #endif +#ifdef IS_PY3K +#define listdir_slot(name) \ + static PyObject *listdir_stat_##name(PyObject *self, void *x) \ + { \ + return PyLong_FromLong(((struct listdir_stat *)self)->st.name); \ + } +#else #define listdir_slot(name) \ static PyObject *listdir_stat_##name(PyObject *self, void *x) \ { \ return PyInt_FromLong(((struct listdir_stat *)self)->st.name); \ } +#endif listdir_slot(st_dev) listdir_slot(st_mode) listdir_slot(st_nlink) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 4 of 4] dirs: document performance reasons for bypassing Python C API
> On Oct 8, 2016, at 17:00, Gregory Szorcwrote: > > # HG changeset patch > # User Gregory Szorc > # Date 1475938278 -7200 > # Sat Oct 08 16:51:18 2016 +0200 > # Node ID 136b1a54213542f535f155de5ce01049b3577b4a > # Parent da39a5835ea2d1aae1a51995b6d7e593f598be4b > dirs: document performance reasons for bypassing Python C API Queued this series on the strength of Martijn's review. I also removed the #define IS_PY3K from patch 3 since it's now in util.h. If I'm wrong on that point let me know and we can add it back in. (I'm currently running tests against it.) pacem in terris / мир / शान्ति / سَلاَم / 平和 Kevin R. Bullock ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] py3: a second argument to open can't be bytes
# HG changeset patch # User Martijn Pieters# Date 1476012788 -7200 # Sun Oct 09 13:33:08 2016 +0200 # Node ID 096d7a42fe6425bf741b09d47e77b387c6180ca4 # Parent a56076f85aa6aa728457ecc571ff58514bc59896 py3: a second argument to open can't be bytes diff --git a/mercurial/__init__.py b/mercurial/__init__.py --- a/mercurial/__init__.py +++ b/mercurial/__init__.py @@ -305,6 +305,22 @@ except IndexError: pass +if fn == 'open': +try: +# (NAME, 'open') +# (OP, '(') +# (NAME|STRING, 'filename') +# (OP, ',') +# (NAME|STRING, mode) +st = tokens[i + 4] +if (st.type == token.STRING and +st.string[0] in ("'", '"')): +rt = tokenize.TokenInfo(st.type, 'u%s' % st.string, +st.start, st.end, st.line) +tokens[i + 4] = rt +except IndexError: +pass + # It changes iteritems to items as iteritems is not # present in Python 3 world. if fn == 'iteritems': @@ -319,7 +335,7 @@ # ``replacetoken`` or any mechanism that changes semantics of module # loading is changed. Otherwise cached bytecode may get loaded without # the new transformation mechanisms applied. -BYTECODEHEADER = b'HG\x00\x04' +BYTECODEHEADER = b'HG\x00\x05' class hgloader(importlib.machinery.SourceFileLoader): """Custom module loader that transforms source code. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] import: abort instead of crashing when copy source does not exist (issue5375)
On 10/8/2016 11:48 PM, Pierre-Yves David wrote: On 10/08/2016 07:06 PM, Mads Kiilerich wrote: On 10/08/2016 06:11 PM, Ryan McElroy wrote: # HG changeset patch # User Ryan McElroy# Date 1475929618 25200 # Sat Oct 08 05:26:58 2016 -0700 # Node ID 961569a2cbeebfd54c9369c6e36d03d4938aef38 # Parent dbcef8918bbdd8a64d9f79a37bcfa284a26f3a39 import: abort instead of crashing when copy source does not exist (issue5375) Previously, when a patch contained a move or copy from a source that did not exist, `hg import` would crash. This patch changes import to raise a PatchError with an explanantion of what is wrong with the patch to avoid the stack trace and bad user experience. diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1952,8 +1952,10 @@ def _applydiff(ui, fp, patcher, backend, data, mode = None, None if gp.op in ('RENAME', 'COPY'): data, mode = store.getfile(gp.oldpath)[:2] -# FIXME: failing getfile has never been handled here -assert data is not None +if data is None: +# This means that the old path does not exist +raise PatchError(_("source file '%s' does not exist") + % gp.oldpath) if gp.mode: mode = gp.mode if gp.op == 'ADD': diff --git a/tests/test-import.t b/tests/test-import.t --- a/tests/test-import.t +++ b/tests/test-import.t @@ -1793,3 +1793,13 @@ repository when file not found for patch 1 out of 1 hunks FAILED -- saving rejects to file file1.rej abort: patch failed to apply [255] + +test import crash (issue5375) + $ cd .. + $ hg init repo + $ cd repo + $ printf "diff --git a/a b/b\nrename from a\nrename to b" | hg import - + applying patch from stdin + a not tracked! + abort: source file 'a' does not exist + [255] Hmm. For a patch modifying a non-existing file we already get: unable to find 'f' for patching 1 out of 1 hunks FAILED -- saving rejects to file f.rej patch failed, unable to continue (try -v) patch failed, rejects left in working directory $ cat f.rej --- f +++ f @@ -1,1 +1,2 @@ +f In the tested case, I would thus also expect it to leave a .rej file with the failing rename "hunk" while applying the rest of the patch (even though a pure rename arguably *doesn't* have any hunks). BUT the logic around this check seems wrong. A rename or copy of a missing file should be handled exactly the same, no matter if it is a bare rename/copy or if it also modifies the file (= has a first hunk). I don't know if it is better to give a not-entirely-correct abort than to fail with an assertion error, but I think it still deserves a FIXME/TODO. +1 we should keep the same erro flow than for other patch error (especially because I'm not sure how --partial deal with this patch. (The iterhunks docstring seems wrong, for example regarding 'file' entries and firsthunk. Let's go find pmezard!) TGVs for Brest leave from Gare Montparnasse every hour. Cheers, 1/ I can't tell if this is actually still queued or not because of the follow-up comments. Do I need to send a V2 that keeps the TODO/FIXME line? 2/ I think not crashing is a very good start. I'm okay opening a follow-up issue to move on to even better behavior, but not crashing seems imperative. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] py3: use encoding.environ instead of os.environ
On 9 October 2016 at 13:20, Pulkit Goyal <7895pul...@gmail.com> wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1476009430 -7200 > # Sun Oct 09 12:37:10 2016 +0200 > # Node ID 3ce847adae982625abac548017e43da189eb5e71 > # Parent 74cd33c9be76c11ba42ba5f2448dcf90419866ba > py3: use encoding.environ instead of os.environ > > This complains while running hg version on Python 3.5 +1. And the excitement is mounting as we are now fixing issues by running `make local PYTHON=python3`. > diff -r 74cd33c9be76 -r 3ce847adae98 mercurial/scmutil.py > --- a/mercurial/scmutil.py Sat Oct 08 22:44:02 2016 +0200 > +++ b/mercurial/scmutil.py Sun Oct 09 12:37:10 2016 +0200 > @@ -753,7 +753,7 @@ > if no HGRCPATH, use default os-specific path.''' > global _rcpath > if _rcpath is None: > -if 'HGRCPATH' in os.environ: > +if 'HGRCPATH' in encoding.environ: > _rcpath = [] > for p in os.environ['HGRCPATH'].split(os.pathsep): > if not p: > ___ > Mercurial-devel mailing list > Mercurial-devel@mercurial-scm.org > https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel > -- Martijn Pieters ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH] py3: use encoding.environ instead of os.environ
# HG changeset patch # User Pulkit Goyal <7895pul...@gmail.com> # Date 1476009430 -7200 # Sun Oct 09 12:37:10 2016 +0200 # Node ID 3ce847adae982625abac548017e43da189eb5e71 # Parent 74cd33c9be76c11ba42ba5f2448dcf90419866ba py3: use encoding.environ instead of os.environ This complains while running hg version on Python 3.5 diff -r 74cd33c9be76 -r 3ce847adae98 mercurial/scmutil.py --- a/mercurial/scmutil.py Sat Oct 08 22:44:02 2016 +0200 +++ b/mercurial/scmutil.py Sun Oct 09 12:37:10 2016 +0200 @@ -753,7 +753,7 @@ if no HGRCPATH, use default os-specific path.''' global _rcpath if _rcpath is None: -if 'HGRCPATH' in os.environ: +if 'HGRCPATH' in encoding.environ: _rcpath = [] for p in os.environ['HGRCPATH'].split(os.pathsep): if not p: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 8] bisect: remove code about "update-flag" in check_state
# HG changeset patch # User Pierre-Yves David# Date 1472005360 -7200 # Wed Aug 24 04:22:40 2016 +0200 # Node ID fb1f6d1e179dcba1b078eb32172aca60e0adb287 # Parent eb87c5e0831476b6163dd480ae9efca98156bfa1 # EXP-Topic bisect bisect: remove code about "update-flag" in check_state Now that the flag dedicated to updating the flag are handled earlier, we do not need to handle them in the 'check_state' function. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -835,10 +835,8 @@ def bisect(ui, repo, rev=None, extra=Non Returns 0 on success. """ -def checkstate(state, interactive=True): +def checkstate(state): if not state['good'] or not state['bad']: -if (good or bad or skip or reset) and interactive: -return if not state['good']: raise error.Abort(_('cannot bisect (no known good revisions)')) else: @@ -879,6 +877,8 @@ def bisect(ui, repo, rev=None, extra=Non elif skip: state['skip'] += nodes hbisect.save_state(repo, state) +if not (state['good'] and state['bad']): +return if command: changesets = 1 @@ -913,7 +913,7 @@ def bisect(ui, repo, rev=None, extra=Non rev = None # clear for future iterations state[transition].append(ctx.node()) ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) -checkstate(state, interactive=False) +checkstate(state) # bisect nodes, changesets, bgood = hbisect.bisect(repo.changelog, state) # update to next check @@ -928,8 +928,7 @@ def bisect(ui, repo, rev=None, extra=Non hbisect.printresult(ui, repo, state, displayer, nodes, bgood) return -if not checkstate(state): -return +checkstate(state) # actually bisect nodes, changesets, good = hbisect.bisect(repo.changelog, state) ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 4 of 8] bisect: simplify conditional in 'check_state'
# HG changeset patch # User Pierre-Yves David# Date 1472005393 -7200 # Wed Aug 24 04:23:13 2016 +0200 # Node ID c0e6a5b2b049385418761b9892096e12afd06237 # Parent fb1f6d1e179dcba1b078eb32172aca60e0adb287 # EXP-Topic bisect bisect: simplify conditional in 'check_state' Now that extra code about "updating" flag have been removed, we can simplify the condition flow and remove a level. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -836,12 +836,12 @@ def bisect(ui, repo, rev=None, extra=Non Returns 0 on success. """ def checkstate(state): -if not state['good'] or not state['bad']: -if not state['good']: -raise error.Abort(_('cannot bisect (no known good revisions)')) -else: -raise error.Abort(_('cannot bisect (no known bad revisions)')) -return True +if state['good'] and state['bad']: +return True +if not state['good']: +raise error.Abort(_('cannot bisect (no known good revisions)')) +else: +raise error.Abort(_('cannot bisect (no known bad revisions)')) # backward compatibility if rev in "good bad reset init".split(): ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 5 of 8] bisect: move check_state into the bisect module
# HG changeset patch # User Pierre-Yves David# Date 1472005520 -7200 # Wed Aug 24 04:25:20 2016 +0200 # Node ID 45469b6da789e8d07251c49f41cfef45fc3eba3b # Parent c0e6a5b2b049385418761b9892096e12afd06237 # EXP-Topic bisect bisect: move check_state into the bisect module Now that the function is simpler, we resume our quest to move the logic into the bisect module. In the process, we add basic documentation. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -835,14 +835,6 @@ def bisect(ui, repo, rev=None, extra=Non Returns 0 on success. """ -def checkstate(state): -if state['good'] and state['bad']: -return True -if not state['good']: -raise error.Abort(_('cannot bisect (no known good revisions)')) -else: -raise error.Abort(_('cannot bisect (no known bad revisions)')) - # backward compatibility if rev in "good bad reset init".split(): ui.warn(_("(use of 'hg bisect ' is deprecated)\n")) @@ -913,7 +905,7 @@ def bisect(ui, repo, rev=None, extra=Non rev = None # clear for future iterations state[transition].append(ctx.node()) ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) -checkstate(state) +hbisect.checkstate(state) # bisect nodes, changesets, bgood = hbisect.bisect(repo.changelog, state) # update to next check @@ -928,7 +920,7 @@ def bisect(ui, repo, rev=None, extra=Non hbisect.printresult(ui, repo, state, displayer, nodes, bgood) return -checkstate(state) +hbisect.checkstate(state) # actually bisect nodes, changesets, good = hbisect.bisect(repo.changelog, state) diff --git a/mercurial/hbisect.py b/mercurial/hbisect.py --- a/mercurial/hbisect.py +++ b/mercurial/hbisect.py @@ -177,6 +177,17 @@ def resetstate(repo): if repo.vfs.exists("bisect.state"): repo.vfs.unlink("bisect.state") +def checkstate(state): +"""check we have both 'good' and 'bad' to define a range + +Raise Abort exception otherwise.""" +if state['good'] and state['bad']: +return True +if not state['good']: +raise error.Abort(_('cannot bisect (no known good revisions)')) +else: +raise error.Abort(_('cannot bisect (no known bad revisions)')) + def get(repo, status): """ Return a list of revision(s) that match the given status: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 8] bisect: rename 'check_code' to match our naming scheme
# HG changeset patch # User Pierre-Yves David# Date 1475977855 -7200 # Sun Oct 09 03:50:55 2016 +0200 # Node ID eb87c5e0831476b6163dd480ae9efca98156bfa1 # Parent f5c9ba11ffa8baef1c8c0d270094fd96be68b856 # EXP-Topic bisect bisect: rename 'check_code' to match our naming scheme We need to to it early, otherwise 'check-commit' will complains every time we touch it. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -835,7 +835,7 @@ def bisect(ui, repo, rev=None, extra=Non Returns 0 on success. """ -def check_state(state, interactive=True): +def checkstate(state, interactive=True): if not state['good'] or not state['bad']: if (good or bad or skip or reset) and interactive: return @@ -913,7 +913,7 @@ def bisect(ui, repo, rev=None, extra=Non rev = None # clear for future iterations state[transition].append(ctx.node()) ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) -check_state(state, interactive=False) +checkstate(state, interactive=False) # bisect nodes, changesets, bgood = hbisect.bisect(repo.changelog, state) # update to next check @@ -928,7 +928,7 @@ def bisect(ui, repo, rev=None, extra=Non hbisect.printresult(ui, repo, state, displayer, nodes, bgood) return -if not check_state(state): +if not checkstate(state): return # actually bisect ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 8 of 8] bisect: extra a small initialisation outside of a loop
# HG changeset patch # User Pierre-Yves David# Date 1472008186 -7200 # Wed Aug 24 05:09:46 2016 +0200 # Node ID 4df38a2b962c5cccb1a3f6716a7d6a872832b662 # Parent e5012181a722d5cb544c935400c676fce2d7b0a8 # EXP-Topic bisect bisect: extra a small initialisation outside of a loop Having initialisation done during the first iteration is cute, but can be avoided. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -893,6 +893,8 @@ def bisect(ui, repo, rev=None, extra=Non node, p2 = repo.dirstate.parents() if p2 != nullid: raise error.Abort(_('current bisect revision is a merge')) +if rev: +node = repo[scmutil.revsingle(repo, rev, node)].node() try: while changesets: # update state @@ -910,9 +912,8 @@ def bisect(ui, repo, rev=None, extra=Non raise error.Abort(_("%s killed") % command) else: transition = "bad" -ctx = scmutil.revsingle(repo, rev, node) -rev = None # clear for future iterations -state[transition].append(ctx.node()) +state[transition].append(node) +ctx = repo[node] ui.status(_('changeset %d:%s: %s\n') % (ctx, ctx, transition)) hbisect.checkstate(state) # bisect ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 7 of 8] bisect: build a displayer only once
# HG changeset patch # User Pierre-Yves David# Date 1472007981 -7200 # Wed Aug 24 05:06:21 2016 +0200 # Node ID e5012181a722d5cb544c935400c676fce2d7b0a8 # Parent eb7d02debaf5ed831f12b509f4175ebb0cd40143 # EXP-Topic bisect bisect: build a displayer only once There is multiple spot using this, building it early will help to extract more of the logic into the bisect module. diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -879,6 +879,8 @@ def bisect(ui, repo, rev=None, extra=Non cmdutil.bailifchanged(repo) return hg.clean(repo, node, show_stats=show_stats) +displayer = cmdutil.show_changeset(ui, repo, {}) + if command: changesets = 1 if noupdate: @@ -921,7 +923,6 @@ def bisect(ui, repo, rev=None, extra=Non finally: state['current'] = [node] hbisect.save_state(repo, state) -displayer = cmdutil.show_changeset(ui, repo, {}) hbisect.printresult(ui, repo, state, displayer, nodes, bgood) return @@ -941,7 +942,6 @@ def bisect(ui, repo, rev=None, extra=Non raise error.Abort(_("nothing to extend")) if changesets == 0: -displayer = cmdutil.show_changeset(ui, repo, {}) hbisect.printresult(ui, repo, state, displayer, nodes, good) else: assert len(nodes) == 1 # only a single node can be tested next ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 2] test-clone: fix some instability in pooled clone race condition test
\sadtrombone{I forgot to run check-code, will re-send with check-code happy} (In other words: drop these patches for now, sorry for the noise) > On Oct 9, 2016, at 10:42, Augie Facklerwrote: > > # HG changeset patch > # User Augie Fackler > # Date 1476001522 14400 > # Sun Oct 09 04:25:22 2016 -0400 > # Node ID eb00b5d08443c5a5cef981c25def007685ed1fe6 > # Parent 67b0484c9ce4960b67aa634f097c4d833e1d034a > test-clone: fix some instability in pooled clone race condition test > > Healthy output (one log file mentioning "existing pooled" and one > mentioning "new pooled") will now print in a stable order, but > unhealthy output will print some sort of error. > > This reduces the flakiness of the test from 55% to 38%. My next patch > makes it completely stable. > > diff --git a/tests/test-clone.t b/tests/test-clone.t > --- a/tests/test-clone.t > +++ b/tests/test-clone.t > @@ -1060,7 +1060,12 @@ Cloning into pooled storage doesn't race > date:Thu Jan 01 00:00:00 1970 + > summary: 1a > > - $ cat race1.log > +One repo should be new, the other should be shared from the pool. We > +don't care which is which, so we just make sure we always print the > +one containing "new pooled" first, then one one containing "existing > +pooled". > + > + $ grep -q 'new pooled' race1.log && cat race1.log || cat race2.log > (sharing from new pooled repository > b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) > requesting all changes > adding changesets > @@ -1073,7 +1078,7 @@ Cloning into pooled storage doesn't race > updating working directory > 1 files updated, 0 files merged, 0 files removed, 0 files unresolved > > - $ cat race2.log > + $ grep -q 'existing pooled' race1.log && cat race1.log || cat race2.log > (sharing from existing pooled repository > b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) > waiting for lock on repository share-destrace2 held by * (glob) > got lock after \d+ seconds (re) > ___ > 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
Re: [PATCH 7 of 7] parsers: use PyVarObject_HEAD_INIT
On Sat, Oct 08, 2016 at 10:48:13PM +0200, Gregory Szorc wrote: > # HG changeset patch > # User Gregory Szorc> # Date 1475959442 -7200 > # Sat Oct 08 22:44:02 2016 +0200 > # Node ID ad527a4c62ad35b84c4ad25d080ee427528966fa > # Parent 40775aad0c78f6c1fd07e7160d50426efbe032ed > parsers: use PyVarObject_HEAD_INIT Queued these with enthusiasm! > > The macro changed slightly in Python 3, introducing curly brackets > that somehow confuse Clang into issuing a ton of compiler warnings. > Using PyVarObject_HEAD_INIT makes these go away. > > It's worth noting that the code is identical: the 2nd argument to > PyVarObject_HEAD_INIT is assigned to the ob_size field and is > inserted immediately after "PyObject_HEAD_INIT(type)" is generated. > Compilers are weird. > > diff --git a/mercurial/parsers.c b/mercurial/parsers.c > --- a/mercurial/parsers.c > +++ b/mercurial/parsers.c > @@ -2515,10 +2515,9 @@ static PyGetSetDef index_getset[] = { > {NULL} /* Sentinel */ > }; > > static PyTypeObject indexType = { > - PyObject_HEAD_INIT(NULL) > - 0, /* ob_size */ > + PyVarObject_HEAD_INIT(NULL, 0) > "parsers.index", /* tp_name */ > sizeof(indexObject), /* tp_basicsize */ > 0, /* tp_itemsize */ > (destructor)index_dealloc, /* tp_dealloc */ > ___ > 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
Re: [PATCH] merge: update doc of manifestmerge() per 18c2184c27dc
On Tue, Oct 04, 2016 at 12:19:02AM +0900, Yuya Nishihara wrote: > # HG changeset patch > # User Yuya Nishihara> # Date 1475397092 -32400 > # Sun Oct 02 17:31:32 2016 +0900 > # Node ID 1fcc4a460a7e86aea018e06e776048e149b36f78 > # Parent cd7276f7ea8308df2c5d8874d335d73247d0f357 > merge: update doc of manifestmerge() per 18c2184c27dc Queued this, thanks > > p1 was renamed to wctx by 18c2184c27dc. > > diff --git a/mercurial/merge.py b/mercurial/merge.py > --- a/mercurial/merge.py > +++ b/mercurial/merge.py > @@ -781,7 +781,7 @@ def driverconclude(repo, ms, wctx, label > def manifestmerge(repo, wctx, p2, pa, branchmerge, force, matcher, >acceptremote, followcopies): > """ > -Merge p1 and p2 with ancestor pa and generate merge action list > +Merge wctx and p2 with ancestor pa and generate merge action list > > branchmerge and force are as passed in to update > matcher = matcher to filter file lists > ___ > 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
[PATCH 2 of 2] test-clone: discard lock-related messages
# HG changeset patch # User Augie Fackler# Date 147600 14400 # Sun Oct 09 04:37:02 2016 -0400 # Node ID cca6191f741ae91655189e3d2b99db2d1284e09f # Parent eb00b5d08443c5a5cef981c25def007685ed1fe6 test-clone: discard lock-related messages We can't predict where those will show up and they're not super-important for the contents of this particular test, so just drop them. Further reduces the flakiness of the test to zero. diff --git a/tests/test-clone.t b/tests/test-clone.t --- a/tests/test-clone.t +++ b/tests/test-clone.t @@ -1065,7 +1065,7 @@ don't care which is which, so we just ma one containing "new pooled" first, then one one containing "existing pooled". - $ grep -q 'new pooled' race1.log && cat race1.log || cat race2.log + $ (grep -q 'new pooled' race1.log && cat race1.log || cat race2.log) | grep -v lock (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) requesting all changes adding changesets @@ -1078,10 +1078,8 @@ pooled". updating working directory 1 files updated, 0 files merged, 0 files removed, 0 files unresolved - $ grep -q 'existing pooled' race1.log && cat race1.log || cat race2.log + $ (grep -q 'existing pooled' race1.log && cat race1.log || cat race2.log) | grep -v lock (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1) - waiting for lock on repository share-destrace2 held by * (glob) - got lock after \d+ seconds (re) searching for changes no changes found adding remote bookmark bookA ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Preview of my work
Preview of my work on speeding up mercurial on pypy. The more changing benchmarks (commit, rebase etc.) are not included since they need more plumbing (working on it). The benchmarks are run multiple times, to simulate the effects of chg. This *also* populates caches etc, so I'm excluding initial runs of cpython too. https://paste.pound-python.org/show/2v6YWfroIUiZ6bH7D4cx/ ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 3 of 3] py3: remove superfluous indent from check-py3-compat.py
# HG changeset patch # User Yuya Nishihara# Date 1475940160 -7200 # Sat Oct 08 17:22:40 2016 +0200 # Node ID e6f44ecf2b4afc13f583b0431a25d8e44dd6b09f # Parent fbd4b7cbb2930550f164f1fef3c3a8a64011a4c8 py3: remove superfluous indent from check-py3-compat.py diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py --- a/contrib/check-py3-compat.py +++ b/contrib/check-py3-compat.py @@ -56,33 +56,32 @@ def check_compat_py3(f): if f.startswith(('hgext/', 'mercurial/')) and not f.endswith('__init__.py'): assert f.endswith('.py') name = f.replace('/', '.')[:-3].replace('.pure.', '.') -if True: -try: -importlib.import_module(name) -except Exception as e: -exc_type, exc_value, tb = sys.exc_info() -# We walk the stack and ignore frames from our custom importer, -# import mechanisms, and stdlib modules. This kinda/sorta -# emulates CPython behavior in import.c while also attempting -# to pin blame on a Mercurial file. -for frame in reversed(traceback.extract_tb(tb)): -if frame.name == '_call_with_frames_removed': -continue -if 'importlib' in frame.filename: -continue -if 'mercurial/__init__.py' in frame.filename: -continue -if frame.filename.startswith(sys.prefix): -continue -break +try: +importlib.import_module(name) +except Exception as e: +exc_type, exc_value, tb = sys.exc_info() +# We walk the stack and ignore frames from our custom importer, +# import mechanisms, and stdlib modules. This kinda/sorta +# emulates CPython behavior in import.c while also attempting +# to pin blame on a Mercurial file. +for frame in reversed(traceback.extract_tb(tb)): +if frame.name == '_call_with_frames_removed': +continue +if 'importlib' in frame.filename: +continue +if 'mercurial/__init__.py' in frame.filename: +continue +if frame.filename.startswith(sys.prefix): +continue +break -if frame.filename: -filename = os.path.basename(frame.filename) -print('%s: error importing: <%s> %s (error at %s:%d)' % ( - f, type(e).__name__, e, filename, frame.lineno)) -else: -print('%s: error importing module: <%s> %s (line %d)' % ( - f, type(e).__name__, e, frame.lineno)) +if frame.filename: +filename = os.path.basename(frame.filename) +print('%s: error importing: <%s> %s (error at %s:%d)' % ( + f, type(e).__name__, e, filename, frame.lineno)) +else: +print('%s: error importing module: <%s> %s (line %d)' % ( + f, type(e).__name__, e, frame.lineno)) if __name__ == '__main__': if sys.version_info[0] == 2: ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
[PATCH 2 of 3] py3: make check-py3-compat.py load modules in standard manner
# HG changeset patch # User Yuya Nishihara# Date 1475940127 -7200 # Sat Oct 08 17:22:07 2016 +0200 # Node ID fbd4b7cbb2930550f164f1fef3c3a8a64011a4c8 # Parent 83c488687f45a76c18a91a4f80ed1c921a00a30e py3: make check-py3-compat.py load modules in standard manner Otherwise no code transformation would be applied to the modules which are imported only by imp.load_module(). This change means modules are imported from PYTHONPATH, not from the paths given by command arguments. This isn't always correct, but seems acceptable. diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py --- a/contrib/check-py3-compat.py +++ b/contrib/check-py3-compat.py @@ -10,7 +10,7 @@ from __future__ import absolute_import, print_function import ast -import imp +import importlib import os import sys import traceback @@ -56,9 +56,9 @@ def check_compat_py3(f): if f.startswith(('hgext/', 'mercurial/')) and not f.endswith('__init__.py'): assert f.endswith('.py') name = f.replace('/', '.')[:-3].replace('.pure.', '.') -with open(f, 'r') as fh: +if True: try: -imp.load_module(name, fh, f, ('py', 'r', imp.PY_SOURCE)) +importlib.import_module(name) except Exception as e: exc_type, exc_value, tb = sys.exc_info() # We walk the stack and ignore frames from our custom importer, diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t +++ b/tests/test-check-py3-compat.t @@ -16,41 +16,27 @@ $ hg files 'set:(**.py) - grep(pygments)' | sed 's|\\|/|g' \ > | xargs $PYTHON3 contrib/check-py3-compat.py \ > | sed 's/[0-9][0-9]*)$/*)/' - hgext/convert/bzr.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at bzr.py:*) - hgext/convert/convcmd.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at convcmd.py:*) - hgext/convert/cvs.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at cvs.py:*) - hgext/convert/darcs.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at darcs.py:*) - hgext/convert/filemap.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at filemap.py:*) - hgext/convert/git.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at git.py:*) - hgext/convert/gnuarch.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at gnuarch.py:*) - hgext/convert/hg.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at hg.py:*) - hgext/convert/monotone.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at monotone.py:*) - hgext/convert/p4.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at p4.py:*) - hgext/convert/subversion.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at subversion.py:*) - hgext/convert/transport.py: error importing: No module named 'svn.client' (error at transport.py:*) - hgext/fsmonitor/watchmanclient.py: error importing: Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (error at watchmanclient.py:*) - hgext/journal.py: error importing: Parent module 'hgext' not loaded, cannot perform relative import (error at journal.py:*) - hgext/largefiles/basestore.py: error importing: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at basestore.py:*) - hgext/largefiles/lfcommands.py: error importing: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at lfcommands.py:*) - hgext/largefiles/localstore.py: error importing: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at localstore.py:*) - hgext/largefiles/overrides.py: error importing: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at overrides.py:*) - hgext/largefiles/proto.py: error importing: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at proto.py:*) - hgext/largefiles/remotestore.py: error importing: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at remotestore.py:*) - hgext/largefiles/reposetup.py: error importing: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at reposetup.py:*) - hgext/largefiles/storefactory.py: error importing: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (error at storefactory.py:*) - hgext/largefiles/uisetup.py:
[PATCH 1 of 3] py3: include module filename in check-py3-compat.py output
# HG changeset patch # User Yuya Nishihara# Date 1475994699 -7200 # Sun Oct 09 08:31:39 2016 +0200 # Node ID 83c488687f45a76c18a91a4f80ed1c921a00a30e # Parent 040f23ed6963a4766a5e1057cc9b4ff7ca465e1f py3: include module filename in check-py3-compat.py output This change is intended to reduce noises in the next patch. diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py --- a/contrib/check-py3-compat.py +++ b/contrib/check-py3-compat.py @@ -58,7 +58,7 @@ def check_compat_py3(f): name = f.replace('/', '.')[:-3].replace('.pure.', '.') with open(f, 'r') as fh: try: -imp.load_module(name, fh, '', ('py', 'r', imp.PY_SOURCE)) +imp.load_module(name, fh, f, ('py', 'r', imp.PY_SOURCE)) except Exception as e: exc_type, exc_value, tb = sys.exc_info() # We walk the stack and ignore frames from our custom importer, diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t --- a/tests/test-check-py3-compat.t +++ b/tests/test-check-py3-compat.t @@ -16,43 +16,43 @@ $ hg files 'set:(**.py) - grep(pygments)' | sed 's|\\|/|g' \ > | xargs $PYTHON3 contrib/check-py3-compat.py \ > | sed 's/[0-9][0-9]*)$/*)/' - hgext/convert/bzr.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/convcmd.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/cvs.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/darcs.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/filemap.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/git.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/gnuarch.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/hg.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/monotone.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/p4.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/subversion.py: error importing module: Parent module 'hgext.convert' not loaded, cannot perform relative import (line *) - hgext/convert/transport.py: error importing module: No module named 'svn.client' (line *) - hgext/fsmonitor/watchmanclient.py: error importing module: Parent module 'hgext.fsmonitor' not loaded, cannot perform relative import (line *) - hgext/journal.py: error importing module: Parent module 'hgext' not loaded, cannot perform relative import (line *) - hgext/largefiles/basestore.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/lfcommands.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/localstore.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/overrides.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/proto.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/remotestore.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/reposetup.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/storefactory.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/uisetup.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) - hgext/largefiles/wirestore.py: error importing module: Parent module 'hgext.largefiles' not loaded, cannot perform relative import (line *) + hgext/convert/bzr.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at bzr.py:*) + hgext/convert/convcmd.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at convcmd.py:*) + hgext/convert/cvs.py: error importing: Parent module 'hgext.convert' not loaded, cannot perform relative import (error at
Re: [PATCH 1 of 2] parsers: return NULL from PyInit_parsers on Python 3
On Sat, 08 Oct 2016 19:09:17 +0200, Gregory Szorc wrote: > # HG changeset patch > # User Gregory Szorc> # Date 1475941889 -7200 > # Sat Oct 08 17:51:29 2016 +0200 > # Node ID 66c3f600e684f2323ac56c16eba6a57930f8919e > # Parent f98e32b5c44fafb85bee108abe2a24595e59ddbc > parsers: return NULL from PyInit_parsers on Python 3 Queued, thanks. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH] util: document we want Python type mapping to be temporary
On Sat, 08 Oct 2016 19:16:54 +0200, Gregory Szorc wrote: > # HG changeset patch > # User Gregory Szorc> # Date 1475947010 -7200 > # Sat Oct 08 19:16:50 2016 +0200 > # Node ID d15d8ac73cfd2d1ddbd443262ccad9c68ee69406 > # Parent 266ad9c9faa524a8b3f473c924db409681cb205e > util: document we want Python type mapping to be temporary Queued this, too. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel