D9441: run-tests: use a context manager when looking for available ports

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -255,9 +255,8 @@
 else:
 family = socket.AF_INET
 try:
-s = socket.socket(family, socket.SOCK_STREAM)
-s.bind(('localhost', port))
-s.close()
+with socket.socket(family, socket.SOCK_STREAM) as s:
+s.bind(('localhost', port))
 return True
 except socket.error as exc:
 if exc.errno not in (



To: mharbison72, #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


D9440: dispatch: print the version of each extension in the bug report, if available

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Sometimes the wrong extensions is blamed, so we might as well print the 
version
  info for all of them.  Additionally, since the internal extensions are never
  blamed, this is a good way to make the pygit2 version available in a bug 
report.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1421,7 +1421,7 @@
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM * (glob)
-  ** Extensions loaded: throw
+  ** Extensions loaded: throw 1.0.0
 
 empty declaration of supported version, extension complains (but doesn't choke 
if
 the value is improperly a str instead of bytes):
@@ -1433,7 +1433,7 @@
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM (*) (glob)
-  ** Extensions loaded: throw
+  ** Extensions loaded: throw 1.0.0
 
 If the extension specifies a buglink, show that (but don't choke if the value 
is
 improperly a str instead of bytes):
@@ -1447,7 +1447,7 @@
   ** If that fixes the bug please report it to http://example.com/bts
   ** Python * (glob)
   ** Mercurial Distributed SCM (*) (glob)
-  ** Extensions loaded: throw
+  ** Extensions loaded: throw 1.0.0
 
 If the extensions declare outdated versions, accuse the older extension first:
   $ echo "from mercurial import util" >> older.py
@@ -1464,7 +1464,7 @@
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM (version 2.2)
-  ** Extensions loaded: older, throw
+  ** Extensions loaded: older, throw 1.0.0
 
 One extension only tested with older, one only with newer versions:
   $ echo "util.version = lambda:b'2.1'" >> older.py
@@ -1478,7 +1478,7 @@
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM (version 2.1)
-  ** Extensions loaded: older, throw
+  ** Extensions loaded: older, throw 1.0.0
 
 Older extension is tested with current version, the other only with newer:
   $ echo "util.version = lambda:b'1.9.3'" >> older.py
@@ -1492,7 +1492,7 @@
   ** If that fixes the bug please report it to http://example.com/bts
   ** Python * (glob)
   ** Mercurial Distributed SCM (version 1.9.3)
-  ** Extensions loaded: older, throw
+  ** Extensions loaded: older, throw 1.0.0
 
 Ability to point to a different point
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
@@ -1501,7 +1501,7 @@
   ** Your Local Goat Lenders
   ** Python * (glob)
   ** Mercurial Distributed SCM (*) (glob)
-  ** Extensions loaded: older, throw
+  ** Extensions loaded: older, throw 1.0.0
 
 Declare the version as supporting this hg version, show regular bts link:
   $ hgver=`hg debuginstall -T '{hgver}'`
@@ -1516,7 +1516,7 @@
   ** https://mercurial-scm.org/wiki/BugTracker
   ** Python * (glob)
   ** Mercurial Distributed SCM (*) (glob)
-  ** Extensions loaded: throw
+  ** Extensions loaded: throw 1.0.0
 
 Patch version is ignored during compatibility check
   $ echo "testedwith = b'3.2'" >> throw.py
@@ -1528,7 +1528,7 @@
   ** https://mercurial-scm.org/wiki/BugTracker
   ** Python * (glob)
   ** Mercurial Distributed SCM (*) (glob)
-  ** Extensions loaded: throw
+  ** Extensions loaded: throw 1.0.0
 
 Test version number support in 'hg version':
   $ echo '__version__ = (1, 2, 3)' >> throw.py
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -1307,12 +1307,22 @@
 + b'\n'
 )
 sysversion = pycompat.sysbytes(sys.version).replace(b'\n', b'')
+
+def ext_with_ver(x):
+ext = x[0]
+ver = extensions.moduleversion(x[1])
+if ver:
+ext += b' ' + ver
+return ext
+
 warning += (
 (_(b"** Python %s\n") % sysversion)
 + (_(b"** Mercurial Distributed SCM (version %s)\n") % util.version())
 + (
 _(b"** Extensions loaded: %s\n")
-% b", ".join([x[0] for x in sorted(extensions.extensions())])
+% b", ".join(
+[ext_with_ver(x) for x in sorted(extensions.extensions())]
+)
 )
 )
 return warning



To: mharbison72, #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


D9439: dispatch: sort the loaded extension names in the bug report

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This makes a long list of extensions easier to read.  On very rare occasion 
I've
  seen issues where the load order mattered, however that info should still be
  obtainable with `hg config extensions`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1464,7 +1464,7 @@
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM (version 2.2)
-  ** Extensions loaded: throw, older
+  ** Extensions loaded: older, throw
 
 One extension only tested with older, one only with newer versions:
   $ echo "util.version = lambda:b'2.1'" >> older.py
@@ -1478,7 +1478,7 @@
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM (version 2.1)
-  ** Extensions loaded: throw, older
+  ** Extensions loaded: older, throw
 
 Older extension is tested with current version, the other only with newer:
   $ echo "util.version = lambda:b'1.9.3'" >> older.py
@@ -1492,7 +1492,7 @@
   ** If that fixes the bug please report it to http://example.com/bts
   ** Python * (glob)
   ** Mercurial Distributed SCM (version 1.9.3)
-  ** Extensions loaded: throw, older
+  ** Extensions loaded: older, throw
 
 Ability to point to a different point
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
@@ -1501,7 +1501,7 @@
   ** Your Local Goat Lenders
   ** Python * (glob)
   ** Mercurial Distributed SCM (*) (glob)
-  ** Extensions loaded: throw, older
+  ** Extensions loaded: older, throw
 
 Declare the version as supporting this hg version, show regular bts link:
   $ hgver=`hg debuginstall -T '{hgver}'`
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -1312,7 +1312,7 @@
 + (_(b"** Mercurial Distributed SCM (version %s)\n") % util.version())
 + (
 _(b"** Extensions loaded: %s\n")
-% b", ".join([x[0] for x in extensions.extensions()])
+% b", ".join([x[0] for x in sorted(extensions.extensions())])
 )
 )
 return warning



To: mharbison72, #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


D9438: dispatch: quote the extension when printing the bug report

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I think this reads better in the wall of text.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1415,9 +1415,9 @@
 
 No declared supported version, extension complains:
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
+  ** Unknown exception encountered with possibly-broken third-party extension 
"throw" 1.0.0
   ** which supports versions unknown of Mercurial.
-  ** Please disable throw and try your action again.
+  ** Please disable "throw" and try your action again.
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM * (glob)
@@ -1427,9 +1427,9 @@
 the value is improperly a str instead of bytes):
   $ echo "testedwith = ''" >> throw.py
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
+  ** Unknown exception encountered with possibly-broken third-party extension 
"throw" 1.0.0
   ** which supports versions unknown of Mercurial.
-  ** Please disable throw and try your action again.
+  ** Please disable "throw" and try your action again.
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM (*) (glob)
@@ -1441,9 +1441,9 @@
   $ rm -f throw.pyc throw.pyo
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
+  ** Unknown exception encountered with possibly-broken third-party extension 
"throw" 1.0.0
   ** which supports versions unknown of Mercurial.
-  ** Please disable throw and try your action again.
+  ** Please disable "throw" and try your action again.
   ** If that fixes the bug please report it to http://example.com/bts
   ** Python * (glob)
   ** Mercurial Distributed SCM (*) (glob)
@@ -1458,9 +1458,9 @@
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
older (version N/A)
+  ** Unknown exception encountered with possibly-broken third-party extension 
"older" (version N/A)
   ** which supports versions 1.9 of Mercurial.
-  ** Please disable older and try your action again.
+  ** Please disable "older" and try your action again.
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM (version 2.2)
@@ -1472,9 +1472,9 @@
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
older (version N/A)
+  ** Unknown exception encountered with possibly-broken third-party extension 
"older" (version N/A)
   ** which supports versions 1.9 of Mercurial.
-  ** Please disable older and try your action again.
+  ** Please disable "older" and try your action again.
   ** If that fixes the bug please report it to the extension author.
   ** Python * (glob)
   ** Mercurial Distributed SCM (version 2.1)
@@ -1486,9 +1486,9 @@
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
+  ** Unknown exception encountered with possibly-broken third-party extension 
"throw" 1.0.0
   ** which supports versions 2.1 of Mercurial.
-  ** Please disable throw and try your action again.
+  ** Please disable "throw" and try your action again.
   ** If that fixes the bug please report it to http://example.com/bts
   ** Python * (glob)
   ** Mercurial Distributed SCM (version 1.9.3)
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -1289,9 +1289,9 @@
 extver = version or _(b"(version N/A)")
 warning = _(
 b'** Unknown exception encountered with '
-b'possibly-broken third-party extension %s %s\n'
+b'possibly-broken third-party extension "%s" %s\n'
 b'** which supports versions %s of Mercurial.\n'
-b'** Please disable %s and try your action again.\n'
+b'** Please disable "%s" and try your action again.\n'
 b'** If that fixes the 

D9437: dispatch: print the version of the extension being blamed in a bug report

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I don't know of a lot of extensions using this, but it seems like useful info 
in
  a bug report.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dispatch.py
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1415,7 +1415,7 @@
 
 No declared supported version, extension complains:
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw
+  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
   ** which supports versions unknown of Mercurial.
   ** Please disable throw and try your action again.
   ** If that fixes the bug please report it to the extension author.
@@ -1427,7 +1427,7 @@
 the value is improperly a str instead of bytes):
   $ echo "testedwith = ''" >> throw.py
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw
+  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
   ** which supports versions unknown of Mercurial.
   ** Please disable throw and try your action again.
   ** If that fixes the bug please report it to the extension author.
@@ -1441,7 +1441,7 @@
   $ rm -f throw.pyc throw.pyo
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw
+  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
   ** which supports versions unknown of Mercurial.
   ** Please disable throw and try your action again.
   ** If that fixes the bug please report it to http://example.com/bts
@@ -1458,7 +1458,7 @@
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
older
+  ** Unknown exception encountered with possibly-broken third-party extension 
older (version N/A)
   ** which supports versions 1.9 of Mercurial.
   ** Please disable older and try your action again.
   ** If that fixes the bug please report it to the extension author.
@@ -1472,7 +1472,7 @@
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
older
+  ** Unknown exception encountered with possibly-broken third-party extension 
older (version N/A)
   ** which supports versions 1.9 of Mercurial.
   ** Please disable older and try your action again.
   ** If that fixes the bug please report it to the extension author.
@@ -1486,7 +1486,7 @@
   $ rm -Rf __pycache__
   $ hg --config extensions.throw=throw.py --config extensions.older=older.py \
   >   throw 2>&1 | egrep '^\*\*'
-  ** Unknown exception encountered with possibly-broken third-party extension 
throw
+  ** Unknown exception encountered with possibly-broken third-party extension 
throw 1.0.0
   ** which supports versions 2.1 of Mercurial.
   ** Please disable throw and try your action again.
   ** If that fixes the bug please report it to http://example.com/bts
diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -1253,7 +1253,7 @@
 # of date) will be clueful enough to notice the implausible
 # version number and try updating.
 ct = util.versiontuple(n=2)
-worst = None, ct, b''
+worst = None, ct, b'', b''
 if ui.config(b'ui', b'supportcontact') is None:
 for name, mod in extensions.extensions():
 # 'testedwith' should be bytes, but not all extensions are ported
@@ -1261,10 +1261,11 @@
 testedwith = stringutil.forcebytestr(
 getattr(mod, 'testedwith', b'')
 )
+version = extensions.moduleversion(mod)
 report = getattr(mod, 'buglink', _(b'the extension author.'))
 if not testedwith.strip():
 # We found an untested extension. It's likely the culprit.
-worst = name, b'unknown', report
+worst = name, b'unknown', report, version
 break
 
 # Never blame on extensions bundled with Mercurial.
@@ -1278,20 +1279,21 @@
 lower = [t for t in tested if t < ct]
 nearest = max(lower or tested)
 if worst[0] is None or nearest < worst[1]:
-worst = name, nearest, report
+worst = name, nearest, report, 

D9436: git: show the version of `pygit2` with verbose version output

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This seems like useful info to have when debugging.  I followed the precedent 
of
  hg-git, which prints something like:
  
hggitexternal  0.9.0a1 (dulwich 0.19.15)
  
  We don't have a version number assigned (because it's internal), so it's just
  the parenthetical.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/__init__.py
  hgext/git/gitutil.py
  tests/test-git-interop.t

CHANGE DETAILS

diff --git a/tests/test-git-interop.t b/tests/test-git-interop.t
--- a/tests/test-git-interop.t
+++ b/tests/test-git-interop.t
@@ -16,6 +16,10 @@
   >  }
 
 
+  $ hg version -v --config extensions.git= | grep '^[E ]'
+  Enabled extensions:
+git  internal  (pygit2 *) (glob)
+
 Test auto-loading extension works:
   $ mkdir nogit
   $ cd nogit
diff --git a/hgext/git/gitutil.py b/hgext/git/gitutil.py
--- a/hgext/git/gitutil.py
+++ b/hgext/git/gitutil.py
@@ -20,6 +20,19 @@
 return pygit2_module
 
 
+def pygit2_version():
+mod = get_pygit2()
+v = "N/A"
+
+if mod:
+try:
+v = mod.__version__
+except AttributeError:
+pass
+
+return b"(pygit2 %s)" % v.encode("utf-8")
+
+
 def togitnode(n):
 """Wrapper to convert a Mercurial binary node to a unicode hexlified node.
 
diff --git a/hgext/git/__init__.py b/hgext/git/__init__.py
--- a/hgext/git/__init__.py
+++ b/hgext/git/__init__.py
@@ -44,6 +44,9 @@
 default=False,
 )
 
+getversion = gitutil.pygit2_version
+
+
 # TODO: extract an interface for this in core
 class gitstore(object):  # store.basicstore):
 def __init__(self, path, vfstype):



To: mharbison72, durin42, #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


D9432: formatting: drop a few extra double quotes in docstrings

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  These were made obvious by the reformatting in D9430 
.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/fix.py
  mercurial/interfaces/repository.py
  mercurial/match.py

CHANGE DETAILS

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -107,7 +107,7 @@
 
 
 def _kindpatsalwaysmatch(kindpats):
-""" "Checks whether the kindspats match everything, as e.g.
+"""Checks whether the kindspats match everything, as e.g.
 'relpath:.' does.
 """
 for kind, pat, source in kindpats:
diff --git a/mercurial/interfaces/repository.py 
b/mercurial/interfaces/repository.py
--- a/mercurial/interfaces/repository.py
+++ b/mercurial/interfaces/repository.py
@@ -617,7 +617,7 @@
 """
 
 def revision(node, raw=False):
-""" "Obtain fulltext data for a node.
+"""Obtain fulltext data for a node.
 
 By default, any storage transformations are applied before the data
 is returned. If ``raw`` is True, non-raw storage transformations
diff --git a/hgext/fix.py b/hgext/fix.py
--- a/hgext/fix.py
+++ b/hgext/fix.py
@@ -372,7 +372,7 @@
 
 
 def getworkqueue(ui, repo, pats, opts, revstofix, basectxs):
-""" "Constructs the list of files to be fixed at specific revisions
+"""Constructs the list of files to be fixed at specific revisions
 
 It is up to the caller how to consume the work items, and the only
 dependence between them is that replacement revisions must be committed in



To: mharbison72, #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


D9434: tests: add a comment that we're purposely testing py2 extension attributes

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Avoid someone unknowingly removing test coverage.  There are tests for a
  properly byteified `testedwith` a few lines down.  I don't see similar for
  `buglink`, but it's a trivial conversion to bytes, so I'm not concerned about
  testing the expected/wanted extension state.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1423,7 +1423,8 @@
   ** Mercurial Distributed SCM * (glob)
   ** Extensions loaded: throw
 
-empty declaration of supported version, extension complains:
+empty declaration of supported version, extension complains (but doesn't choke 
if
+the value is improperly a str instead of bytes):
   $ echo "testedwith = ''" >> throw.py
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
   ** Unknown exception encountered with possibly-broken third-party extension 
throw
@@ -1434,7 +1435,8 @@
   ** Mercurial Distributed SCM (*) (glob)
   ** Extensions loaded: throw
 
-If the extension specifies a buglink, show that:
+If the extension specifies a buglink, show that (but don't choke if the value 
is
+improperly a str instead of bytes):
   $ echo 'buglink = "http://example.com/bts;' >> throw.py
   $ rm -f throw.pyc throw.pyo
   $ rm -Rf __pycache__



To: mharbison72, #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


D9433: extensions: avoid a crash when the version isn't properly byteified on py3

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We already force bytestr on the `testedwith` and `buglink` attributes in
  dispatch.py when generating a bug report with a similar comment about not
  every extension being ported to py3.  We should do the same here, so the
  function can be properly typed.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/extensions.py
  tests/test-extension.t

CHANGE DETAILS

diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -1399,12 +1399,20 @@
   > cmdtable = {}
   > command = registrar.command(cmdtable)
   > class Bogon(Exception): pass
+  > # NB: version should be bytes; simulating extension not ported to py3
+  > __version__ = '1.0.0'
   > @command(b'throw', [], b'hg throw', norepo=True)
   > def throw(ui, **opts):
   > """throws an exception"""
   > raise Bogon()
   > EOF
 
+Test extension without proper byteification of key attributes doesn't crash 
when
+accessed.
+
+  $ hg version -v --config extensions.throw=throw.py | grep '^ '
+throw  external  1.0.0
+
 No declared supported version, extension complains:
   $ hg --config extensions.throw=throw.py throw 2>&1 | egrep '^\*\*'
   ** Unknown exception encountered with possibly-broken third-party extension 
throw
diff --git a/mercurial/extensions.py b/mercurial/extensions.py
--- a/mercurial/extensions.py
+++ b/mercurial/extensions.py
@@ -936,6 +936,10 @@
 version = b''
 if isinstance(version, (list, tuple)):
 version = b'.'.join(pycompat.bytestr(o) for o in version)
+else:
+# version data should be bytes, but not all extensions are ported
+# to py3.
+version = stringutil.forcebytestr(version)
 return version
 
 



To: mharbison72, #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


D9435: git: add the standard `testedwith` attribute

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Otherwise this shows up as an external extension.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/__init__.py

CHANGE DETAILS

diff --git a/hgext/git/__init__.py b/hgext/git/__init__.py
--- a/hgext/git/__init__.py
+++ b/hgext/git/__init__.py
@@ -29,6 +29,12 @@
 index,
 )
 
+# Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' 
for
+# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
+# be specifying the version(s) of Mercurial they are tested with, or
+# leave the attribute unspecified.
+testedwith = b'ships-with-hg-core'
+
 configtable = {}
 configitem = registrar.configitem(configtable)
 # git.log-index-cache-miss: internal knob for testing



To: mharbison72, durin42, #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


[PATCH STABLE] diff: do not concatenate immutable bytes while building a/b bodies (issue6445)

2020-11-27 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1606529754 -32400
#  Sat Nov 28 11:15:54 2020 +0900
# Branch stable
# Node ID 1e93d856abc0ecb7f537af5c77e0d75ffe93db08
# Parent  81da6feb5000140adb8972607415855953415233
diff: do not concatenate immutable bytes while building a/b bodies (issue6445)

Use bytearray instead. I don't know what's changed since Python 2, but bytes
concatenation is 100x slow on Python 3.

  % python2.7 -m timeit -s "s = b''" "for i in range(1): s += b'line'"
  1000 loops, best of 3: 321 usec per loop

  % python3.9 -m timeit -s "s = b''" "for i in range(1): s += b'line'"
  5 loops, best of 5: 39.2 msec per loop

Benchmark using tailwind.css (measuring the fast path, a is empty):

  % HGRCPATH=/dev/null python2.7 ./hg log -R /tmp/issue6445 -p --time \
  --color=always --config diff.word-diff=true >/dev/null
  (prev) time: real 1.580 secs (user 1.560+0.000 sys 0.020+0.000)
  (this) time: real 1.610 secs (user 1.570+0.000 sys 0.030+0.000)

  % HGRCPATH=/dev/null python3.9 ./hg log -R /tmp/issue6445 -p --time \
  --color=always --config diff.word-diff=true >/dev/null
  (prev) time: real 114.500 secs (user 114.460+0.000 sys 0.030+0.000)
  (this) time: real 2.180 secs (user 2.140+0.000 sys 0.040+0.000)

Benchmark using random tabular text data (not the fast path):

  % dd if=/dev/urandom bs=1k count=1000 | hexdump -v -e '16/1 "%3u," "\n"' > ttf
  % hg ci -ma
  % dd if=/dev/urandom bs=1k count=1000 | hexdump -v -e '16/1 "%3u," "\n"' > ttf
  % hg ci -mb

  % HGRCPATH=/dev/null python2.7 ./hg log -R /tmp/issue6445 -p --time \
  --color=always --config diff.word-diff=true >/dev/null
  (prev) time: real 3.240 secs (user 3.040+0.000 sys 0.200+0.000
  (this) time: real 3.230 secs (user 3.070+0.000 sys 0.160+0.000)

  % HGRCPATH=/dev/null python3.9 ./hg log -R /tmp/issue6445 -p --time \
  --color=always --config diff.word-diff=true >/dev/null
  (prev) time: real 44.130 secs (user 43.850+0.000 sys 0.270+0.000)
  (this) time: real 4.170 secs (user 3.850+0.000 sys 0.310+0.000)

diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2731,8 +2731,8 @@ def diffsinglehunk(hunklines):
 def diffsinglehunkinline(hunklines):
 """yield tokens for a list of lines in a single hunk, with inline colors"""
 # prepare deleted, and inserted content
-a = b''
-b = b''
+a = bytearray()
+b = bytearray()
 for line in hunklines:
 if line[0:1] == b'-':
 a += line[1:]
@@ -2746,8 +2746,8 @@ def diffsinglehunkinline(hunklines):
 yield t
 return
 # re-split the content into words
-al = wordsplitter.findall(a)
-bl = wordsplitter.findall(b)
+al = wordsplitter.findall(bytes(a))
+bl = wordsplitter.findall(bytes(b))
 # re-arrange the words to lines since the diff algorithm is line-based
 aln = [s if s == b'\n' else s + b'\n' for s in al]
 bln = [s if s == b'\n' else s + b'\n' for s in bl]

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


D9431: hghave: adjust the detection of `pylint` for modern versions

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I have pylint 2.6.0 installed locally, and it only has a single space.  I have
  no idea when this changed.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  tests/hghave.py

CHANGE DETAILS

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -586,7 +586,7 @@
 
 @check("pylint", "Pylint python linter")
 def has_pylint():
-return matchoutput("pylint --help", br"Usage:  pylint", True)
+return matchoutput("pylint --help", br"Usage:[ ]+pylint", True)
 
 
 @check("clang-format", "clang-format C code formatter")



To: mharbison72, #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


D9430: formating: upgrade to black 20.8b1

2020-11-27 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: indygreg.
Herald added a reviewer: martinvonz.
Herald added a reviewer: martinvonz.
Herald added subscribers: mercurial-patches, Kwan.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This required a couple of small tweaks to un-confuse black, but now it
  works. Big formatting changes come from:
  
  - Dramatically improved collection-splitting logic upstream
  - Black having a strong (correct IMO) opinion that """ is better than '''

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  contrib/automation/hgautomation/aws.py
  contrib/automation/hgautomation/cli.py
  contrib/automation/hgautomation/windows.py
  contrib/byteify-strings.py
  contrib/check-code.py
  contrib/packaging/hgpackaging/cli.py
  contrib/packaging/hgpackaging/inno.py
  contrib/packaging/hgpackaging/wix.py
  contrib/perf.py
  contrib/python-hook-examples.py
  contrib/python-zstandard/make_cffi.py
  contrib/python3-ratchet.py
  contrib/synthrepo.py
  contrib/testparseutil.py
  doc/hgmanpage.py
  hgext/acl.py
  hgext/automv.py
  hgext/blackbox.py
  hgext/bugzilla.py
  hgext/churn.py
  hgext/convert/__init__.py
  hgext/convert/bzr.py
  hgext/convert/common.py
  hgext/convert/convcmd.py
  hgext/convert/cvsps.py
  hgext/convert/filemap.py
  hgext/eol.py
  hgext/extdiff.py
  hgext/factotum.py
  hgext/fetch.py
  hgext/fix.py
  hgext/fsmonitor/__init__.py
  hgext/fsmonitor/pywatchman/__init__.py
  hgext/fsmonitor/pywatchman/capabilities.py
  hgext/git/__init__.py
  hgext/git/manifest.py
  hgext/githelp.py
  hgext/gpg.py
  hgext/hgk.py
  hgext/histedit.py
  hgext/hooklib/changeset_obsoleted.py
  hgext/hooklib/changeset_published.py
  hgext/infinitepush/__init__.py
  hgext/infinitepush/bundleparts.py
  hgext/infinitepush/indexapi.py
  hgext/infinitepush/sqlindexapi.py
  hgext/keyword.py
  hgext/largefiles/__init__.py
  hgext/largefiles/basestore.py
  hgext/largefiles/lfcommands.py
  hgext/largefiles/lfutil.py
  hgext/largefiles/localstore.py
  hgext/largefiles/overrides.py
  hgext/largefiles/proto.py
  hgext/largefiles/remotestore.py
  hgext/largefiles/reposetup.py
  hgext/largefiles/wirestore.py
  hgext/lfs/__init__.py
  hgext/lfs/blobstore.py
  hgext/lfs/wrapper.py
  hgext/mq.py
  hgext/narrow/narrowbundle2.py
  hgext/narrow/narrowwirepeer.py
  hgext/notify.py
  hgext/pager.py
  hgext/patchbomb.py
  hgext/phabricator.py
  hgext/purge.py
  hgext/rebase.py
  hgext/record.py
  hgext/remotefilelog/__init__.py
  hgext/remotefilelog/basestore.py
  hgext/remotefilelog/contentstore.py
  hgext/remotefilelog/fileserverclient.py
  hgext/remotefilelog/remotefilectx.py
  hgext/remotefilelog/remotefilelogserver.py
  hgext/remotefilelog/repack.py
  hgext/remotefilelog/shallowrepo.py
  hgext/remotenames.py
  hgext/schemes.py
  hgext/share.py
  hgext/transplant.py
  hgext/uncommit.py
  hgext/win32mbcs.py
  hgext/win32text.py
  i18n/check-translation.py
  mercurial/ancestor.py
  mercurial/archival.py
  mercurial/bookmarks.py
  mercurial/branchmap.py
  mercurial/bundle2.py
  mercurial/bundlerepo.py
  mercurial/changelog.py
  mercurial/cmdutil.py
  mercurial/commands.py
  mercurial/commandserver.py
  mercurial/commit.py
  mercurial/config.py
  mercurial/configitems.py
  mercurial/context.py
  mercurial/copies.py
  mercurial/crecord.py
  mercurial/dagop.py
  mercurial/dagparser.py
  mercurial/debugcommands.py
  mercurial/diffutil.py
  mercurial/dirstate.py
  mercurial/dirstateguard.py
  mercurial/discovery.py
  mercurial/dispatch.py
  mercurial/encoding.py
  mercurial/error.py
  mercurial/exchange.py
  mercurial/exchangev2.py
  mercurial/extensions.py
  mercurial/filemerge.py
  mercurial/fileset.py
  mercurial/help.py
  mercurial/hg.py
  mercurial/hgweb/__init__.py
  mercurial/hgweb/common.py
  mercurial/hgweb/hgweb_mod.py
  mercurial/hgweb/request.py
  mercurial/hgweb/webutil.py
  mercurial/hook.py
  mercurial/httppeer.py
  mercurial/interfaces/dirstate.py
  mercurial/interfaces/repository.py
  mercurial/keepalive.py
  mercurial/localrepo.py
  mercurial/lock.py
  mercurial/logcmdutil.py
  mercurial/logexchange.py
  mercurial/mail.py
  mercurial/manifest.py
  mercurial/match.py
  mercurial/mdiff.py
  mercurial/merge.py
  mercurial/mergestate.py
  mercurial/metadata.py
  mercurial/minirst.py
  mercurial/narrowspec.py
  mercurial/obsolete.py
  mercurial/obsutil.py
  mercurial/parser.py
  mercurial/patch.py
  mercurial/pathutil.py
  mercurial/posix.py
  mercurial/progress.py
  mercurial/pure/charencode.py
  mercurial/pure/mpatch.py
  mercurial/pure/osutil.py
  mercurial/pure/parsers.py
  mercurial/rcutil.py
  mercurial/registrar.py
  mercurial/repoview.py
  mercurial/revlog.py
  mercurial/revlogutils/nodemap.py
  mercurial/revset.py
  mercurial/revsetlang.py
  mercurial/scmutil.py
  mercurial/setdiscovery.py
  mercurial/shelve.py
  mercurial/similar.py
  mercurial/simplemerge.py
  mercurial/sshpeer.py
  mercurial/sslutil.py
  

D9428: merge: remove spurious ' and trailing whitespace from triple-quoted string

2020-11-27 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -544,10 +544,10 @@
 
 
 class mergeresult(object):
-An object representing result of merging manifests.
+'''An object representing result of merging manifests.
 
 It has information about what actions need to be performed on dirstate
-mapping of divergent renames and other such cases. '''
+mapping of divergent renames and other such cases.'''
 
 def __init__(self):
 """



To: durin42, #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


D9429: osutil: reformat triple-quoted string so black doesn't confuse itself

2020-11-27 Thread durin42 (Augie Fackler)
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/pure/osutil.py

CHANGE DETAILS

diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py
+++ b/mercurial/pure/osutil.py
@@ -293,7 +293,8 @@
 '''mimics the read-only attributes of Python file objects
 by raising 'TypeError: readonly attribute' if someone tries:
   f = posixfile('foo.txt')
-  f.name = 'bla'  '''
+  f.name = 'bla'
+'''
 return self._file.__setattr__(name, value)
 
 def __enter__(self):



To: durin42, #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


D9427: cleanup: fix a few recent black formatting violations

2020-11-27 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a reviewer: durin42.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/git/gitlog.py
  setup.py

CHANGE DETAILS

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -816,8 +816,7 @@
 if sys.version_info[0] >= 3:
 fsdecode = os.fsdecode
 dest = os.path.join(
-os.path.dirname(self.hgtarget),
-fsdecode(dllbasename),
+os.path.dirname(self.hgtarget), fsdecode(dllbasename),
 )
 
 if not os.path.exists(dest):
diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py
--- a/hgext/git/gitlog.py
+++ b/hgext/git/gitlog.py
@@ -150,9 +150,7 @@
 
 def tiprev(self):
 t = self._db.execute(
-'SELECT rev FROM changelog '
-'ORDER BY REV DESC '
-'LIMIT 1'
+'SELECT rev FROM changelog ' 'ORDER BY REV DESC ' 'LIMIT 1'
 )
 return next(t)
 



To: mharbison72, durin42, #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


[Bug 6445] New: hg log command taking 115 seconds with large added css file

2020-11-27 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6445

Bug ID: 6445
   Summary: hg log command taking 115 seconds with large added css
file
   Product: Mercurial
   Version: stable branch
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: petersanc...@gmail.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

hg version 5.6+8-81da6feb5000

We're adding a large css file (281k lines) to an existing project. It was added
in a feature branch. Trying to run a log command, with preview, etc. on the
specific revision where the file was added to the repo takes over 100 seconds.

Other team members with hg versions 5.6 (installed via pip) and 5.2.1 do not
have this issue.

The revision included small changes to about 5-6 other text files (.py, .js,
etc.)

I stepped through each file one by one and only the large css file had this
issue.

Below is the profile data and debug install:


hg log -r 269 hyfm/static/css/tailwind.css -p --profile
...

| 100.0% 163.48s  dispatch.py:run  line 43:  dispatch.run()
| 100.0% 163.48s  dispatch.py:dispatch line 113:  status =
dispatch(req)
| 100.0% 163.48s  dispatch.py:_runcatchline 303:  ret =
_runcatch(req) or 0
| 100.0% 163.48s  dispatch.py:_callcatch   line 479:  return
_callcatch(ui, _runc...
| 100.0% 163.48s  scmutil.py: callcatchline 488:  return
scmutil.callcatch(ui...
| 100.0% 163.48s  dispatch.py:_runcatchfuncline 153:  return func()
| 100.0% 163.48s  dispatch.py:_dispatchline 469:  return
_dispatch(req)
| 100.0% 163.47s  dispatch.py:runcommand   line 1232:  return
runcommand(
| 100.0% 163.47s  pager.py:   pagecmd  line 917:  ret =
_runcommand(ui, optio...
| 100.0% 163.46s  dispatch.py:_runcommand  line 76:  return orig(ui,
options, cm...
| 100.0% 163.46s  dispatch.py: line 1244:  return cmdfunc()
| 100.0% 163.46s  util.py:checkline 1230:  d = lambda:
util.checksigna...
| 100.0% 163.46s  commands.py:log  line 1867:  return
func(*args, **kwargs)
| 100.0% 163.45s  logcmdutil.py:  displayrevs  line 4609:  displayfn(ui,
repo, revs, d...
 \ 64.9% 106.07s  logcmdutil.py:  show line 1191: 
displayer.show(ctx, copies=...
   | 64.9% 106.07s  logcmdutil.py:  _show  line 276:  self._show(ctx,
copies, props)
   | 64.9% 106.07s  logcmdutil.py:  _showpatch line 399: 
self._showpatch(ctx, graphw...
   | 64.9% 106.07s  logcmdutil.py:  showdiff   line 431: 
self._differ.showdiff(
   | 64.9% 106.07s  logcmdutil.py:  diffordiffstat line 215:  diffordiffstat(
   | 64.9% 106.07s  util.py:filechunkiter  line 173:  for chunk in
util.filechunk...
   | 64.9% 106.07s  util.py:read   line 2695:  s = nbytes and
f.read(nbytes)
   | 64.8% 105.92s  util.py:splitbig   line 2635:  for chunk in
self.iter:
   | 64.8% 105.87s  logcmdutil.py:  genline 2606:  for chunk in
chunks:
   | 63.8% 104.30s  patch.py:   difflabel  line 170:  for chunk, label
in chunks:
   | 63.6% 104.03s  patch.py:   consumehunkbufferline 2863:  for token in
consumehunkbuf...
   | 63.6% 104.01s  patch.py:   diffsinglehunkinlineline 2832:  for token
in dodiffhunk(hun...
 \ 35.1% 57.38s  logcmdutil.py:  flush line 1192: 
displayer.flush(ctx)
   | 35.1% 57.38s  ui.py:  write   line 265: 
self.ui.write(self.hunk[rev])
   | 35.1% 57.38s  procutil.py:write   line 1158:  dest.write(msg)
---
Sample count: 59297
Total time: 115.96 seconds (163.48 wall)

(e250a06) pjs:thinkpad ~/development/hyfm $ hg debuginstall
checking encoding (UTF-8)...
checking Python executable (/usr/bin/python)
checking Python implementation (CPython)
checking Python version (3.8.5)
checking Python lib (/usr/lib/python3.8)...
checking Python security support (sni,tls1.0,tls1.1,tls1.2)
checking Rust extensions (missing)
checking Mercurial version (5.6)
checking Mercurial custom build (8-81da6feb5000)
checking module policy (c)
checking installed modules
(/usr/local/lib/python3.8/dist-packages/mercurial)...
checking registered compression engines (bz2, bz2truncated, none, zlib, zstd)
checking available compression engines (bz2, bz2truncated, none, zlib, zstd)
checking available compression engines for wire protocol (zstd, zlib, bz2,
none)
checking "re2" regexp engine (missing)
checking templates
(/usr/local/lib/python3.8/dist-packages/mercurial/templates)...
checking default template
(/usr/local/lib/python3.8/dist-packages/mercurial/templates/map-cmdline.default)
checking commit editor... (vim)
checking username (Peter Sanchez )
no problems detected

-- 
You are receiving this mail because:
You are on the CC list for the 

[Bug 6444] New: `hg fix -w` raises a TypeError on py3(.8)

2020-11-27 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6444

Bug ID: 6444
   Summary: `hg fix -w` raises a TypeError on py3(.8)
   Product: Mercurial
   Version: 5.5rc0
  Hardware: All
OS: All
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: matt_harbi...@yahoo.com
CC: mercurial-devel@mercurial-scm.org
Python Version: ---

This was in WSL, Ubuntu 18.04.

$ hg fix -w
** Unknown exception encountered with possibly-broken third-party extension
mercurial_keyring
** which supports versions unknown of Mercurial.
** Please disable mercurial_keyring and try your action again.
** If that fixes the bug please report it to
https://foss.heptapod.net/mercurial/mercurial_keyring/issues
** Python 3.8.0 (default, Oct 28 2019, 16:14:01) [GCC 8.3.0]
** Mercurial Distributed SCM (version 5.6)
** Extensions loaded: extdiff, evolve, topic, phabricator, rebase, absorb,
strip, show, blackbox, phabblocker, mercurial_keyring, fix, mq
Traceback (most recent call last):
  File "/home/mharbison/.local/bin/hg", line 43, in 
dispatch.run()
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/dispatch.py",
line 113, in run
status = dispatch(req)
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/dispatch.py",
line 303, in dispatch
ret = _runcatch(req) or 0
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/dispatch.py",
line 479, in _runcatch
return _callcatch(ui, _runcatchfunc)
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/dispatch.py",
line 488, in _callcatch
return scmutil.callcatch(ui, func)
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/scmutil.py", line
153, in callcatch
return func()
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/dispatch.py",
line 469, in _runcatchfunc
return _dispatch(req)
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/dispatch.py",
line 1232, in _dispatch
return runcommand(
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/dispatch.py",
line 917, in runcommand
ret = _runcommand(ui, options, cmd, d)
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/dispatch.py",
line 1244, in _runcommand
return cmdfunc()
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/dispatch.py",
line 1230, in 
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  File "/home/mharbison/.local/lib/python3.8/site-packages/mercurial/util.py",
line 1867, in check
return func(*args, **kwargs)
  File "/home/mharbison/.local/lib/python3.8/site-packages/mercurial/util.py",
line 1867, in check
return func(*args, **kwargs)
  File "/home/mharbison/.local/lib/python3.8/site-packages/hgext/mq.py", line
4222, in mqcommand
return orig(ui, repo, *args, **kwargs)
  File "/home/mharbison/.local/lib/python3.8/site-packages/mercurial/util.py",
line 1867, in check
return func(*args, **kwargs)
  File "/home/mharbison/.local/lib/python3.8/site-packages/hgext/fix.py", line
315, in fix
for rev, path, filerevmetadata, newdata in results:
  File
"/home/mharbison/.local/lib/python3.8/site-packages/mercurial/worker.py", line
282, in _posixworker
res = util.pickle.load(_blockingreader(key.fileobj))
TypeError: file must have 'read', 'readinto' and 'readline' attributes

-- 
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


D9426: copies-rust: hide most of the comparison details inside a closure

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The function that compares values needs various supporting elements that are
  the same for each call. We are about to both make change to these element and
  change to call sites in our upcoming work. So abstracting most of the details
  will help to avoid conflict while these works happen in parallel.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/copy_tracing.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs
--- a/rust/hg-core/src/copy_tracing.rs
+++ b/rust/hg-core/src/copy_tracing.rs
@@ -496,6 +496,15 @@
 changes: ,
 oracle:  AncestorOracle,
 ) -> TimeStampedPathCopies {
+// This closure exist as temporary help while multiple developper are
+// actively working on this code. Feel free to re-inline it once this
+// code is more settled.
+let mut cmp_value =
+|dest: ,
+ src_minor: ,
+ src_major: | {
+compare_value(changes, oracle, dest, src_minor, src_major)
+};
 if minor.is_empty() {
 major
 } else if major.is_empty() {
@@ -532,9 +541,7 @@
 DiffItem::Update { old, new } => {
 let (dest, src_major) = new;
 let (_, src_minor) = old;
-match compare_value(
-changes, oracle, dest, src_minor, src_major,
-) {
+match cmp_value(dest, src_minor, src_major) {
 MergePick::Major => to_minor(dest, src_major),
 MergePick::Minor => to_major(dest, src_minor),
 // If the two entry are identical, no need to do



To: Alphare, #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


D9425: copies-rust: move the mapping merging into a else clause

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We are going to add more cases, to it is time to stop using early returns and 
to
  move everything in a single if/elif/else block for clarity.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/copy_tracing.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs
--- a/rust/hg-core/src/copy_tracing.rs
+++ b/rust/hg-core/src/copy_tracing.rs
@@ -497,73 +497,74 @@
 oracle:  AncestorOracle,
 ) -> TimeStampedPathCopies {
 if minor.is_empty() {
-return major;
+major
 } else if major.is_empty() {
-return minor;
-}
-let mut override_minor = Vec::new();
-let mut override_major = Vec::new();
+minor
+} else {
+let mut override_minor = Vec::new();
+let mut override_major = Vec::new();
 
-let mut to_major = |k: , v: | {
-override_major.push((k.clone(), v.clone()))
-};
-let mut to_minor = |k: , v: | {
-override_minor.push((k.clone(), v.clone()))
-};
+let mut to_major = |k: , v: | {
+override_major.push((k.clone(), v.clone()))
+};
+let mut to_minor = |k: , v: | {
+override_minor.push((k.clone(), v.clone()))
+};
 
-// The diff function leverage detection of the identical subpart if minor
-// and major has some common ancestors. This make it very fast is most
-// case.
-//
-// In case where the two map are vastly different in size, the current
-// approach is still slowish because the iteration will iterate over
-// all the "exclusive" content of the larger on. This situation can be
-// frequent when the subgraph of revision we are processing has a lot
-// of roots. Each roots adding they own fully new map to the mix (and
-// likely a small map, if the path from the root to the "main path" is
-// small.
-//
-// We could do better by detecting such situation and processing them
-// differently.
-for d in minor.diff() {
-match d {
-DiffItem::Add(k, v) => to_minor(k, v),
-DiffItem::Remove(k, v) => to_major(k, v),
-DiffItem::Update { old, new } => {
-let (dest, src_major) = new;
-let (_, src_minor) = old;
-match compare_value(
-changes, oracle, dest, src_minor, src_major,
-) {
-MergePick::Major => to_minor(dest, src_major),
-MergePick::Minor => to_major(dest, src_minor),
-// If the two entry are identical, no need to do
-// anything (but diff should not have yield them)
-MergePick::Any => unreachable!(),
+// The diff function leverage detection of the identical subpart if
+// minor and major has some common ancestors. This make it very
+// fast is most case.
+//
+// In case where the two map are vastly different in size, the current
+// approach is still slowish because the iteration will iterate over
+// all the "exclusive" content of the larger on. This situation can be
+// frequent when the subgraph of revision we are processing has a lot
+// of roots. Each roots adding they own fully new map to the mix (and
+// likely a small map, if the path from the root to the "main path" is
+// small.
+//
+// We could do better by detecting such situation and processing them
+// differently.
+for d in minor.diff() {
+match d {
+DiffItem::Add(k, v) => to_minor(k, v),
+DiffItem::Remove(k, v) => to_major(k, v),
+DiffItem::Update { old, new } => {
+let (dest, src_major) = new;
+let (_, src_minor) = old;
+match compare_value(
+changes, oracle, dest, src_minor, src_major,
+) {
+MergePick::Major => to_minor(dest, src_major),
+MergePick::Minor => to_major(dest, src_minor),
+// If the two entry are identical, no need to do
+// anything (but diff should not have yield them)
+MergePick::Any => unreachable!(),
+}
 }
-}
-};
-}
+};
+}
 
-let updates;
-let mut result;
-if override_major.is_empty() {
-result = major
-} else if override_minor.is_empty() {
-result = minor
-} else {
-if override_minor.len() < override_major.len() {
-updates = override_minor;
-result = minor;
+let updates;
+

D9422: copies: iterate over children directly (instead of parents)

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Before this change we would gather all parent → child edges and iterate on
  all parent, gathering copy information for children and aggregating them from
  there.
  
  They are not strict requirement for edges to be processed in that specific
  order. We could also simply iterate over all "children" revision and aggregate
  data from both parents at the same time. This patch does that.
  
  It make various things simpler:
  
  - since both parents are processed at the same time, we no longer need to 
cache data for merge (see next changeset for details),
  - we no longer need nested loop to process data,
  - we no longer need to store partial merge data for a rev from distinct loop 
interaction to another when processing merges,
  - we no longer need to build a full parent -> children mapping (we only rely 
on a simpler "parent -> number of children" map (for memory efficiency),
  - the data access pattern is now simpler (from lower revisions to higher 
revisions) and entirely predicable. That predictability open the way to 
prefetching and parallel processing.
  
  So that new iterations order requires simpler code and open the way to
  interesting optimisation.
  
  The effect on performance is quite good. In the worse case, we don't see any
  significant negative impact. And in the best case, the reduction of roundtrip
  to Python provide us with a significant speed. Some example below:
  
  RepoCase  Source-Rev   Dest-Rev   
   # of revisions  old timenew time  DifferenceFactortime per 
rev
  
---
  
  mozilla-try x0_revs_x0_added_0_copies dc8a3ca7010e 
d16fde900c9c :  34414 revs,   0.962867 s,   0.502584 s,  -0.460283 s, × 0.5220, 
   14 µs/rev
  mozilla-try x_revs_xx000_added_x_copies   156f6e2674f2 
4d0f2c178e66 :   8598 revs,   0.110717 s,   0.076323 s,  -0.034394 s, × 0.6894, 
8 µs/rev
  
  full comparison between the previous changeset and this one
  ===
  
  RepoCase  Source-Rev   Dest-Rev   
   # of revisions  old timenew time  DifferenceFactortime per 
rev
  
---
  
  mercurial   x_revs_x_added_0_copies   ad6b123de1c7 
 
39cfcef4f463 
 :  
1 revs,   0.48 s,   0.41 s,  -0.07 s, × 0.8542,41 µs/rev
  mercurial   x_revs_x_added_x_copies   2b1c78674230 
 
0c1d10351869 
 :  
6 revs,   0.000153 s,   0.000102 s,  -0.51 s, × 0.6667,17 µs/rev
  mercurial   x000_revs_x000_added_x_copies 81f8ff2a9bf2 
 
dd3267698d84 
 :  
 1032 revs,   0.004209 s,   0.004254 s,  +0.45 s, × 1.0107, 4 µs/rev
  pypyx_revs_x_added_0_copies   aed021ee8ae8 
099ed31b181b :  9 revs,   0.000203 s,   0.000282 s,  +0.79 s, × 1.3892, 
   31 µs/rev
  pypyx_revs_x000_added_0_copies4aa4e1f8e19a 
359343b9ac0e :  1 revs,   0.59 s,   0.48 s,  -0.11 s, × 0.8136, 
   48 µs/rev
  pypyx_revs_x_added_x_copies   ac52eb70 
72e022663155 :  7 revs,   0.000194 s,   0.000211 s,  +0.17 s, × 1.0876, 
   30 µs/rev
  pypyx_revs_x00_added_x_copies c3b14617fbd7 
ace7255d9a26 :  1 revs,   0.000380 s,   0.000375 s,  -0.05 s, × 0.9868, 
  375 µs/rev
  pypyx_revs_x000_added_x000_copies df6f7a526b60 
a83dc6a2d56f :  6 revs,   0.010588 s,   0.010574 s,  -0.14 s, × 0.9987, 
 1762 µs/rev
  pypyx000_revs_xx00_added_0_copies 89a76aede314 
2f22446ff07e :   4785 revs,   0.048961 s,   0.049974 s,  +0.001013 s, × 1.0207, 
   10 µs/rev
  pypyx000_revs_x000_added_x_copies 8a3b5bfd266e 
2c68e87c3efe :   6780 revs,   0.083612 s,   0.084300 s,  +0.000688 s, × 1.0082, 
   12 µs/rev
  pypyx000_revs_x000_added_x000_copies  89a76aede314 
7b3dda341c84 :   5441 revs,   0.058579 s,   0.060128 s,  +0.001549 s, × 1.0264, 
   11 µs/rev
  pypyx_revs_x_added_0_copies   

D9424: copies-rust: extract conflicting value comparison in its own function

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  First, that logic is complicated enough to be in it own function. Second, we
  want to start adding alternative path within the merge code so we need this 
logic
  easily accessible in multiple places.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/copy_tracing.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs
--- a/rust/hg-core/src/copy_tracing.rs
+++ b/rust/hg-core/src/copy_tracing.rs
@@ -490,7 +490,6 @@
 ///
 /// In case of conflict, value from "major" will be picked, unless in some
 /// cases. See inline documentation for details.
-#[allow(clippy::if_same_then_else)]
 fn merge_copies_dict bool>(
 minor: TimeStampedPathCopies,
 major: TimeStampedPathCopies,
@@ -533,67 +532,14 @@
 DiffItem::Update { old, new } => {
 let (dest, src_major) = new;
 let (_, src_minor) = old;
-let mut pick_minor = || (to_major(dest, src_minor));
-let mut pick_major = || (to_minor(dest, src_major));
-if src_major.path == src_minor.path {
-// we have the same value, but from other source;
-if src_major.rev == src_minor.rev {
-// If the two entry are identical, no need to do
-// anything (but diff should not have yield them)
-unreachable!();
-} else if oracle.is_ancestor(src_major.rev, src_minor.rev)
-{
-pick_minor();
-} else {
-pick_major();
-}
-} else if src_major.rev == src_minor.rev {
-// We cannot get copy information for both p1 and p2 in the
-// same rev. So this is the same value.
-unreachable!();
-} else {
-let action = changes.get_merge_case();
-if src_major.path.is_none()
-&& action == MergeCase::Salvaged
-{
-// If the file is "deleted" in the major side but was
-// salvaged by the merge, we keep the minor side alive
-pick_minor();
-} else if src_minor.path.is_none()
-&& action == MergeCase::Salvaged
-{
-// If the file is "deleted" in the minor side but was
-// salvaged by the merge, unconditionnaly preserve the
-// major side.
-pick_major();
-} else if action == MergeCase::Merged {
-// If the file was actively merged, copy information
-// from each side might conflict.  The major side will
-// win such conflict.
-pick_major();
-} else if oracle.is_ancestor(src_major.rev, src_minor.rev)
-{
-// If the minor side is strictly newer than the major
-// side, it should be kept.
-pick_minor();
-} else if src_major.path.is_some() {
-// without any special case, the "major" value win
-// other the "minor" one.
-pick_major();
-} else if oracle.is_ancestor(src_minor.rev, src_major.rev)
-{
-// the "major" rev is a direct ancestors of "minor",
-// any different value should
-// overwrite
-pick_major();
-} else {
-// major version is None (so the file was deleted on
-// that branch) and that branch is independant (neither
-// minor nor major is an ancestors of the other one.)
-// We preserve the new
-// information about the new file.
-pick_minor();
-}
+match compare_value(
+changes, oracle, dest, src_minor, src_major,
+) {
+MergePick::Major => to_minor(dest, src_major),
+MergePick::Minor => to_major(dest, src_minor),
+// If the two entry are identical, no need to do
+// anything (but diff should not have yield them)
+MergePick::Any => unreachable!(),
 }
 }
 };
@@ -619,3 +565,77 @@
 }
 result
 }
+
+/// 

D9423: copies: no longer cache the ChangedFiles during copy tracing

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Now that the copies information for both parents are processed all at once, we
  no longer needs to cache this information, so we simplify the code.
  
  The simpler code is also a (tiny) bit faster overall.
  
  RepoCase  Source-Rev   Dest-Rev   
   # of revisions  old timenew time  DifferenceFactortime per 
rev
  
---
  
  mercurial   x_revs_x_added_0_copies   ad6b123de1c7 
 
39cfcef4f463 
 :  
1 revs,   0.41 s,   0.41 s,  +0.00 s, × 1.,41 µs/rev
  mercurial   x_revs_x_added_x_copies   2b1c78674230 
 
0c1d10351869 
 :  
6 revs,   0.000102 s,   0.96 s,  -0.06 s, × 0.9412,16 µs/rev
  mercurial   x000_revs_x000_added_x_copies 81f8ff2a9bf2 
 
dd3267698d84 
 :  
 1032 revs,   0.004254 s,   0.004039 s,  -0.000215 s, × 0.9495, 3 µs/rev
  pypyx_revs_x_added_0_copies   aed021ee8ae8 
099ed31b181b :  9 revs,   0.000282 s,   0.000189 s,  -0.93 s, × 0.6702, 
   21 µs/rev
  pypyx_revs_x000_added_0_copies4aa4e1f8e19a 
359343b9ac0e :  1 revs,   0.48 s,   0.47 s,  -0.01 s, × 0.9792, 
   47 µs/rev
  pypyx_revs_x_added_x_copies   ac52eb70 
72e022663155 :  7 revs,   0.000211 s,   0.000103 s,  -0.000108 s, × 0.4882, 
   14 µs/rev
  pypyx_revs_x00_added_x_copies c3b14617fbd7 
ace7255d9a26 :  1 revs,   0.000375 s,   0.000286 s,  -0.89 s, × 0.7627, 
  286 µs/rev
  pypyx_revs_x000_added_x000_copies df6f7a526b60 
a83dc6a2d56f :  6 revs,   0.010574 s,   0.010436 s,  -0.000138 s, × 0.9869, 
 1739 µs/rev
  pypyx000_revs_xx00_added_0_copies 89a76aede314 
2f22446ff07e :   4785 revs,   0.049974 s,   0.047465 s,  -0.002509 s, × 0.9498, 
9 µs/rev
  pypyx000_revs_x000_added_x_copies 8a3b5bfd266e 
2c68e87c3efe :   6780 revs,   0.084300 s,   0.082351 s,  -0.001949 s, × 0.9769, 
   12 µs/rev
  pypyx000_revs_x000_added_x000_copies  89a76aede314 
7b3dda341c84 :   5441 revs,   0.060128 s,   0.058757 s,  -0.001371 s, × 0.9772, 
   10 µs/rev
  pypyx_revs_x_added_0_copies   d1defd0dc478 
c9cb1334cc78 :  43645 revs,   0.686542 s,   0.674129 s,  -0.012413 s, × 0.9819, 
   15 µs/rev
  pypyx_revs_xx000_added_0_copies   bf2c629d0071 
4ffed77c095c :  2 revs,   0.009277 s,   0.009434 s,  +0.000157 s, × 1.0169, 
 4717 µs/rev
  pypyx_revs_xx000_added_x000_copies08ea3258278e 
d9fa043f30c0 :  11316 revs,   0.114733 s,   0.111935 s,  -0.002798 s, × 0.9756, 
9 µs/rev
  netbeansx_revs_x_added_0_copies   fb0955ffcbcd 
a01e9239f9e7 :  2 revs,   0.81 s,   0.78 s,  -0.03 s, × 0.9630, 
   39 µs/rev
  netbeansx_revs_x000_added_0_copies6f360122949f 
20eb231cc7d0 :  2 revs,   0.000107 s,   0.000106 s,  -0.01 s, × 0.9907, 
   53 µs/rev
  netbeansx_revs_x_added_x_copies   1ada3faf6fb6 
5a39d12eecf4 :  3 revs,   0.000173 s,   0.000162 s,  -0.11 s, × 0.9364, 
   54 µs/rev
  netbeansx_revs_x00_added_x_copies 35be93ba1e2c 
9eec5e90c05f :  9 revs,   0.000698 s,   0.000695 s,  -0.03 s, × 0.9957, 
   77 µs/rev
  netbeansx000_revs_xx00_added_0_copies eac3045b4fdd 
51d4ae7f1290 :   1421 revs,   0.009248 s,   0.008901 s,  -0.000347 s, × 0.9625, 
6 µs/rev
  netbeansx000_revs_x000_added_x_copies e2063d266acd 
6081d72689dc :   1533 revs,   0.015446 s,   0.014333 s,  -0.001113 s, × 0.9279, 
9 µs/rev
  netbeansx000_revs_x000_added_x000_copies  ff453e9fee32 
411350406ec2 :   5750 revs,   0.074373 s,   0.071998 s,  -0.002375 s, × 0.9681, 
   12 µs/rev
  netbeansx_revs_xx000_added_x000_copies588c2d1ced70 
1aad62e59ddd :  66949 revs,   0.639870 s,   0.615346 s,  -0.024524 s, × 0.9617, 
9 µs/rev
  mozilla-central x_revs_x_added_0_copies   3697f962bb7b 
7015fcdd43a2 :  2 revs,   0.88 s,   0.85 s,  -0.03 s, × 0.9659, 
   42 µs/rev
  mozilla-central x_revs_x000_added_0_copiesdd390860c6c9 

D9421: copies-rust: extract the processing of a ChangedFiles in its own function

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is a reasonably independent piece of code that we can extract in its own
  function. This extraction will be very useful for the next changeset, where we
  will change the iteration order (but still do the same kind of processing).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/copy_tracing.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs
--- a/rust/hg-core/src/copy_tracing.rs
+++ b/rust/hg-core/src/copy_tracing.rs
@@ -360,46 +360,8 @@
 assert_eq!(rev, p2);
 Parent::SecondParent
 };
-let mut new_copies = copies.clone();
-
-for action in changes.iter_actions(parent) {
-match action {
-Action::Copied(dest, source) => {
-let entry;
-if let Some(v) = copies.get(source) {
-entry = match  {
-Some(path) => Some((*(path)).to_owned()),
-None => Some(source.to_owned()),
-}
-} else {
-entry = Some(source.to_owned());
-}
-// Each new entry is introduced by the children, we
-// record this information as we will need it to take
-// the right decision when merging conflicting copy
-// information. See merge_copies_dict for details.
-let ttpc = TimeStampedPathCopy {
-rev: *child,
-path: entry,
-};
-new_copies.insert(dest.to_owned(), ttpc);
-}
-Action::Removed(f) => {
-// We must drop copy information for removed file.
-//
-// We need to explicitly record them as dropped to
-// propagate this information when merging two
-// TimeStampedPathCopies object.
-if new_copies.contains_key(f.as_ref()) {
-let ttpc = TimeStampedPathCopy {
-rev: *child,
-path: None,
-};
-new_copies.insert(f.to_owned(), ttpc);
-}
-}
-}
-}
+let new_copies =
+add_from_changes(, , parent, *child);
 
 // Merge has two parents needs to combines their copy information.
 //
@@ -441,6 +403,56 @@
 result
 }
 
+/// Combine ChangedFiles with some existing PathCopies information and return
+/// the result
+fn add_from_changes(
+base_copies: ,
+changes: ,
+parent: Parent,
+current_rev: Revision,
+) -> TimeStampedPathCopies {
+let mut copies = base_copies.clone();
+for action in changes.iter_actions(parent) {
+match action {
+Action::Copied(dest, source) => {
+let entry;
+if let Some(v) = base_copies.get(source) {
+entry = match  {
+Some(path) => Some((*(path)).to_owned()),
+None => Some(source.to_owned()),
+}
+} else {
+entry = Some(source.to_owned());
+}
+// Each new entry is introduced by the children, we
+// record this information as we will need it to take
+// the right decision when merging conflicting copy
+// information. See merge_copies_dict for details.
+let ttpc = TimeStampedPathCopy {
+rev: current_rev,
+path: entry,
+};
+copies.insert(dest.to_owned(), ttpc);
+}
+Action::Removed(f) => {
+// We must drop copy information for removed file.
+//
+// We need to explicitly record them as dropped to
+// propagate this information when merging two
+// TimeStampedPathCopies object.
+if copies.contains_key(f.as_ref()) {
+let ttpc = TimeStampedPathCopy {
+rev: current_rev,
+path: None,
+};
+copies.insert(f.to_owned(), ttpc);
+}
+}
+}
+}
+copies
+}
+
 /// merge two copies-mapping together, minor and major
 ///
 /// In case of conflict, value 

D9420: copies-rust: move the parent token to an enum

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We carry around information about which parent of a revision is been dealt
  with. So far this was a `usize` but as we are about to pass it around to more
  function it seems like a good idea to start cleaning this up and use a proper
  enum.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  rust/hg-core/src/copy_tracing.rs

CHANGE DETAILS

diff --git a/rust/hg-core/src/copy_tracing.rs b/rust/hg-core/src/copy_tracing.rs
--- a/rust/hg-core/src/copy_tracing.rs
+++ b/rust/hg-core/src/copy_tracing.rs
@@ -186,7 +186,7 @@
 }
 
 /// Return an iterator over all the `Action` in this instance.
-fn iter_actions(, parent: usize) -> ActionsIterator {
+fn iter_actions(, parent: Parent) -> ActionsIterator {
 ActionsIterator {
 changes: ,
 parent: parent,
@@ -259,7 +259,7 @@
 
 struct ActionsIterator<'a> {
 changes: &'a ChangedFiles<'a>,
-parent: usize,
+parent: Parent,
 current: u32,
 }
 
@@ -267,6 +267,10 @@
 type Item = Action<'a>;
 
 fn next( self) -> Option> {
+let copy_flag = match self.parent {
+Parent::FirstParent => P1_COPY,
+Parent::SecondParent => P2_COPY,
+};
 while self.current < self.changes.nb_items {
 let (flags, file, source) = self.changes.entry(self.current);
 self.current += 1;
@@ -274,10 +278,7 @@
 return Some(Action::Removed(file));
 }
 let copy = flags & COPY_MASK;
-if self.parent == 1 && copy == P1_COPY {
-return Some(Action::Copied(file, source));
-}
-if self.parent == 2 && copy == P2_COPY {
+if copy == copy_flag {
 return Some(Action::Copied(file, source));
 }
 }
@@ -301,6 +302,15 @@
 pub type RevInfoMaker<'a, D> =
 Box Fn(Revision, &'r mut DataHolder) -> RevInfo<'r> + 'a>;
 
+/// enum used to carry information about the parent → child currently processed
+#[derive(Copy, Clone, Debug)]
+enum Parent {
+/// The `p1(x) → x` edge
+FirstParent,
+/// The `p2(x) → x` edge
+SecondParent,
+}
+
 /// Same as mercurial.copies._combine_changeset_copies, but in Rust.
 ///
 /// Arguments are:
@@ -345,10 +355,10 @@
 let (p1, p2, changes) = rev_info(*child,  d);
 
 let parent = if rev == p1 {
-1
+Parent::FirstParent
 } else {
 assert_eq!(rev, p2);
-2
+Parent::SecondParent
 };
 let mut new_copies = copies.clone();
 
@@ -406,9 +416,8 @@
 }
 Some(other_copies) => {
 let (minor, major) = match parent {
-1 => (other_copies, new_copies),
-2 => (new_copies, other_copies),
-_ => unreachable!(),
+Parent::FirstParent => (other_copies, new_copies),
+Parent::SecondParent => (new_copies, other_copies),
 };
 let merged_copies =
 merge_copies_dict(minor, major, ,  oracle);



To: Alphare, #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


D9419: copies: properly copies parent dictionary before updating it

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This enforces the copy on write logic. Otherwise independant unrelated 
branches
  could affected each other.
  
  More testing of these case are coming, but I need that code landed to unlock
  other performance work in parallel.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -405,9 +405,14 @@
 # changeset based copies. It was made without regards with
 # potential filelog related behavior.
 if parent == 1:
+if newcopies is copies:
+newcopies = copies.copy()
 minor, major = othercopies, newcopies
 else:
-minor, major = newcopies, othercopies
+# we do not know if the other dict is a copy or not, so we
+# need to blindly copy it. Future change should make this
+# unnecessary.
+minor, major = newcopies, othercopies.copy()
 copies = _merge_copies_dict(minor, major, isancestor, changes)
 all_copies[c] = copies
 



To: Alphare, #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


D9418: copies: clarify the return of _merge_copies_dict

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I misused that function twice in the past few days, so lets clarify the API.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -408,8 +408,8 @@
 minor, major = othercopies, newcopies
 else:
 minor, major = newcopies, othercopies
-_merge_copies_dict(minor, major, isancestor, changes)
-all_copies[c] = minor
+copies = _merge_copies_dict(minor, major, isancestor, changes)
+all_copies[c] = copies
 
 final_copies = {}
 for dest, (tt, source) in all_copies[targetrev].items():
@@ -428,6 +428,8 @@
 
 - `ismerged(path)`: callable return True if `path` have been merged in the
 current revision,
+
+return the resulting dict (in practice, the "minor" object, updated)
 """
 for dest, value in major.items():
 other = minor.get(dest)
@@ -461,6 +463,7 @@
 minor[dest] = value
 elif isancestor(other_tt, new_tt):
 minor[dest] = value
+return minor
 
 
 def _revinfo_getter_extra(repo):



To: Alphare, #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


D9417: copies: simplify the call to _merge_copies_dict

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Let's get the argument into the right order, then call the function once.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -405,14 +405,11 @@
 # changeset based copies. It was made without regards with
 # potential filelog related behavior.
 if parent == 1:
-_merge_copies_dict(
-othercopies, newcopies, isancestor, changes
-)
+minor, major = othercopies, newcopies
 else:
-_merge_copies_dict(
-newcopies, othercopies, isancestor, changes
-)
-all_copies[c] = newcopies
+minor, major = newcopies, othercopies
+_merge_copies_dict(minor, major, isancestor, changes)
+all_copies[c] = minor
 
 final_copies = {}
 for dest, (tt, source) in all_copies[targetrev].items():



To: Alphare, #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


D9416: copies: avoid unwanted side effect from one branch to another

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Without this copy, change in a one descendant branch (With "remove" change
  only) could affect computation on another descendant branches.
  
  This was not caugh by the test because the test graph are "too simple". I
  started writing more test in that regards, but I a submitting this changes
  earlier because I want to get more code landed to allow other optimisation 
work
  to happens.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -379,7 +379,9 @@
 source = prev[1]
 newcopies[dest] = (c, source)
 assert newcopies is not copies
-if changes is not None:
+if changes is not None and changes.removed:
+if newcopies is copies:
+newcopies = copies.copy()
 for f in changes.removed:
 if f in newcopies:
 if newcopies is copies:



To: Alphare, #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


D9415: copies: fast path no-op merge

2020-11-27 Thread Raphaël Gomès
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If the two sides of the merge are the same (they come an unaltered common
  ancestors) we don't need any merging.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -391,6 +391,9 @@
 othercopies = all_copies.get(c)
 if othercopies is None:
 all_copies[c] = newcopies
+elif newcopies is othercopies:
+# nothing to merge:
+pass
 else:
 # we are the second parent to work on c, we need to merge our
 # work with the other.



To: Alphare, #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


D9414: tests: update test-chg.t with output change

2020-11-27 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Since this part of tests is only run with chg, hence it didn't get updated
  when the error message changed.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-chg.t

CHANGE DETAILS

diff --git a/tests/test-chg.t b/tests/test-chg.t
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -29,7 +29,7 @@
   $ chg status
   $ echo '=brokenconfig' >> $HGRCPATH
   $ chg status
-  hg: parse error at * (glob)
+  config error at * =brokenconfig (glob)
   [255]
 
   $ cp $HGRCPATH.orig $HGRCPATH



To: pulkit, #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


D9413: helptext: document share safe functionality in `hg help config -v`

2020-11-27 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  If share safe functionality is enabled, we read `.hg/hgrc' of shared source.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/helptext/config.txt

CHANGE DETAILS

diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -147,6 +147,15 @@
 merge tool configuration but packagers can also put other default configuration
 there.
 
+.. container:: verbose
+
+On versions 5.7 and later, if share-safe functionality is enabled,
+shares will read config file of share source too.
+`` is read before reading ``.
+
+For configs which should not be shared, ``
+should be used.
+
 Syntax
 ==
 



To: pulkit, #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


D9412: helptext: mention in `hg help config` that `.hg/hgrc-not-shared` is consulted

2020-11-27 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Recently we added `.hg/hgrc-not-shared` which is a config file which won't be
  shared with shares when share-safe mode is enabled. Irrespective of whether
  we are using share-safe or not, we consult this file now.
  
  Let's document that.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/helptext/config.txt

CHANGE DETAILS

diff --git a/mercurial/helptext/config.txt b/mercurial/helptext/config.txt
--- a/mercurial/helptext/config.txt
+++ b/mercurial/helptext/config.txt
@@ -54,6 +54,7 @@
 
   On Unix, the following files are consulted:
 
+  - ``/.hg/hgrc-not-shared`` (per-repository)
   - ``/.hg/hgrc`` (per-repository)
   - ``$HOME/.hgrc`` (per-user)
   - ``${XDG_CONFIG_HOME:-$HOME/.config}/hg/hgrc`` (per-user)
@@ -67,6 +68,7 @@
 
   On Windows, the following files are consulted:
 
+  - ``/.hg/hgrc-not-shared`` (per-repository)
   - ``/.hg/hgrc`` (per-repository)
   - ``%USERPROFILE%\.hgrc`` (per-user)
   - ``%USERPROFILE%\Mercurial.ini`` (per-user)
@@ -89,6 +91,7 @@
 
   On Plan9, the following files are consulted:
 
+  - ``/.hg/hgrc-not-shared`` (per-repository)
   - ``/.hg/hgrc`` (per-repository)
   - ``$home/lib/hgrc`` (per-user)
   - ``/lib/mercurial/hgrc`` (per-installation)



To: pulkit, #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


D9411: share: add documentation about share-safe mode in `hg help -e share`

2020-11-27 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/share.py

CHANGE DETAILS

diff --git a/hgext/share.py b/hgext/share.py
--- a/hgext/share.py
+++ b/hgext/share.py
@@ -44,6 +44,25 @@
 that was cloned before.
 
 The default naming mode is "identity".
+
+.. container:: verbose
+
+Sharing requirements and configs of source repository with shares
+-
+
+By default creating a shared repository only enables sharing a common
+history and does not share requirements and configs between them. This
+may lead to problems in some cases, for example when you upgrade the
+storage format from one repository but does not set related configs
+in the shares.
+
+Setting `format.exp-share-safe = True` enables sharing configs and
+requirements. This only applies to shares which are done after enabling
+the config option.
+For enabling this in existing shares, enable the config option and reshare.
+
+For resharing existing shares, make sure your working directory is clean
+and there are no untracked files, delete that share and create a new share.
 '''
 
 from __future__ import absolute_import



To: pulkit, #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


D9410: helptext: update first hg version when share-safe will be released

2020-11-27 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  I authored the patch which added the helptext before 5.6 release hoping that 
my
  patches will make it. However they didn't before the release and were pushed
  after the release only.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/helptext/internals/requirements.txt

CHANGE DETAILS

diff --git a/mercurial/helptext/internals/requirements.txt 
b/mercurial/helptext/internals/requirements.txt
--- a/mercurial/helptext/internals/requirements.txt
+++ b/mercurial/helptext/internals/requirements.txt
@@ -170,7 +170,7 @@
 in ``.hg/``.
 Shares read the ``.hg/hgrc`` of the source repository.
 
-Support for this requirement was added in Mercurial 5.6 (released
-November 2020). The requirement will only be present on repositories that have
+Support for this requirement was added in Mercurial 5.7 (released
+February 2021). The requirement will only be present on repositories that have
 opted in to this format (by having ``format.exp-share-safe=true`` set when
 they were created).



To: pulkit, #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