D8527: py3: change default priority and length used for sorting hooks to be compatible with python 3

2020-05-14 Thread charlesetc (Charles Chamberlain)
charlesetc created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The call to `sorted(hooks.values())` can on line 213 of hooks.py can raise 
when using
  python 3. For instance, when hooks.values is `[(0, 2, 
b'post-commit.check-status', b''),
  (None, None, b'changegroup.app-hooks', )]`, 
the error is
  `TypeError: '<' not supported between instances of 'NoneType' and 'int'`
  
  This fix keeps the same order that was used in python 2 without relying on 
comparison with
  None.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/hook.py

CHANGE DETAILS

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -206,7 +206,7 @@
 # in that section uses "_fromuntrusted" as its command.
 untrustedhooks = _hookitems(ui, _untrusted=True)
 for name, value in untrustedhooks.items():
-trustedvalue = hooks.get(name, (None, None, name, _fromuntrusted))
+trustedvalue = hooks.get(name, ((), (), name, _fromuntrusted))
 if value != trustedvalue:
 (lp, lo, lk, lv) = trustedvalue
 hooks[name] = (lp, lo, lk, _fromuntrusted)
@@ -222,7 +222,7 @@
 continue
 
 priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
-hooks[name] = (-priority, len(hooks), name, cmd)
+hooks[name] = ((-priority,), (len(hooks),), name, cmd)
 return hooks
 
 



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


D8526: py3: change default priority and length used for sorting hooks to be compatible with python 3

2020-05-14 Thread charlesetc (Charles Chamberlain)
charlesetc created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The call to `sorted(hooks.values())` can on line 213 of hooks.py can raise 
when using
  python 3. For instance, when hooks.values is `[(0, 2, 
b'post-commit.check-status', b''),
  (None, None, b'changegroup.app-hooks', )]`, 
the error is
  `TypeError: '<' not supported between instances of 'NoneType' and 'int'`
  
  This fix keeps the same order that was used in python 2 without relying on 
comparison with
  None.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/hook.py

CHANGE DETAILS

diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -206,7 +206,7 @@
 # in that section uses "_fromuntrusted" as its command.
 untrustedhooks = _hookitems(ui, _untrusted=True)
 for name, value in untrustedhooks.items():
-trustedvalue = hooks.get(name, (None, None, name, _fromuntrusted))
+trustedvalue = hooks.get(name, ((), (), name, _fromuntrusted))
 if value != trustedvalue:
 (lp, lo, lk, lv) = trustedvalue
 hooks[name] = (lp, lo, lk, _fromuntrusted)
@@ -222,7 +222,7 @@
 continue
 
 priority = ui.configint(b'hooks', b'priority.%s' % name, 0)
-hooks[name] = (-priority, len(hooks), name, cmd)
+hooks[name] = ((-priority,), (len(hooks),), name, cmd)
 return hooks
 
 



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


D8525: phabricator: avoid passing None to pycompat.fsdecode

2020-05-14 Thread sfink (Steve Fink)
sfink created this revision.
sfink added a comment.
Herald added subscribers: mercurial-patches, Kwan.
Herald added a reviewer: hg-reviewers.


  I got crashes without vcr enabled

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -237,8 +237,8 @@
 
 def decorate(fn):
 def inner(*args, **kwargs):
-cassette = pycompat.fsdecode(kwargs.pop('test_vcr', None))
-if cassette:
+if kwargs.get('test_vcr'):
+cassette = pycompat.fsdecode(kwargs.pop('test_vcr'))
 import hgdemandimport
 
 with hgdemandimport.deactivated():



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


D8524: phabricator: load .arcconfig during reposetup (issue6331)

2020-05-14 Thread sfink (Steve Fink)
sfink created this revision.
Herald added subscribers: mercurial-patches, Kwan.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Wrapping localrepo's loadhgrc() was not working for me because it is too late 
to wrap loadhgrc when the extension is loaded.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/phabricator.py

CHANGE DETAILS

diff --git a/hgext/phabricator.py b/hgext/phabricator.py
--- a/hgext/phabricator.py
+++ b/hgext/phabricator.py
@@ -41,6 +41,9 @@
 
 # API token. Get it from https://$HOST/conduit/login/
 example.phabtoken = cli-
+
+phabricator.url and callsign will fallback to values from repo's .arcconfig if
+available.
 """
 
 from __future__ import absolute_import
@@ -165,16 +168,18 @@
 ]
 
 
-@eh.wrapfunction(localrepo, "loadhgrc")
-def _loadhgrc(orig, ui, wdirvfs, hgvfs, requirements):
+def reposetup(ui, repo):
 """Load ``.arcconfig`` content into a ui instance on repository open.
 """
-result = False
+# Only check for .arcconfig on a localrepo.
+if not hasattr(repo, 'wvfs'):
+return
+
 arcconfig = {}
 
 try:
 # json.loads only accepts bytes from 3.6+
-rawparams = encoding.unifromlocal(wdirvfs.read(b".arcconfig"))
+rawparams = encoding.unifromlocal(repo.wvfs.read(b'.arcconfig'))
 # json.loads only returns unicode strings
 arcconfig = pycompat.rapply(
 lambda x: encoding.unitolocal(x)
@@ -182,25 +187,19 @@
 else x,
 pycompat.json_loads(rawparams),
 )
-
-result = True
 except ValueError:
-ui.warn(_(b"invalid JSON in %s\n") % wdirvfs.join(b".arcconfig"))
+ui.warn(_(b"invalid JSON in %s\n") % repo.wvfs.join('.arcconfig'))
 except IOError:
 pass
 
 cfg = util.sortdict()
 
+source = repo.wvfs.join(b".arcconfig")
 if b"repository.callsign" in arcconfig:
-cfg[(b"phabricator", b"callsign")] = arcconfig[b"repository.callsign"]
+ui.setconfig(b"phabricator", b"callsign", 
arcconfig[b"repository.callsign"], source=source)
 
 if b"phabricator.uri" in arcconfig:
-cfg[(b"phabricator", b"url")] = arcconfig[b"phabricator.uri"]
-
-if cfg:
-ui.applyconfig(cfg, source=wdirvfs.join(b".arcconfig"))
-
-return orig(ui, wdirvfs, hgvfs, requirements) or result  # Load .hg/hgrc
+ui.setconfig(b"phabricator", b"url", arcconfig[b"phabricator.uri"], 
source=source)
 
 
 def vcrcommand(name, flags, spec, helpcategory=None, optionalrepo=False):
@@ -328,13 +327,18 @@
 def readurltoken(ui):
 """return conduit url, token and make sure they exist
 
-Currently read from [auth] config section. In the future, it might
-make sense to read from .arcconfig and .arcrc as well.
+Read token from [auth] config section. Read url from [phabricator] config
+section or repo's .arcconfig. In the future, it might make sense to read
+tokens from ~/.arcrc as well.
 """
 url = ui.config(b'phabricator', b'url')
 if not url:
 raise error.Abort(
-_(b'config %s.%s is required') % (b'phabricator', b'url')
+_(
+b'unable to read phabricator uri from from config %s.%s or %s '
+b'file in repo'
+)
+% (b'phabricator', b'url', b'.arcconfig')
 )
 
 res = httpconnectionmod.readauthforuri(ui, url, util.url(url).user)



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


[Bug 6331] New: phabricator: fail to read credentials from /.arcconfig

2020-05-14 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6331

Bug ID: 6331
   Summary: phabricator: fail to read credentials from /.arcconfig
   Product: Mercurial
   Version: unspecified
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: feature
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: sph...@gmail.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

I have a checkout in ~/src/mozilla3, containing a .arcconfig file. When I
attempt to use it, I get the error:

abort: config phabricator.url is required

I believe this is because the .arcconfig reading is implemented by wrapping
loadhgrc, which happens before the repo is setup.

-- 
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 stable] cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())

2020-05-14 Thread Augie Fackler


> On May 14, 2020, at 6:25 PM, Pierre-Yves David 
>  wrote:
> 
> 
> 
> On 5/14/20 11:28 PM, Augie Fackler wrote:
>>> On May 14, 2020, at 15:15, Gregory Szorc  wrote:
>>> 
>>> On Wed, May 13, 2020 at 5:15 PM Manuel Jacob  wrote:
 # HG changeset patch
 # User Manuel Jacob 
 # Date 1589415041 -7200
 #  Thu May 14 02:10:41 2020 +0200
 # Branch stable
 # Node ID fdbe20620a267f2cc8fb01b60a293117f00cebdb
 # Parent  cf3e07d7648a4371ce584d15dd692e7a6845792f
 cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())
 
>>> I'm -0 on committing this because nobody should be running Python <2.7.4 in 
>>> 2020. Although apparently you are. May I ask how you managed to discover 
>>> this? (The original patch landed in October 2018 and as far as I know 
>>> nobody has reported an issue until now.)
>> Yeah, a regression from October 2018 that matters for Pythons released more 
>> than seven years ago isn't going to make the cut.
>> In what environment are you encountering this issue Manuel?
> 
> The context seems to be 
> https://www.mercurial-scm.org/pipermail/mercurial/2020-May/051937.html


Ah.

> Wheezy also benefits from Long Term Support (LTS) until the end of May 2018.

Welp. I think the user should probably see about migrating. I think it’s more 
likely we drop 2.7 entirely than worry about 2.7.3 and earlier at this point, 
sorry!
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH stable] cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())

2020-05-14 Thread Pierre-Yves David



On 5/14/20 11:28 PM, Augie Fackler wrote:




On May 14, 2020, at 15:15, Gregory Szorc  wrote:

On Wed, May 13, 2020 at 5:15 PM Manuel Jacob  wrote:

# HG changeset patch
# User Manuel Jacob 
# Date 1589415041 -7200
#  Thu May 14 02:10:41 2020 +0200
# Branch stable
# Node ID fdbe20620a267f2cc8fb01b60a293117f00cebdb
# Parent  cf3e07d7648a4371ce584d15dd692e7a6845792f
cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())


I'm -0 on committing this because nobody should be running Python <2.7.4 in 
2020. Although apparently you are. May I ask how you managed to discover this? 
(The original patch landed in October 2018 and as far as I know nobody has 
reported an issue until now.)


Yeah, a regression from October 2018 that matters for Pythons released more 
than seven years ago isn't going to make the cut.

In what environment are you encountering this issue Manuel?


The context seems to be 
https://www.mercurial-scm.org/pipermail/mercurial/2020-May/051937.html



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


Re: [PATCH stable] cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())

2020-05-14 Thread Manuel Jacob

On 2020-05-14 21:17, Gregory Szorc wrote:
On Thu, May 14, 2020 at 12:15 PM Gregory Szorc 


wrote:

On Wed, May 13, 2020 at 5:15 PM Manuel Jacob  
wrote:



# HG changeset patch
# User Manuel Jacob 
# Date 1589415041 -7200
#  Thu May 14 02:10:41 2020 +0200
# Branch stable
# Node ID fdbe20620a267f2cc8fb01b60a293117f00cebdb
# Parent  cf3e07d7648a4371ce584d15dd692e7a6845792f
cext: back out ec3c06a1c554 (use modern buffer protocol in 
mpatch_flist())




I'm -0 on committing this because nobody should be running Python 
<2.7.4
in 2020. Although apparently you are. May I ask how you managed to 
discover

this? (The original patch landed in October 2018 and as far as I know
nobody has reported an issue until now.)


Someone asked on the Mercurial (non-devel) list why Mercurial was 
failing on his machine (running Python 2.7.3). I prepared the patch 
specifically to work around this issue. That's why I suggested myself in 
the patch description that it should probably not be committed. The user 
who reported the problem could work around the problem by disabling the 
C extension.


I'll also mention that python-zstandard uses Py_buffer heavily. I'm 
very
curious if `hg clone` works at all against a server using zstandard or 
with
zstandard revlog compression. I wouldn't at all be surprised if 
something

broke somewhere.


Sounds like it would be a good idea to raise an error for too old Python 
versions. This was also proposed by Marcin Kasperski on the other 
mailing list.


What would be a good minimum Python version?

It should of course be at least Python 2.7.4, to prevent the obscure 
crash from happening.


Some security features of Python 3.x were backported to Python 2.7.9 
(see PEP 466). When requiring at least Python 2.7.9, we can make raise 
the minimum security standard of Mercurial (quote from 
mercurial.sslutil: "Depending on the version of Python being used, 
SSL/TLS support is either modern/secure or legacy/insecure. Many 
operations in this module have separate code paths depending on support 
in Python.").


The older the Python, the higher the chance of running into bugs. But 
unless there's a specific reason, I tend to say that we should not 
forbid old Python versions just because we can (here I'm taking the 
perspective of others; for me personally, it would be fine to drop 
Python 2.7 support completely).


My proposal:

* Change the stable branch to raise an error if the Python version is 
older than Python 2.7.4.
* Change the default branch to raise an error if the Python version is 
older than Python 2.7.9.

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


Re: [PATCH stable] cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())

2020-05-14 Thread Augie Fackler


> On May 14, 2020, at 15:15, Gregory Szorc  wrote:
> 
> On Wed, May 13, 2020 at 5:15 PM Manuel Jacob  wrote:
>> # HG changeset patch
>> # User Manuel Jacob 
>> # Date 1589415041 -7200
>> #  Thu May 14 02:10:41 2020 +0200
>> # Branch stable
>> # Node ID fdbe20620a267f2cc8fb01b60a293117f00cebdb
>> # Parent  cf3e07d7648a4371ce584d15dd692e7a6845792f
>> cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())
>> 
> I'm -0 on committing this because nobody should be running Python <2.7.4 in 
> 2020. Although apparently you are. May I ask how you managed to discover 
> this? (The original patch landed in October 2018 and as far as I know nobody 
> has reported an issue until now.)

Yeah, a regression from October 2018 that matters for Pythons released more 
than seven years ago isn't going to make the cut.

In what environment are you encountering this issue Manuel?
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D8431: upgrade: support upgrade and downgrade from persistent nodemap

2020-05-14 Thread marmoute (Pierre-Yves David)
Closed by commit rHG526d69eeea31: upgrade: support upgrade and downgrade from 
persistent nodemap (authored by marmoute).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs 
Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8431?vs=21349=21383

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

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

AFFECTED FILES
  mercurial/helptext/internals/requirements.txt
  mercurial/upgrade.py
  tests/test-persistent-nodemap.t

CHANGE DETAILS

diff --git a/tests/test-persistent-nodemap.t b/tests/test-persistent-nodemap.t
--- a/tests/test-persistent-nodemap.t
+++ b/tests/test-persistent-nodemap.t
@@ -439,3 +439,99 @@
   .hg/store/00changelog-.nd: size=121536, 
sha256=bb414468d225cf52d69132e1237afba34d4346ee2eb81b505027e6197b107f03 (glob) 
(pure !)
   .hg/store/00changelog-.nd: size=121536, 
sha256=909ac727bc4d1c0fda5f7bff3c620c98bd4a2967c143405a1503439e33b377da (glob) 
(rust !)
   .hg/store/00changelog-.nd: size=121088, 
sha256=342d36d30d86dde67d3cb6c002606c4a75bcad665595d941493845066d9c8ee0 (glob) 
(no-pure no-rust !)
+
+Test upgrade / downgrade
+
+
+downgrading
+
+  $ cat << EOF >> .hg/hgrc
+  > [format]
+  > use-persistent-nodemap=no
+  > EOF
+  $ hg debugformat -v
+  format-variant repo config default
+  fncache:yesyes yes
+  dotencode:  yesyes yes
+  generaldelta:   yesyes yes
+  sparserevlog:   yesyes yes
+  sidedata:no no  no
+  persistent-nodemap: yes no  no
+  copies-sdc:  no no  no
+  plain-cl-delta: yesyes yes
+  compression:zlib   zlibzlib
+  compression-level:  default default default
+  $ hg debugupgraderepo --run --no-backup --quiet
+  upgrade will perform the following actions:
+  
+  requirements
+ preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
+ removed: persistent-nodemap
+  
+  $ ls -1 .hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)'
+  [1]
+  $ hg debugnodemap --metadata
+
+
+upgrading
+
+  $ cat << EOF >> .hg/hgrc
+  > [format]
+  > use-persistent-nodemap=yes
+  > EOF
+  $ hg debugformat -v
+  format-variant repo config default
+  fncache:yesyes yes
+  dotencode:  yesyes yes
+  generaldelta:   yesyes yes
+  sparserevlog:   yesyes yes
+  sidedata:no no  no
+  persistent-nodemap:  noyes  no
+  copies-sdc:  no no  no
+  plain-cl-delta: yesyes yes
+  compression:zlib   zlibzlib
+  compression-level:  default default default
+  $ hg debugupgraderepo --run --no-backup --quiet
+  upgrade will perform the following actions:
+  
+  requirements
+ preserved: dotencode, fncache, generaldelta, revlogv1, sparserevlog, store
+ added: persistent-nodemap
+  
+  $ ls -1 .hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)'
+  00changelog-*.nd (glob)
+  00changelog.n
+  00manifest-*.nd (glob)
+  00manifest.n
+
+  $ hg debugnodemap --metadata
+  uid: * (glob)
+  tip-rev: 5005
+  tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe
+  data-length: 121088
+  data-unused: 0
+  data-unused: 0.000%
+
+Running unrelated upgrade
+
+  $ hg debugupgraderepo --run --no-backup --quiet --optimize re-delta-all
+  upgrade will perform the following actions:
+  
+  requirements
+ preserved: dotencode, fncache, generaldelta, persistent-nodemap, 
revlogv1, sparserevlog, store
+  
+  optimisations: re-delta-all
+  
+  $ ls -1 .hg/store/ | egrep '00(changelog|manifest)(\.n|-.*\.nd)'
+  00changelog-*.nd (glob)
+  00changelog.n
+  00manifest-*.nd (glob)
+  00manifest.n
+
+  $ hg debugnodemap --metadata
+  uid: * (glob)
+  tip-rev: 5005
+  tip-node: 90d5d3ba2fc47db50f712570487cb261a68c8ffe
+  data-length: 121088
+  data-unused: 0
+  data-unused: 0.000%
diff --git a/mercurial/upgrade.py b/mercurial/upgrade.py
--- a/mercurial/upgrade.py
+++ b/mercurial/upgrade.py
@@ -78,6 +78,7 @@
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
 localrepo.COPIESSDC_REQUIREMENT,
+localrepo.NODEMAP_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -105,6 +106,7 @@
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
 localrepo.COPIESSDC_REQUIREMENT,
+localrepo.NODEMAP_REQUIREMENT,
 }
 for name in compression.compengines:
 engine = compression.compengines[name]
@@ -132,6 +134,7 @@
 localrepo.SPARSEREVLOG_REQUIREMENT,
 localrepo.SIDEDATA_REQUIREMENT,
 localrepo.COPIESSDC_REQUIREMENT,
+localrepo.NODEMAP_REQUIREMENT,
 }
 for name in 

[Bug 6330] New: chg commands sometimes fail with EBUSY

2020-05-14 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6330

Bug ID: 6330
   Summary: chg commands sometimes fail with EBUSY
   Product: Mercurial
   Version: 5.3
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: chg
  Assignee: bugzi...@mercurial-scm.org
  Reporter: mplam...@janestreet.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

Beginning with hg 5.3, I sometimes see chg commands output the following error
message:

: Traceback (most recent call last):
:   File "path-to-hg/mercurial/commandserver.py", line 470, in _serverequest
: sv.cleanup()
:   File "path-to-hg/mercurial/chgserver.py", line 381, in cleanup
: self._restoreio()
:   File "path-to-hg/mercurial/chgserver.py", line 444, in _restoreio
: os.dup2(fd, fp.fileno())
: OSError: [Errno 16] Device or resource busy
: Traceback (most recent call last):
:   File "path-to-hg/mercurial/commandserver.py", line 650, in
_acceptnewconnection
: self._runworker(conn)
:   File "path-to-hg/mercurial/commandserver.py", line 701, in _runworker
: prereposetups=[self._reposetup],
:   File "path-to-hg/mercurial/commandserver.py", line 470, in _serverequest
: sv.cleanup()
:   File "path-to-hg/mercurial/chgserver.py", line 381, in cleanup
: self._restoreio()
:   File "path-to-hg/mercurial/chgserver.py", line 444, in _restoreio
: os.dup2(fd, fp.fileno())
: OSError: [Errno 16] Device or resource busy

[man dup2] indicates that, on Linux, EBUSY comes from a race condition
between open() and dup2().

I've only been able to reproduce this error message when running on a
loaded machine, and even then, the error doesn't happen consistently.

When this error does happen, the hg command that encountered the error
is otherwise successful.

-- 
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: Extensions: py3 compatibility metadata

2020-05-14 Thread Gregory Szorc
On Wed, May 13, 2020 at 5:18 AM Georges Racinet 
wrote:

> Hi all,
>
> I don't think we have anything for third party extensions to claim their
> compatibility with Mercurial on Python 3.
>
> Would it be a good idea to add new metadata, such as `py3testedwith` or
> `py3minimumhgversion`?
>

I had thought about this a while ago as well and never got around to
submitting patches. I think it would be a good idea to have more source
level annotations for extensions to mark compatibility with Mercurial,
Python, etc versions/environments. One could even imagine a configuration
mode where Mercurial refuses to load extensions unless they have
annotations indicating they are compatible. This would be a "safe" way to
transition from Python 2 to 3.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH stable] cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())

2020-05-14 Thread Gregory Szorc
On Thu, May 14, 2020 at 12:15 PM Gregory Szorc 
wrote:

> On Wed, May 13, 2020 at 5:15 PM Manuel Jacob  wrote:
>
>> # HG changeset patch
>> # User Manuel Jacob 
>> # Date 1589415041 -7200
>> #  Thu May 14 02:10:41 2020 +0200
>> # Branch stable
>> # Node ID fdbe20620a267f2cc8fb01b60a293117f00cebdb
>> # Parent  cf3e07d7648a4371ce584d15dd692e7a6845792f
>> cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())
>>
>
> I'm -0 on committing this because nobody should be running Python <2.7.4
> in 2020. Although apparently you are. May I ask how you managed to discover
> this? (The original patch landed in October 2018 and as far as I know
> nobody has reported an issue until now.)
>

I'll also mention that python-zstandard uses Py_buffer heavily. I'm very
curious if `hg clone` works at all against a server using zstandard or with
zstandard revlog compression. I wouldn't at all be surprised if something
broke somewhere.


>
>
>>
>> On old Python versions (prior to 2.7.4), old-style 'buffer' objects were
>> not
>> recognized by the new-style buffer API. See
>> https://bugs.python.org/issue10211
>> for details.
>>
>> Since old-style buffers are deprecated on Python 3 and the Python version
>> that
>> fixes this issue was released over 7 years ago, I'm not actually proposing
>> that this patch should be committed. It might still be helpful for people
>> compiling Mercurial on very old versions of Python.
>>
>> diff --git a/mercurial/cext/mpatch.c b/mercurial/cext/mpatch.c
>> --- a/mercurial/cext/mpatch.c
>> +++ b/mercurial/cext/mpatch.c
>> @@ -50,25 +50,24 @@
>>
>>  struct mpatch_flist *cpygetitem(void *bins, ssize_t pos)
>>  {
>> -   Py_buffer buffer;
>> -   struct mpatch_flist *res = NULL;
>> +   const char *buffer;
>> +   struct mpatch_flist *res;
>> +   ssize_t blen;
>> int r;
>>
>> PyObject *tmp = PyList_GetItem((PyObject *)bins, pos);
>> if (!tmp) {
>> return NULL;
>> }
>> -   if (PyObject_GetBuffer(tmp, , PyBUF_CONTIG_RO)) {
>> +   if (PyObject_AsCharBuffer(tmp, , (Py_ssize_t *))) {
>> return NULL;
>> }
>> -   if ((r = mpatch_decode(buffer.buf, buffer.len, )) < 0) {
>> +   if ((r = mpatch_decode(buffer, blen, )) < 0) {
>> if (!PyErr_Occurred()) {
>> setpyerr(r);
>> }
>> -   res = NULL;
>> +   return NULL;
>> }
>> -
>> -   PyBuffer_Release();
>> return res;
>>  }
>>
>>
>> ___
>> 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 stable] cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())

2020-05-14 Thread Gregory Szorc
On Wed, May 13, 2020 at 5:15 PM Manuel Jacob  wrote:

> # HG changeset patch
> # User Manuel Jacob 
> # Date 1589415041 -7200
> #  Thu May 14 02:10:41 2020 +0200
> # Branch stable
> # Node ID fdbe20620a267f2cc8fb01b60a293117f00cebdb
> # Parent  cf3e07d7648a4371ce584d15dd692e7a6845792f
> cext: back out ec3c06a1c554 (use modern buffer protocol in mpatch_flist())
>

I'm -0 on committing this because nobody should be running Python <2.7.4 in
2020. Although apparently you are. May I ask how you managed to discover
this? (The original patch landed in October 2018 and as far as I know
nobody has reported an issue until now.)


>
> On old Python versions (prior to 2.7.4), old-style 'buffer' objects were
> not
> recognized by the new-style buffer API. See
> https://bugs.python.org/issue10211
> for details.
>
> Since old-style buffers are deprecated on Python 3 and the Python version
> that
> fixes this issue was released over 7 years ago, I'm not actually proposing
> that this patch should be committed. It might still be helpful for people
> compiling Mercurial on very old versions of Python.
>
> diff --git a/mercurial/cext/mpatch.c b/mercurial/cext/mpatch.c
> --- a/mercurial/cext/mpatch.c
> +++ b/mercurial/cext/mpatch.c
> @@ -50,25 +50,24 @@
>
>  struct mpatch_flist *cpygetitem(void *bins, ssize_t pos)
>  {
> -   Py_buffer buffer;
> -   struct mpatch_flist *res = NULL;
> +   const char *buffer;
> +   struct mpatch_flist *res;
> +   ssize_t blen;
> int r;
>
> PyObject *tmp = PyList_GetItem((PyObject *)bins, pos);
> if (!tmp) {
> return NULL;
> }
> -   if (PyObject_GetBuffer(tmp, , PyBUF_CONTIG_RO)) {
> +   if (PyObject_AsCharBuffer(tmp, , (Py_ssize_t *))) {
> return NULL;
> }
> -   if ((r = mpatch_decode(buffer.buf, buffer.len, )) < 0) {
> +   if ((r = mpatch_decode(buffer, blen, )) < 0) {
> if (!PyErr_Occurred()) {
> setpyerr(r);
> }
> -   res = NULL;
> +   return NULL;
> }
> -
> -   PyBuffer_Release();
> return res;
>  }
>
>
> ___
> 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


Adding a cache for dirstate

2020-05-14 Thread Raphaël Gomès

Hi all,

I have made a new plan page explaining a new cache for `dirstate.status` 
in detail:


https://www.mercurial-scm.org/wiki/DirsCachePlan

Maybe this email can be the discussion thread around this. I'm not sure 
how other plans have worked in this regard.


Thanks,
Raphaël

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


D8523: py3: fix exception in pull when several things happen to a bookmark

2020-05-14 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Specifically, when `changes` is:
  
[(b'@upstream-committed', None, , b'updating bookmark 
@upstream-committed\n'),
 (b'@upstream-committed', binary-node, , b'divergent 
bookmark @ stored as @upstream-committed\n')]
  
  sorting the list raises:
  
TypeError: '<' not supported between instances of 'bytes' and 'NoneType'

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/bookmarks.py

CHANGE DETAILS

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -754,7 +754,8 @@
 if changed:
 tr = trfunc()
 changes = []
-for b, node, writer, msg in sorted(changed):
+key = lambda t: (t[0], t[1] or b'')
+for b, node, writer, msg in sorted(changed, key=key):
 changes.append((b, node))
 writer(msg)
 localmarks.applychanges(repo, tr, changes)



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