Patchwork [2,of,4] revset: define _symletters in terms of _syminitletters

login
register
mail settings
Submitter Augie Fackler
Date Oct. 7, 2016, 12:50 p.m.
Message ID <d7777ef3fe7f82524c29.1475844646@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/16886/
State Superseded
Headers show

Comments

Augie Fackler - Oct. 7, 2016, 12:50 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1475842163 14400
#      Fri Oct 07 08:09:23 2016 -0400
# Node ID d7777ef3fe7f82524c2925d9af6c3e1884a4188d
# Parent  da814a1e51a7c97d0b4a1a7519bdca87802e4e6d
revset: define _symletters in terms of _syminitletters
Pulkit Goyal - Oct. 7, 2016, 3:09 p.m.
On Fri, Oct 7, 2016 at 2:50 PM, Augie Fackler <raf@durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1475842163 14400
> #      Fri Oct 07 08:09:23 2016 -0400
> # Node ID d7777ef3fe7f82524c2925d9af6c3e1884a4188d
> # Parent  da814a1e51a7c97d0b4a1a7519bdca87802e4e6d
> revset: define _symletters in terms of _syminitletters
>
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -177,8 +177,7 @@ keywords = set(['and', 'or', 'not'])
>                        if c.isalnum() or c in '._@' or ord(c) > 127)
>
>  # default set of valid characters for non-initial letters of symbols
> -_symletters = set(c for c in [chr(i) for i in xrange(256)]
> -                  if c.isalnum() or c in '-._/@' or ord(c) > 127)
> +_symletters = _syminitletters | set('-/')
Need to add a u'' here that is set(u'-/')
>
>  def tokenize(program, lookup=None, syminitletters=None, symletters=None):
>      '''
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Yuya Nishihara - Oct. 8, 2016, 6:27 a.m.
On Fri, 7 Oct 2016 17:09:33 +0200, Pulkit Goyal wrote:
> On Fri, Oct 7, 2016 at 2:50 PM, Augie Fackler <raf@durin42.com> wrote:
> > # HG changeset patch
> > # User Augie Fackler <augie@google.com>
> > # Date 1475842163 14400
> > #      Fri Oct 07 08:09:23 2016 -0400
> > # Node ID d7777ef3fe7f82524c2925d9af6c3e1884a4188d
> > # Parent  da814a1e51a7c97d0b4a1a7519bdca87802e4e6d
> > revset: define _symletters in terms of _syminitletters
> >
> > diff --git a/mercurial/revset.py b/mercurial/revset.py
> > --- a/mercurial/revset.py
> > +++ b/mercurial/revset.py
> > @@ -177,8 +177,7 @@ keywords = set(['and', 'or', 'not'])
> >                        if c.isalnum() or c in '._@' or ord(c) > 127)
> >
> >  # default set of valid characters for non-initial letters of symbols
> > -_symletters = set(c for c in [chr(i) for i in xrange(256)]
> > -                  if c.isalnum() or c in '-._/@' or ord(c) > 127)
> > +_symletters = _syminitletters | set('-/')
> Need to add a u'' here that is set(u'-/')

A revset expression is bytes. Testing it against unicode would cause
UnicodeDecodeError on Python 2 (and TypeError on Python 3.)
Yuya Nishihara - Oct. 8, 2016, 6:35 a.m.
On Fri, 07 Oct 2016 08:50:46 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1475842163 14400
> #      Fri Oct 07 08:09:23 2016 -0400
> # Node ID d7777ef3fe7f82524c2925d9af6c3e1884a4188d
> # Parent  da814a1e51a7c97d0b4a1a7519bdca87802e4e6d
> revset: define _symletters in terms of _syminitletters

Queued the first 2 patches, thanks.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -177,8 +177,7 @@  keywords = set(['and', 'or', 'not'])
                       if c.isalnum() or c in '._@' or ord(c) > 127)
 
 # default set of valid characters for non-initial letters of symbols
-_symletters = set(c for c in [chr(i) for i in xrange(256)]
-                  if c.isalnum() or c in '-._/@' or ord(c) > 127)
+_symletters = _syminitletters | set('-/')
 
 def tokenize(program, lookup=None, syminitletters=None, symletters=None):
     '''