Re: more symlink woes

2016-12-08 Thread Danek Duvall
Danek Duvall wrote:

> I got this with last night's bits.  I'm not sure what would be causing it,
> though.

What would be causing it is the remnants of a patch I had backing out one
of the previous symlink changes.  Clearing that up fixes everything.

Sorry for the false alarm.

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


[PATCH 3 of 3 V3] py3: make keys of keyword arguments strings

2016-12-08 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1481085372 -19800
#  Wed Dec 07 10:06:12 2016 +0530
# Node ID efbbd296135529d31b453d8c0c2a072b43b63936
# Parent  a359ab71022408a864d58baba3b365ee262560df
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 a359ab710224 -r efbbd2961355 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,
diff -r a359ab710224 -r efbbd2961355 tests/test-check-py3-commands.t
--- a/tests/test-check-py3-commands.t   Wed Dec 07 21:53:03 2016 +0530
+++ b/tests/test-check-py3-commands.t   Wed Dec 07 10:06:12 2016 +0530
@@ -9,6 +9,6 @@
   >   $PYTHON3 `which hg` $cmd 2>&1 2>&1 | tail -1
   > done
   version
-  TypeError: Can't convert 'bytes' object to str implicitly
+  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   debuginstall
   TypeError: Can't convert 'bytes' object to str implicitly
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 3 V3] py3: utility functions to convert keys of kwargs to bytes/unicodes

2016-12-08 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1481127783 -19800
#  Wed Dec 07 21:53:03 2016 +0530
# Node ID a359ab71022408a864d58baba3b365ee262560df
# Parent  e6e1c531a879c091caeaf7597744e98bcfbb41c9
py3: utility functions to convert keys of kwargs to bytes/unicodes

Keys of keyword arguments need to be str(unicodes) on Python 3. We have a lot
of function where we pass keyword arguments. Having utility functions to help
converting keys to unicodes before passing and convert back them to bytes once
passed into the function will be helpful. We now have functions named
pycompat.strkwargs(dic) and pycompat.byteskwargs(dic) to help us.

diff -r e6e1c531a879 -r a359ab710224 mercurial/pycompat.py
--- a/mercurial/pycompat.py Tue Dec 06 06:36:36 2016 +0530
+++ b/mercurial/pycompat.py Wed Dec 07 21:53:03 2016 +0530
@@ -109,6 +109,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.
+def strkwargs(dic):
+dic = {k.decode('latin-1'): v for k, v in dic.iteritems()}
+return dic
+
+# keys of keyword arguments need to be unicode while passing into a
+# a function. This function helps us to convert those keys back to bytes
+# again as we need to deal with bytes.
+def byteskwargs(dic):
+dic = {k.encode('latin-1'): v for k, v in dic.iteritems()}
+return dic
+
 else:
 def sysstr(s):
 return s
@@ -131,6 +145,12 @@
 def getoptb(args, shortlist, namelist):
 return getopt.getopt(args, shortlist, namelist)
 
+def strkwargs(dic):
+return dic
+
+def byteskwargs(dic):
+return dic
+
 osname = os.name
 ospathsep = os.pathsep
 ossep = os.sep
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE V2] hgweb: add missing slash to file log url in rss style

2016-12-08 Thread Augie Fackler
On Fri, Dec 09, 2016 at 12:59:41AM +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov 
> # Date 1481212776 -28800
> #  Thu Dec 08 23:59:36 2016 +0800
> # Branch stable
> # Node ID 8c4b72f094d3955001ee75257ba2a185c2cbbf96
> # Parent  76e970c8f53071463032e9d0d81092a277b85b9a
> hgweb: add missing slash to file log url in rss style

Just noticed the v2. Queued.

>
> diff --git a/mercurial/templates/rss/filelogentry.tmpl 
> b/mercurial/templates/rss/filelogentry.tmpl
> --- a/mercurial/templates/rss/filelogentry.tmpl
> +++ b/mercurial/templates/rss/filelogentry.tmpl
> @@ -1,6 +1,6 @@
>  
>  {desc|strip|firstline|strip|escape}
> -{urlbase}{url|urlescape}log{node|short}/{file|urlescape}
> +{urlbase}{url|urlescape}log/{node|short}/{file|urlescape}
>  
> 
>  {author|obfuscate}
>  {date|rfc822date}
> diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
> --- a/tests/test-hgweb-commands.t
> +++ b/tests/test-hgweb-commands.t
> @@ -686,7 +686,7 @@ Logs and changes
>foo revision history
>
>base
> -  http://*:$HGPORT/log2ef0ac749a14/foo (glob)
> +  http://*:$HGPORT/log/2ef0ac749a14/foo (glob)
>
>
>Thu, 01 Jan 1970 00:00:00 +
> diff --git a/tests/test-hgweb-filelog.t b/tests/test-hgweb-filelog.t
> --- a/tests/test-hgweb-filelog.t
> +++ b/tests/test-hgweb-filelog.t
> @@ -783,14 +783,14 @@ rss log
>a revision history
>
>second a
> -  http://*:$HGPORT/log3f41bc784e7e/a (glob)
> +  http://*:$HGPORT/log/3f41bc784e7e/a (glob)
>
>
>Thu, 01 Jan 1970 00:00:00 +
>
>
>first a
> -  http://*:$HGPORT/log5ed941583260/a (glob)
> +  http://*:$HGPORT/log/5ed941583260/a (glob)
>
>
>Thu, 01 Jan 1970 00:00:00 +
> ___
> 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: Information

2016-12-08 Thread mercurial-devel-bounces
On Wed, Dec 07, 2016 at 10:59:36AM +0100, NG wrote:
> Hello,
>
>
>
> Is Mercurial compatible with Windows 10 ? If not, can you give me the
> correct version ?

It should be. Have you tried it?

>
> Thank you in advance.
> Cordially.
>
>
>
>
>
>
> Nicolas GUERIN
> MGI Consultants - Consultant
> E-mail :   ngue...@mgi.fr
>
>
>
>
>
>
>
>
>
>
>

> ___
> 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 STABLE V2] hgweb: add missing slash to file log url in rss style

2016-12-08 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1481212776 -28800
#  Thu Dec 08 23:59:36 2016 +0800
# Branch stable
# Node ID 8c4b72f094d3955001ee75257ba2a185c2cbbf96
# Parent  76e970c8f53071463032e9d0d81092a277b85b9a
hgweb: add missing slash to file log url in rss style

diff --git a/mercurial/templates/rss/filelogentry.tmpl 
b/mercurial/templates/rss/filelogentry.tmpl
--- a/mercurial/templates/rss/filelogentry.tmpl
+++ b/mercurial/templates/rss/filelogentry.tmpl
@@ -1,6 +1,6 @@
 
 {desc|strip|firstline|strip|escape}
-{urlbase}{url|urlescape}log{node|short}/{file|urlescape}
+{urlbase}{url|urlescape}log/{node|short}/{file|urlescape}
 

 {author|obfuscate}
 {date|rfc822date}
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -686,7 +686,7 @@ Logs and changes
   foo revision history
   
   base
-  http://*:$HGPORT/log2ef0ac749a14/foo (glob)
+  http://*:$HGPORT/log/2ef0ac749a14/foo (glob)
   
   
   Thu, 01 Jan 1970 00:00:00 +
diff --git a/tests/test-hgweb-filelog.t b/tests/test-hgweb-filelog.t
--- a/tests/test-hgweb-filelog.t
+++ b/tests/test-hgweb-filelog.t
@@ -783,14 +783,14 @@ rss log
   a revision history
   
   second a
-  http://*:$HGPORT/log3f41bc784e7e/a (glob)
+  http://*:$HGPORT/log/3f41bc784e7e/a (glob)
   
   
   Thu, 01 Jan 1970 00:00:00 +
   
   
   first a
-  http://*:$HGPORT/log5ed941583260/a (glob)
+  http://*:$HGPORT/log/5ed941583260/a (glob)
   
   
   Thu, 01 Jan 1970 00:00:00 +
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[Bug 5438] New: hg export does not work with 'wdir()'

2016-12-08 Thread bugzilla
https://bz.mercurial-scm.org/show_bug.cgi?id=5438

Bug ID: 5438
   Summary: hg export does not work with 'wdir()'
   Product: Mercurial
   Version: default branch
  Hardware: All
OS: All
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@selenic.com
  Reporter: arcppzju+hg...@gmail.com
CC: mercurial-de...@selenic.com

Currently it just crashes:

  quark % hg export 'wdir()'
  # HG changeset patch
  # User foo
  # Date 1481214154 0
  #  Thu Dec 08 16:22:34 2016 +
  ** Unknown exception encountered with possibly-broken third-party extension
lz4revlog
  ** which supports versions 3.9 of Mercurial.
  ** Please disable lz4revlog and try your action again.
  ** If that fixes the bug please report it to the extension author.
  ** Python 2.7.12 (default, Oct  4 2016, 02:38:46) [GCC 6.1.1 20160501]
  ** Mercurial Distributed SCM (version 4.0+199-a31634336471)
  ** Extensions loaded: rebase, lz4revlog
  Traceback (most recent call last):
File "/home/quark/hg/hg", line 45, in 
  mercurial.dispatch.run()
File "/home/quark/hg/mercurial/dispatch.py", line 61, in run
  sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
File "/home/quark/hg/mercurial/dispatch.py", line 127, in dispatch
  ret = _runcatch(req)
File "/home/quark/hg/mercurial/dispatch.py", line 217, in _runcatch
  return callcatch(ui, _runcatchfunc)
File "/home/quark/hg/mercurial/dispatch.py", line 226, in callcatch
  return func()
File "/home/quark/hg/mercurial/dispatch.py", line 206, in _runcatchfunc
  return _dispatch(req)
File "/home/quark/hg/mercurial/dispatch.py", line 906, in _dispatch
  cmdpats, cmdoptions)
File "/home/quark/hg/mercurial/dispatch.py", line 651, in runcommand
  ret = _runcommand(ui, options, cmd, d)
File "/home/quark/hg/mercurial/dispatch.py", line 914, in _runcommand
  return cmdfunc()
File "/home/quark/hg/mercurial/dispatch.py", line 903, in 
  d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/home/quark/hg/mercurial/util.py", line 1041, in check
  return func(*args, **kwargs)
File "/home/quark/hg/mercurial/commands.py", line 3783, in export
  opts=patch.diffallopts(ui, opts))
File "/home/quark/hg/mercurial/cmdutil.py", line 1171, in export
  single(rev, seqno + 1, fp)
File "/home/quark/hg/mercurial/cmdutil.py", line 1152, in single
  write("# Node ID %s\n" % hex(node))
  TypeError: b2a_hex() argument 1 must be string or buffer, not None



It'll be nice to make it work.

-- 
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: The donation link don't work

2016-12-08 Thread Augie Fackler
Indeed, that page is broken. I've started the wheels in motion to
figure out what donation link we should have in place. I've flagged
this thread and will endeavour to come back to it shortly with the
corrected information.

Thanks for using Mercurial!

On Wed, Dec 7, 2016 at 4:54 PM, Xavier Corredor Llano
 wrote:
> Hi Mercurial developers,
>
>
>
> I tried to make a donation but the donation link:
> https://www.selenic.com/mercurial/donations.html don't work.
>
>
>
> Thanks for the amazing VCS!
>
>
>
> Regards
>
>
> ___
> 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 STABLE] hgweb: add missing slash to file log url in rss style

2016-12-08 Thread Anton Shestakov
# HG changeset patch
# User Anton Shestakov 
# Date 1481212776 -28800
#  Thu Dec 08 23:59:36 2016 +0800
# Branch stable
# Node ID 7af393a85bbd43c56d0415504429895681d4a643
# Parent  76e970c8f53071463032e9d0d81092a277b85b9a
hgweb: add missing slash to file log url in rss style

Otherwise it's like /logdf5ecb813426/README.

diff --git a/mercurial/templates/rss/filelogentry.tmpl 
b/mercurial/templates/rss/filelogentry.tmpl
--- a/mercurial/templates/rss/filelogentry.tmpl
+++ b/mercurial/templates/rss/filelogentry.tmpl
@@ -1,6 +1,6 @@
 
 {desc|strip|firstline|strip|escape}
-{urlbase}{url|urlescape}log{node|short}/{file|urlescape}
+{urlbase}{url|urlescape}log/{node|short}/{file|urlescape}
 

 {author|obfuscate}
 {date|rfc822date}
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 3 V2] py3: utility functions to convert keys of kwargs to bytes/unicodes

2016-12-08 Thread Pulkit Goyal
On Thu, Dec 8, 2016 at 8:52 PM, Yuya Nishihara  wrote:
> On Thu, 8 Dec 2016 20:37:07 +0530, Pulkit Goyal wrote:
>> On Thu, Dec 8, 2016 at 8:32 PM, Yuya Nishihara  wrote:
>> > On Thu, 08 Dec 2016 00:06:40 +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 85d610c83bda09dea2393c22e415dd9656f5a7f2
>> >> # Parent  ced854b9dfaa7298b241ac085627b12ecb796dcd
>> >> py3: utility functions to convert keys of kwargs to bytes/unicodes
>> >
>> >> --- a/mercurial/pycompat.py   Tue Dec 06 06:36:36 2016 +0530
>> >> +++ b/mercurial/pycompat.py   Wed Dec 07 21:53:03 2016 +0530
>> >> @@ -103,6 +103,22 @@
>> >>  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.
>> >> +def strkwargs(dic):
>> >> +dic = {(k.decode('latin-1') if isinstance(k, bytes) else k): v
>> >> +for k, v in 
>> >> dic.items()}
>> >> +return dic
>> >> +
>> >> +# keys of keyword arguments need to be unicode while passing into a
>> >> +# a function. This function helps us to convert those keys back to 
>> >> bytes
>> >> +# again as we need to deal with bytes.
>> >> +def byteskwargs(dic):
>> >> +dic = {(k.encode('latin-1') if isinstance(k, str) else k): v
>> >> +for k, v in 
>> >> dic.items()}
>> >> +return dic
>> >
>> > I think we can assume the type of keys must be either bytes or unicode, so
>> > we won't need isinstance() checks.
>>
>> On python 3, if passed value is bytes, then .encode() will result in
>> error. So have to specific on Python 3.
>
> IMHO, it's a kind of programming error. Unlike pycompat.getattr(), strkwargs()
> isn't a drop-in replacement for a standard function, so we can say strkwargs()
> only takes a dict of bytes keys.

Okay I will remove the isinstances. I am wondering is a dict where
keys will be both bytes and unicodes can exist in our codebase or not,
just to make sure those cases are catched too.
>
>> > And no dict comprehension. The code must be parseable by Python 2.6.
>>
>> Yeah I remember, actually this code is under a if statement which is
>> executed if sys.version >= 3.
>
> Dict comprehension is syntax. Runtime dispatch can't stop parsing of the
> ispy3 block.

Okay I will send a V3.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 3 V2] py3: utility functions to convert keys of kwargs to bytes/unicodes

2016-12-08 Thread Yuya Nishihara
On Thu, 8 Dec 2016 20:37:07 +0530, Pulkit Goyal wrote:
> On Thu, Dec 8, 2016 at 8:32 PM, Yuya Nishihara  wrote:
> > On Thu, 08 Dec 2016 00:06:40 +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 85d610c83bda09dea2393c22e415dd9656f5a7f2
> >> # Parent  ced854b9dfaa7298b241ac085627b12ecb796dcd
> >> py3: utility functions to convert keys of kwargs to bytes/unicodes
> >
> >> --- a/mercurial/pycompat.py   Tue Dec 06 06:36:36 2016 +0530
> >> +++ b/mercurial/pycompat.py   Wed Dec 07 21:53:03 2016 +0530
> >> @@ -103,6 +103,22 @@
> >>  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.
> >> +def strkwargs(dic):
> >> +dic = {(k.decode('latin-1') if isinstance(k, bytes) else k): v
> >> +for k, v in 
> >> dic.items()}
> >> +return dic
> >> +
> >> +# keys of keyword arguments need to be unicode while passing into a
> >> +# a function. This function helps us to convert those keys back to 
> >> bytes
> >> +# again as we need to deal with bytes.
> >> +def byteskwargs(dic):
> >> +dic = {(k.encode('latin-1') if isinstance(k, str) else k): v
> >> +for k, v in 
> >> dic.items()}
> >> +return dic
> >
> > I think we can assume the type of keys must be either bytes or unicode, so
> > we won't need isinstance() checks.
> 
> On python 3, if passed value is bytes, then .encode() will result in
> error. So have to specific on Python 3.

IMHO, it's a kind of programming error. Unlike pycompat.getattr(), strkwargs()
isn't a drop-in replacement for a standard function, so we can say strkwargs()
only takes a dict of bytes keys.

> > And no dict comprehension. The code must be parseable by Python 2.6.
> 
> Yeah I remember, actually this code is under a if statement which is
> executed if sys.version >= 3.

Dict comprehension is syntax. Runtime dispatch can't stop parsing of the
ispy3 block.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 3 V2] py3: utility functions to convert keys of kwargs to bytes/unicodes

2016-12-08 Thread Pulkit Goyal
On Thu, Dec 8, 2016 at 8:32 PM, Yuya Nishihara  wrote:
> On Thu, 08 Dec 2016 00:06:40 +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 85d610c83bda09dea2393c22e415dd9656f5a7f2
>> # Parent  ced854b9dfaa7298b241ac085627b12ecb796dcd
>> py3: utility functions to convert keys of kwargs to bytes/unicodes
>
>> --- a/mercurial/pycompat.py   Tue Dec 06 06:36:36 2016 +0530
>> +++ b/mercurial/pycompat.py   Wed Dec 07 21:53:03 2016 +0530
>> @@ -103,6 +103,22 @@
>>  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.
>> +def strkwargs(dic):
>> +dic = {(k.decode('latin-1') if isinstance(k, bytes) else k): v
>> +for k, v in dic.items()}
>> +return dic
>> +
>> +# keys of keyword arguments need to be unicode while passing into a
>> +# a function. This function helps us to convert those keys back to bytes
>> +# again as we need to deal with bytes.
>> +def byteskwargs(dic):
>> +dic = {(k.encode('latin-1') if isinstance(k, str) else k): v
>> +for k, v in dic.items()}
>> +return dic
>
> I think we can assume the type of keys must be either bytes or unicode, so
> we won't need isinstance() checks.

On python 3, if passed value is bytes, then .encode() will result in
error. So have to specific on Python 3.

> And no dict comprehension. The code must be parseable by Python 2.6.

Yeah I remember, actually this code is under a if statement which is
executed if sys.version >= 3.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 1 of 3 V2] py3: make a bytes version of getopt.getopt()

2016-12-08 Thread Yuya Nishihara
On Thu, 08 Dec 2016 00:06:39 +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 ced854b9dfaa7298b241ac085627b12ecb796dcd
> # Parent  a2b053b8d31aa01b1dcae2d3001b060ff59e8a68
> py3: make a bytes version of getopt.getopt()

> --- 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,21 @@
>  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') if isinstance(a, bytes) else a
> +for a in namelist]
> +opts, args = getopt.getopt(args, shortlist, namelist)
> +opts = [((a[0].enocde('latin-1') if isinstance(a[0], str) else a[0]),
> +(a[1].enocde('latin-1') if isinstance(a[1], str) else a[1]))
> +for a in opts]

Are these isinstance() tests necessary?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 2 of 3 V2] py3: utility functions to convert keys of kwargs to bytes/unicodes

2016-12-08 Thread Yuya Nishihara
On Thu, 08 Dec 2016 00:06:40 +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 85d610c83bda09dea2393c22e415dd9656f5a7f2
> # Parent  ced854b9dfaa7298b241ac085627b12ecb796dcd
> py3: utility functions to convert keys of kwargs to bytes/unicodes

> --- a/mercurial/pycompat.py   Tue Dec 06 06:36:36 2016 +0530
> +++ b/mercurial/pycompat.py   Wed Dec 07 21:53:03 2016 +0530
> @@ -103,6 +103,22 @@
>  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.
> +def strkwargs(dic):
> +dic = {(k.decode('latin-1') if isinstance(k, bytes) else k): v
> +for k, v in dic.items()}
> +return dic
> +
> +# keys of keyword arguments need to be unicode while passing into a
> +# a function. This function helps us to convert those keys back to bytes
> +# again as we need to deal with bytes.
> +def byteskwargs(dic):
> +dic = {(k.encode('latin-1') if isinstance(k, str) else k): v
> +for k, v in dic.items()}
> +return dic

I think we can assume the type of keys must be either bytes or unicode, so
we won't need isinstance() checks.

And no dict comprehension. The code must be parseable by Python 2.6.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


RE: [PATCH] update: introduce config option ui.allowdirtyupdate for dirty nonlinear updates

2016-12-08 Thread Gábor STEFANIK
>


--
This message, including its attachments, is confidential. For more information 
please read NNG's email policy here:
http://www.nng.com/emailpolicy/
By responding to this email you accept the email policy.


-Original Message-
> From: Jun Wu [mailto:qu...@fb.com]
> Sent: Wednesday, December 7, 2016 6:44 PM
> To: Gábor STEFANIK 
> Cc: mercurial-devel 
> Subject: Re: [PATCH] update: introduce config option ui.allowdirtyupdate for
> dirty nonlinear updates
>
> Excerpts from Gábor Stefanik's message of 2016-12-07 16:56:09 +0100:
> > # HG changeset patch
> > # User Gábor Stefanik  # Date 1481126137 -3600
> > #  Wed Dec 07 16:55:37 2016 +0100
> > # Node ID dabbe365b843fcf9b8a0de6c08e9db6100b391e9
> > # Parent  6472c33e16326b8c817a8bae0e75053b19badb2c
> > update: introduce config option ui.allowdirtyupdate for dirty
> > nonlinear updates
> >
> > Make it easier to test codepaths common to graft and update without
> > having to mess around with obsolete markers to force a nonlinear update.
> > Named by analogy with ui.allowemptycommit.
> >
> > diff -r 6472c33e1632 -r dabbe365b843 mercurial/merge.py
> > --- a/mercurial/merge.pyMon Dec 05 17:40:01 2016 +0100
> > +++ b/mercurial/merge.pyWed Dec 07 16:55:37 2016 +0100
> > @@ -1536,7 +1536,10 @@
> >
> >  if pas not in ([p1], [p2]):  # nonlinear
> >  dirty = wc.dirty(missing=True)
> > -if dirty or onode is None:
> > +# experimental config: ui.allowdirtyupdate
> > +if repo.ui.configbool('ui', 'allowdirtyupdate', False):
>
> I think experimental config options are usually under the "experimental"
> section.

Format.generaldelta was also experimental.

Grepping through the repo for "experimental config", I'm under the impression 
that
"experimental" is to be used for options that can't be cleanly categorized 
under any
existing sections, and don't warrant introducing a new section.

This is experimental for now, since we need to support "hg update --abort" to 
make
this safe for users, but eventually I hope to get this de-experimentalized and 
maybe
even enabled by default. It would be better not to break backwards compatibility
just because this becomes no longer experimental.

>
> > +pas = [p1]
> > +elif dirty or onode is None:
> >  # Branching is a bit strange to ensure we do the 
> > minimal
> >  # amount of call to obsolete.background.
> >  foreground = obsolete.foreground(repo,
> > [p1.node()])
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH 6 of 6 v3] convert: Create commits from revmap list if needed

2016-12-08 Thread Kostia Balytskyi


On 12/8/16 12:18 AM, David Soria Parra wrote:
> On Wed, Dec 07, 2016 at 10:23:08PM +, Kostia Balytskyi wrote:
>> On 12/7/16 9:51 PM, David Soria Parra wrote:
>>> # HG changeset patch
>>> # User David Soria Parra 
>>> # Date 1481143876 28800
>>> #  Wed Dec 07 12:51:16 2016 -0800
>>> # Node ID 109de539306c5bc49d38d6f1c802c4a8d092b485
>>> # Parent  be68e4436851b7e20f3b8cb34666418f5840dd66
>>> convert: Create commits from revmap list if needed
>> This commit demonstrates the need to add some sort of comment to
>> self.revmap = {} in constructor. Otherwise, it's very confusing IMO.
> I honestly don't undersetand what is so confusing about it. It's a
> revmap and it seems straight forward to me that it's a dictionary
> that maps commits, at least thats what all revmaps in convert ever do.
The confusing (at least to me) part is what revmap maps commits to. 
There's no example
of setrevmap usage, so it's unclear how it is used. Feel free to ignore 
this if you think this is unreasonable though.
>
>>> diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py
>>> --- a/hgext/convert/p4.py
>>> +++ b/hgext/convert/p4.py
>>> @@ -314,6 +314,12 @@
>>>return marshal.load(stdout)
>>>
>>>def getcommit(self, rev):
>>> +if rev not in self.changeset and rev not in self.revmap:
>>> +raise error.Abort(
>>> +_("cannot find %s in the revmap or parsed changesets") % 
>>> rev)
>>> +if rev not in self.changeset:
>>> +d = self._fetch_revision(rev)
>>> +return self._construct_commit(d, parents=None)
>>>return self.changeset[rev]
>>>
>>>def gettags(self):
>>> ___
>>> 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
> ___
> 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 hg-website] menu: capitalize the menu options in nav bar

2016-12-08 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1481185128 -19800
#  Thu Dec 08 13:48:48 2016 +0530
# Node ID 39b44ed32913cc10bcc93115286262f080a257fb
# Parent  5d30d7a345692b6656b60c9f4dab86f012b391eb
menu: capitalize the menu options in nav bar

This patch capitalize the first letter of the options in nav bar.

diff -r 5d30d7a34569 -r 39b44ed32913 templates/base.html
--- a/templates/base.html   Thu Dec 08 13:45:16 2016 +0530
+++ b/templates/base.html   Thu Dec 08 13:48:48 2016 +0530
@@ -19,11 +19,11 @@
 mercurial
 
 
-about
-guide
-download
-https://www.mercurial-scm.org/wiki/UsingExtensions;>extensions
-https://www.mercurial-scm.org/wiki/;>news/wiki
+About
+Guide
+Download
+https://www.mercurial-scm.org/wiki/UsingExtensions;>Extensions
+https://www.mercurial-scm.org/wiki/;>News/Wiki
 
 
 https://www.mercurial-scm.org/wiki/Mercurial;>
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 hg-website] css: attach the navigation bar to top of the page

2016-12-08 Thread Pulkit Goyal
# HG changeset patch
# User Pulkit Goyal <7895pul...@gmail.com>
# Date 1481184916 -19800
#  Thu Dec 08 13:45:16 2016 +0530
# Node ID 5d30d7a345692b6656b60c9f4dab86f012b391eb
# Parent  8a0dad3adbf7f076bb2daf64c1bcb97117e6e67b
css: attach the navigation bar to top of the page

Currently the navigation bar doesn't looks good as there is some space between
the top and bar. This patch removes that, bring the words in the center and
align the search bar with the menu options.

diff -r 8a0dad3adbf7 -r 5d30d7a34569 static/css/styles.css
--- a/static/css/styles.css Fri Sep 30 16:37:49 2016 -0500
+++ b/static/css/styles.css Thu Dec 08 13:45:16 2016 +0530
@@ -106,15 +106,15 @@
 /*
  * Nav
  */
-#nav { position: absolute; top: 17px; right: 0; background: #999; height: 
42px; margin: 0; width: 725px; font-size: 1em; *font-size: 16px; line-height: 
42px; font-family: Optimer, DejaVuSans, Helvetica, Arial, sans-serif; overflow: 
hidden; }
+#nav { position: absolute; top: 0px; right: 0; background: #999; height: 61px; 
margin: 0; width: 725px; font-size: 1em; *font-size: 16px; line-height: 42px; 
font-family: Optimer, DejaVuSans, Helvetica, Arial, sans-serif; overflow: 
hidden; }
 #nav li { float: left; margin: 0; padding: 0; list-style: none; }
-#nav a { float: left; color: #fff; text-decoration: none; padding: 0 16px; 
*padding: 0 14px; }
+#nav a { float: left; color: #fff; text-decoration: none; padding: 14px 21px; 
*padding: 0 14px; }
 #nav a:hover, #nav a:focus, #nav .active a { background: #00b5f1; }
 
 /*
  * Search
  */
-#search { position: absolute; right: 15px; top: 26px; color: #fff; width: 
183px; height: 23px; background: url(../images/search.png) no-repeat 0 0; }
+#search { position: absolute; right: 15px; top: 21px; color: #fff; width: 
180px; height: 23px; background: url(../images/search.png) no-repeat 0 0; }
 #search legend { display: none; }
 #search label { position: absolute; left: -px; }
 #search .text { width: 150px; background: none; border: none; margin: 0 0 0 
5px; position: relative; top: 5px; color: #666; outline:0; }
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel