Re: [PATCH 1 of 2] error: add ProgrammingError
Jun Wu wrote: > +class ProgrammingError(RuntimeError): > +"""Raised if a developer has made some mistake""" I object to "developer" you probably mean "mercurial (core or extension) developer", not "generic developer". ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 02 of 10 shelve-ext] shelve: add an ability to write json to a new type of shelve files
We should probably have check-code complain about it and explain why we don't want it. Self-documenting code is our friend. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 5] posix: move checkexec test file to .hg/cache
Gregory Szorc wrote: > The only scenario I can think of is someone who has moved .hg to another > filesystem and symlinked .hg in the working directory to it. I guess that's > plausible. Ugh. I can picture doing this. It's possible I've already done it... ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH V2] evolve: improve error message if unstable changes are disallowed
I'm not going to stop this from going in, it's definitely an improvement. >> @@ -3299,7 +3301,8 @@ >> head = repo[heads.first()] >> if _disallowednewunstable(repo, revs): >> raise error.Abort(_("cannot fold chain not ending with a head "\ >> -"or with branching")) >> +"or with branching"), hint = _("new unstable"\ >> +" changesets are not allowed")) 1. From a UX perspective, I think I'd rather this be split. I think. Users shouldn't have to figure out "am I branching" or "am I folding a chain that doesn't end in a head". Alternatively, I'm tempted to say "can only fold chains without branches that end in a head" 2. It'd be helpful if there was a wiki page or something that talked about these cases, preferably such that searching for these error messages led to it. I'm not sure if I want it to be a wiki, or docs included w/ source, but something somewhere... ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] py3: make keys of keyword arguments strings
> 'cmdoptions' is passed to another function as a normal dict, which shouldn't > be a dict of unicode keys. Only **cmdoptions should be a unicode-key dict. > > Sorry I didn't notice it in earlier series. No problem, I will send a V6. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 3] py3: make a bytes version of getopt.getopt()
On Sun, Dec 11, 2016 at 7:05 PM, Yuya Nishiharawrote: > On Sat, 10 Dec 2016 05:10:25 +0530, Pulkit Goyal wrote: >> # HG changeset patch >> # User Pulkit Goyal <7895pul...@gmail.com> >> # Date 1480986396 -19800 >> # Tue Dec 06 06:36:36 2016 +0530 >> # Node ID 4b57889d58056f95c58f2379836437a65950424c >> # Parent a2b053b8d31aa01b1dcae2d3001b060ff59e8a68 >> py3: make a bytes version of getopt.getopt() > > Queued this, thanks. > >> --- a/mercurial/pycompat.py Tue Dec 06 11:44:49 2016 + >> +++ b/mercurial/pycompat.py Tue Dec 06 06:36:36 2016 +0530 >> @@ -10,6 +10,7 @@ >> >> from __future__ import absolute_import >> >> +import getopt >> import os >> import sys >> >> @@ -87,6 +88,19 @@ >> setattr = _wrapattrfunc(builtins.setattr) >> xrange = builtins.range >> >> +# getopt.getopt() on Python 3 deals with unicodes internally so we >> cannot >> +# pass bytes there. Passing unicodes will result in unicodes as return >> +# values which we need to convert again to bytes. >> +def getoptb(args, shortlist, namelist): >> +args = [a.decode('latin-1') for a in args] >> +shortlist = shortlist.decode('latin-1') >> +namelist = [a.decode('latin-1') for a in namelist] >> +opts, args = getopt.getopt(args, shortlist, namelist) >> +opts = [(a[0].enocde('latin-1'), a[1].enocde('latin-1')) >> +for a in opts] > > Fixed typo in flight: s/enocde/encode/. Oh! thanks for catching this. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 1 of 3] py3: make a bytes version of getopt.getopt()
On Sat, 10 Dec 2016 05:10:25 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1480986396 -19800 > # Tue Dec 06 06:36:36 2016 +0530 > # Node ID 4b57889d58056f95c58f2379836437a65950424c > # Parent a2b053b8d31aa01b1dcae2d3001b060ff59e8a68 > py3: make a bytes version of getopt.getopt() Queued this, thanks. > --- a/mercurial/pycompat.py Tue Dec 06 11:44:49 2016 + > +++ b/mercurial/pycompat.py Tue Dec 06 06:36:36 2016 +0530 > @@ -10,6 +10,7 @@ > > from __future__ import absolute_import > > +import getopt > import os > import sys > > @@ -87,6 +88,19 @@ > setattr = _wrapattrfunc(builtins.setattr) > xrange = builtins.range > > +# getopt.getopt() on Python 3 deals with unicodes internally so we cannot > +# pass bytes there. Passing unicodes will result in unicodes as return > +# values which we need to convert again to bytes. > +def getoptb(args, shortlist, namelist): > +args = [a.decode('latin-1') for a in args] > +shortlist = shortlist.decode('latin-1') > +namelist = [a.decode('latin-1') for a in namelist] > +opts, args = getopt.getopt(args, shortlist, namelist) > +opts = [(a[0].enocde('latin-1'), a[1].enocde('latin-1')) > +for a in opts] Fixed typo in flight: s/enocde/encode/. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 2 of 3] py3: utility functions to convert keys of kwargs to bytes/unicodes
On Sat, 10 Dec 2016 05:10:26 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1481127783 -19800 > # Wed Dec 07 21:53:03 2016 +0530 > # Node ID 7fcea54acba98b7f1d994bd7311bb0f5ec566b65 > # Parent 4b57889d58056f95c58f2379836437a65950424c > py3: utility functions to convert keys of kwargs to bytes/unicodes Queued this, too. > --- a/mercurial/pycompat.py Tue Dec 06 06:36:36 2016 +0530 > +++ b/mercurial/pycompat.py Wed Dec 07 21:53:03 2016 +0530 > @@ -101,6 +101,20 @@ > args = [a.encode('latin-1') for a in args] > return opts, args > > +# keys of keyword arguments in Python need to be strings which are > unicodes > +# Python 3. This function take keyword arguments, convert the keys to str > +# if they are in bytes. Removed "if they are in bytes." ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Re: [PATCH 3 of 3] py3: make keys of keyword arguments strings
On Sat, 10 Dec 2016 05:10:27 +0530, Pulkit Goyal wrote: > # HG changeset patch > # User Pulkit Goyal <7895pul...@gmail.com> > # Date 1481085372 -19800 > # Wed Dec 07 10:06:12 2016 +0530 > # Node ID 28203092739274efcb8c691beb9c4025a2c45ff5 > # Parent 7fcea54acba98b7f1d994bd7311bb0f5ec566b65 > py3: make keys of keyword arguments strings > > keys of keyword arguments on Python 3 has to be string. We are dealing with > bytes in our codebase so the keys are also bytes. We need to convert the keys > to unicodes to make the code run. We have to also reverse this process so that > functions on args dictionary like get() etc. don't result in key not found. > > Also after this patch, `hg version` now runs on Python 3.5. Hurray! > > diff -r 7fcea54acba9 -r 282030927392 mercurial/dispatch.py > --- a/mercurial/dispatch.py Wed Dec 07 21:53:03 2016 +0530 > +++ b/mercurial/dispatch.py Wed Dec 07 10:06:12 2016 +0530 > @@ -803,6 +803,7 @@ > > msg = ' '.join(' ' in a and repr(a) or a for a in fullargs) > ui.log("command", '%s\n', msg) > +cmdoptions = pycompat.strkwargs(cmdoptions) > d = lambda: util.checksignature(func)(ui, *args, **cmdoptions) > try: > return runcommand(lui, repo, cmd, fullargs, ui, options, d, 'cmdoptions' is passed to another function as a normal dict, which shouldn't be a dict of unicode keys. Only **cmdoptions should be a unicode-key dict. Sorry I didn't notice it in earlier series. ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel