[PATCH STABLE] logexchange: convert paths to unix when detecting the active path

2018-10-24 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1540441362 14400
#  Thu Oct 25 00:22:42 2018 -0400
# Branch stable
# Node ID 94c0421d67a06e2ef3c79103c472e2ba9d9d7089
# Parent  5e917b224c20102e755cbd96e467fc3263c6001d
logexchange: convert paths to unix when detecting the active path

This fixes the problem in the tests[1] where Windows was showing the whole path
as the remotename for local repositories.

Somebody with a better understanding of this extension should probably take a
deeper look.  There may be other cases that need to be converted- specifically
the `elif not instance` and the missing `else` cases in activepath().  I also
noticed when adding debug prints that the absolute path is stored in the file,
probably not normalized.  (It's wrapped up in $TESTTMP.)

[1] 
https://buildbot.mercurial-scm.org/builders/Win7%20x86_64%20hg%20tests/builds/1042/steps/run-tests.py%20%28python%202.7.13%29/logs/stdio

diff --git a/mercurial/logexchange.py b/mercurial/logexchange.py
--- a/mercurial/logexchange.py
+++ b/mercurial/logexchange.py
@@ -105,7 +105,7 @@ def activepath(repo, remote):
 # use the string given to us
 rpath = remote
 if local:
-rpath = remote._repo.root
+rpath = util.pconvert(remote._repo.root)
 elif not isinstance(remote, bytes):
 rpath = remote._url
 
@@ -113,6 +113,11 @@ def activepath(repo, remote):
 for path, url in repo.ui.configitems('paths'):
 # remove auth info from user defined url
 noauthurl = util.removeauth(url)
+
+# Standardize on unix style paths, otherwise some {remotenames} end up
+# being an absolute path on Windows.
+url = util.pconvert(bytes(url))
+noauthurl = util.pconvert(noauthurl)
 if url == rpath or noauthurl == rpath:
 rpath = path
 break
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 2 STABLE] help: update the default value specified for `profiling.time-track`

2018-10-24 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1540435248 14400
#  Wed Oct 24 22:40:48 2018 -0400
# Branch stable
# Node ID 5e917b224c20102e755cbd96e467fc3263c6001d
# Parent  89703e6151e72be5f65876dc9f81c90525e13c53
help: update the default value specified for `profiling.time-track`

I tried conditionalizing this in a `.. container::` block, but that seemed to
add an extra blank line between the main text and the parenthetical.

diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -1715,7 +1715,7 @@ statistical text report generated from t
 
 ``time-track``
 Control if the stat profiler track ``cpu`` or ``real`` time.
-(default: ``cpu``)
+(default: ``cpu`` on Windows, otherwise ``real``)
 
 ``limit``
 Number of lines to show. Specific to the ``ls`` instrumenting profiler.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2 STABLE] profiling: revert the default mode back to 'cpu' on Windows

2018-10-24 Thread Matt Harbison
# HG changeset patch
# User Matt Harbison 
# Date 1540434250 14400
#  Wed Oct 24 22:24:10 2018 -0400
# Branch stable
# Node ID 89703e6151e72be5f65876dc9f81c90525e13c53
# Parent  49c7b701fdc2a8659b6f752aef507764d40ed5d0
profiling: revert the default mode back to 'cpu' on Windows

On Windows, os.times() only returns user and system times.  Real elapsed time is
0.  That results in no actual times reported, an end wall time of 0.00, and
seemingly randomly sorted stack frames.  This at least provides test stability
in test-profile.t.

I kind of think that `default=pycompat.iswindows and 'cpu' or 'real'` would be a
better way to set the default in configitems, but I didn't see any other
examples of this, and thought maybe there's a reason for that.  That might allow
plugging the value into the help text automatically- the documented default
wasn't updated in db0dba2d157d.

diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -923,7 +923,7 @@ coreconfigitem('profiling', 'statformat'
 default='hotpath',
 )
 coreconfigitem('profiling', 'time-track',
-default='real',
+default=dynamicdefault,
 )
 coreconfigitem('profiling', 'type',
 default='stat',
diff --git a/mercurial/profiling.py b/mercurial/profiling.py
--- a/mercurial/profiling.py
+++ b/mercurial/profiling.py
@@ -101,7 +101,8 @@ def statprofile(ui, fp):
 else:
 ui.warn(_("invalid sampling frequency '%s' - ignoring\n") % freq)
 
-track = ui.config('profiling', 'time-track')
+track = ui.config('profiling', 'time-track',
+  pycompat.iswindows and 'cpu' or 'real')
 statprof.start(mechanism='thread', track=track)
 
 try:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5187: help: describe what ui.tweakdefaults changes, concretely

2018-10-24 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron added a comment.


  I actually ran the tests, but didn't see the style error, because the test in 
question is among the several ones that never pass for me. Fixed now.

REPOSITORY
  rHG Mercurial

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

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


D5193: remotefilelog: drop compat code for "getbundle_shallow" wireprotocol command

2018-10-24 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Doing some annotate on hgexperimental shows that getbundle_shallow used to 
exist
  in 2013 or before. We don't have any pre-2013 remotefilelog users except Fb
  themselves and I doubt they are going to use in-core remotefilelog. So it's 
safe
  to remove this.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/remotefilelog/remotefilelogserver.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/remotefilelogserver.py 
b/hgext/remotefilelog/remotefilelogserver.py
--- a/hgext/remotefilelog/remotefilelogserver.py
+++ b/hgext/remotefilelog/remotefilelogserver.py
@@ -178,18 +178,6 @@
 
 extensions.wrapfunction(streamclone, '_walkstreamfiles', _walkstreamfiles)
 
-# We no longer use getbundle_shallow commands, but we must still
-# support it for migration purposes
-def getbundleshallow(repo, proto, others):
-bundlecaps = others.get('bundlecaps', '')
-bundlecaps = set(bundlecaps.split(','))
-bundlecaps.add(constants.BUNDLE2_CAPABLITY)
-others['bundlecaps'] = ','.join(bundlecaps)
-
-return wireprotov1server.commands["getbundle"][0](repo, proto, others)
-
-wireprotov1server.commands["getbundle_shallow"] = (getbundleshallow, '*')
-
 # expose remotefilelog capabilities
 def _capabilities(orig, repo, proto):
 caps = orig(repo, proto)



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


Using the rust implementation of lazyancestors.

2018-10-24 Thread Pulkit Goyal
Hi,

Recently Georges did some awesome work on reimplementing the lazyancestors
interator in Rust which was/is in Python originally. The speedups mentioned
in
https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-October/123779.html
are insane.

I was not following the series closely when it was reviewed and also I
don't have much knowledge about rust. Any help on how one can use these
rust implementation will be greatly appreciated.

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


[Bug 6008] New: `hg revert -i` undeletes removed files without being able to stop it

2018-10-24 Thread mercurial-bugs
https://bz.mercurial-scm.org/show_bug.cgi?id=6008

Bug ID: 6008
   Summary: `hg revert -i` undeletes removed files without being
able to stop it
   Product: Mercurial
   Version: 4.7.2
  Hardware: PC
OS: Linux
Status: UNCONFIRMED
  Severity: bug
  Priority: wish
 Component: Mercurial
  Assignee: bugzi...@mercurial-scm.org
  Reporter: martinv...@google.com
CC: mercurial-devel@mercurial-scm.org

For added files, it asks something like "forget added file .testtimes (Yn)?",
so it seems it should ask about adding back removed files as well.

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


D5191: remotefilelogserver: add a matcher argument to _walkstreamfiles()

2018-10-24 Thread pulkit (Pulkit Goyal)
pulkit updated this revision to Diff 12341.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5191?vs=12338=12341

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

AFFECTED FILES
  hgext/remotefilelog/remotefilelogserver.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/remotefilelogserver.py 
b/hgext/remotefilelog/remotefilelogserver.py
--- a/hgext/remotefilelog/remotefilelogserver.py
+++ b/hgext/remotefilelog/remotefilelogserver.py
@@ -129,7 +129,7 @@
 wireprotov1server.commands['stream_out_shallow'] = (stream_out_shallow, 
'*')
 
 # don't clone filelogs to shallow clients
-def _walkstreamfiles(orig, repo):
+def _walkstreamfiles(orig, repo, matcher=None):
 if state.shallowremote:
 # if we are shallow ourselves, stream our local commits
 if shallowutil.isenabled(repo):
@@ -173,7 +173,7 @@
 raise error.Abort(_("Cannot clone from a shallow repo "
 "to a full repo."))
 else:
-for x in orig(repo):
+for x in orig(repo, matcher):
 yield x
 
 extensions.wrapfunction(streamclone, '_walkstreamfiles', _walkstreamfiles)



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


D5187: help: describe what ui.tweakdefaults changes, concretely

2018-10-24 Thread valentin.gatienbaron (Valentin Gatien-Baron)
valentin.gatienbaron updated this revision to Diff 12340.
valentin.gatienbaron edited the summary of this revision.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5187?vs=12331=12340

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

AFFECTED FILES
  mercurial/help.py
  mercurial/help/config.txt

CHANGE DETAILS

diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -2370,6 +2370,10 @@
 effect if ``HGPLAIN`` is set or ``HGPLAINEXCEPT`` is set and does
 not include ``tweakdefaults``. (default: False)
 
+It currently means::
+
+  .. tweakdefaultsmarker
+
 ``username``
 The committer of a changeset created when running "commit".
 Typically a person's name and email address, e.g. ``Fred Widget
diff --git a/mercurial/help.py b/mercurial/help.py
--- a/mercurial/help.py
+++ b/mercurial/help.py
@@ -9,6 +9,7 @@
 
 import itertools
 import os
+import re
 import textwrap
 
 from .i18n import (
@@ -30,6 +31,7 @@
 templatefilters,
 templatefuncs,
 templatekw,
+ui as uimod,
 util,
 )
 from .hgweb import (
@@ -431,6 +433,16 @@
 addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
 dedent=True)
 
+def inserttweakrc(ui, topic, doc):
+marker = '.. tweakdefaultsmarker'
+repl = uimod.tweakrc
+def sub(m):
+lines = [m.group(1) + s for s in repl.splitlines()]
+return '\n'.join(lines)
+return re.sub(br'( *)%s' % re.escape(marker), sub, doc)
+
+addtopichook('config', inserttweakrc)
+
 def help_(ui, commands, name, unknowncmd=False, full=True, subtopic=None,
   **opts):
 '''



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


D5192: tests: remove lz4 as dependency while running tests

2018-10-24 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  One of the previous patch authored by Augie rips out the lz4 dependency and
  things should work without it.
  
  Now there are just 2-3 tests failing because of same change in emitrevisions()
  API.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/remotefilelog-library.sh

CHANGE DETAILS

diff --git a/tests/remotefilelog-library.sh b/tests/remotefilelog-library.sh
--- a/tests/remotefilelog-library.sh
+++ b/tests/remotefilelog-library.sh
@@ -1,5 +1,3 @@
-${PYTHON:-python} -c 'import lz4' || exit 80
-
 CACHEDIR=$PWD/hgcache
 cat >> $HGRCPATH 

D5190: shallowutil: introduce a helper function isenabled()

2018-10-24 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch introduces a inenabled() function which will check whether
  remotefilelog is enabled or not. The function is then also used at all the
  places where check whether remotefilelog is enabled or not. The new function
  makes code easy to read without need to understand what is the constant 
involved
  and why we are checking repo.requirements.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/remotefilelog/__init__.py
  hgext/remotefilelog/debugcommands.py
  hgext/remotefilelog/remotefilelogserver.py
  hgext/remotefilelog/shallowbundle.py
  hgext/remotefilelog/shallowutil.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/shallowutil.py 
b/hgext/remotefilelog/shallowutil.py
--- a/hgext/remotefilelog/shallowutil.py
+++ b/hgext/remotefilelog/shallowutil.py
@@ -30,6 +30,10 @@
 if not pycompat.iswindows:
 import grp
 
+def isenabled(repo):
+"""returns whether the repository is remotefilelog enabled or not"""
+return constants.SHALLOWREPO_REQUIREMENT in repo.requirements
+
 def getcachekey(reponame, file, id):
 pathhash = hashlib.sha1(file).hexdigest()
 return os.path.join(reponame, pathhash[:2], pathhash[2:], id)
diff --git a/hgext/remotefilelog/shallowbundle.py 
b/hgext/remotefilelog/shallowbundle.py
--- a/hgext/remotefilelog/shallowbundle.py
+++ b/hgext/remotefilelog/shallowbundle.py
@@ -54,7 +54,7 @@
 
 class shallowcg1packer(changegroup.cgpacker):
 def generate(self, commonrevs, clnodes, fastpathlinkrev, source):
-if constants.SHALLOWREPO_REQUIREMENT in self._repo.requirements:
+if shallowutil.isenabled(self._repo):
 fastpathlinkrev = False
 
 return super(shallowcg1packer, self).generate(commonrevs, clnodes,
@@ -69,7 +69,7 @@
 linknodes, commonrevs, source = args
 except ValueError:
 commonrevs, source, mfdicts, fastpathlinkrev, fnodes, clrevs = args
-if constants.SHALLOWREPO_REQUIREMENT in self._repo.requirements:
+if shallowutil.isenabled(self._repo):
 repo = self._repo
 if isinstance(repo, bundlerepo.bundlerepository):
 # If the bundle contains filelogs, we can't pull from it, since
@@ -91,7 +91,7 @@
 
 def shouldaddfilegroups(self, source):
 repo = self._repo
-if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements:
+if not shallowutil.isenabled(repo):
 return AllFiles
 
 if source == "push" or source == "bundle":
@@ -139,7 +139,7 @@
 yield delta
 
 def makechangegroup(orig, repo, outgoing, version, source, *args, **kwargs):
-if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements:
+if not shallowutil.isenabled(repo):
 return orig(repo, outgoing, version, source, *args, **kwargs)
 
 original = repo.shallowmatch
@@ -168,7 +168,7 @@
 repo.shallowmatch = original
 
 def addchangegroupfiles(orig, repo, source, revmap, trp, expectedfiles, *args):
-if not constants.SHALLOWREPO_REQUIREMENT in repo.requirements:
+if not shallowutil.isenabled(repo):
 return orig(repo, source, revmap, trp, expectedfiles, *args)
 
 files = 0
diff --git a/hgext/remotefilelog/remotefilelogserver.py 
b/hgext/remotefilelog/remotefilelogserver.py
--- a/hgext/remotefilelog/remotefilelogserver.py
+++ b/hgext/remotefilelog/remotefilelogserver.py
@@ -132,7 +132,7 @@
 def _walkstreamfiles(orig, repo):
 if state.shallowremote:
 # if we are shallow ourselves, stream our local commits
-if constants.SHALLOWREPO_REQUIREMENT in repo.requirements:
+if shallowutil.isenabled(repo):
 striplen = len(repo.store.path) + 1
 readdir = repo.store.rawvfs.readdir
 visit = [os.path.join(repo.store.path, 'data')]
@@ -166,7 +166,7 @@
 continue
 yield x
 
-elif constants.SHALLOWREPO_REQUIREMENT in repo.requirements:
+elif shallowutil.isenabled(repo):
 # don't allow cloning from a shallow repo to a full repo
 # since it would require fetching every version of every
 # file in order to create the revlogs.
@@ -193,8 +193,8 @@
 # expose remotefilelog capabilities
 def _capabilities(orig, repo, proto):
 caps = orig(repo, proto)
-if ((constants.SHALLOWREPO_REQUIREMENT in repo.requirements or
-ui.configbool('remotefilelog', 'server'))):
+if (shallowutil.isenabled(repo) or ui.configbool('remotefilelog',
+ 'server')):
 if isinstance(proto, _sshv1server):
 # legacy getfiles method which only works over ssh
 caps.append(constants.NETWORK_CAP_LEGACY_SSH_GETFILES)
@@ -278,7 +278,7 @@
 data 

D5191: remotefilelogserver: add a matcher argument to _walkstreamfiles()

2018-10-24 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Implementing narrow stream clones in core, I added an optional matcher 
argument.
  The function in remotefilelogserver.py does not know about that argument and
  does not accept that and hence some tests fails.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/remotefilelog/remotefilelogserver.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/remotefilelogserver.py 
b/hgext/remotefilelog/remotefilelogserver.py
--- a/hgext/remotefilelog/remotefilelogserver.py
+++ b/hgext/remotefilelog/remotefilelogserver.py
@@ -129,7 +129,7 @@
 wireprotov1server.commands['stream_out_shallow'] = (stream_out_shallow, 
'*')
 
 # don't clone filelogs to shallow clients
-def _walkstreamfiles(orig, repo):
+def _walkstreamfiles(orig, repo, matcher=None):
 if state.shallowremote:
 # if we are shallow ourselves, stream our local commits
 if shallowutil.isenabled(repo):



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


D5189: remotefilelog: remove some BC code related to streamclone

2018-10-24 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Since remotefilelog is now moved to core and we have
  streamclone._walkstreamfiles() in core, we don't need to have the backward
  compatibility code.
  
  People with old mercurial version should use remotefilelog from 
hg-experimental
  repo as IMO remotefilelog will go under a good refactoring and old clients 
will
  break.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/remotefilelog/__init__.py

CHANGE DETAILS

diff --git a/hgext/remotefilelog/__init__.py b/hgext/remotefilelog/__init__.py
--- a/hgext/remotefilelog/__init__.py
+++ b/hgext/remotefilelog/__init__.py
@@ -121,6 +121,7 @@
 revset,
 scmutil,
 smartset,
+streamclone,
 templatekw,
 util,
 )
@@ -142,13 +143,6 @@
 # ensures debug commands are registered
 hgdebugcommands.command
 
-try:
-from mercurial import streamclone
-streamclone._walkstreamfiles
-hasstreamclone = True
-except Exception:
-hasstreamclone = False
-
 cmdtable = {}
 command = registrar.command(cmdtable)
 
@@ -305,36 +299,28 @@
 else:
 return orig()
 extensions.wrapfunction(remote, 'stream_out', stream_out_shallow)
-if hasstreamclone:
-def stream_wrap(orig, op):
-setup_streamout(op.repo, op.remote)
-return orig(op)
-extensions.wrapfunction(
-streamclone, 'maybeperformlegacystreamclone', stream_wrap)
+def stream_wrap(orig, op):
+setup_streamout(op.repo, op.remote)
+return orig(op)
+extensions.wrapfunction(
+streamclone, 'maybeperformlegacystreamclone', stream_wrap)
 
-def canperformstreamclone(orig, pullop, bundle2=False):
-# remotefilelog is currently incompatible with the
-# bundle2 flavor of streamclones, so force us to use
-# v1 instead.
-if 'v2' in pullop.remotebundle2caps.get('stream', []):
-pullop.remotebundle2caps['stream'] = [
-c for c in pullop.remotebundle2caps['stream']
-if c != 'v2']
-if bundle2:
-return False, None
-supported, requirements = orig(pullop, bundle2=bundle2)
-if requirements is not None:
-requirements.add(constants.SHALLOWREPO_REQUIREMENT)
-return supported, requirements
-extensions.wrapfunction(
-streamclone, 'canperformstreamclone', canperformstreamclone)
-else:
-def stream_in_shallow(orig, repo, remote, requirements):
-setup_streamout(repo, remote)
+def canperformstreamclone(orig, pullop, bundle2=False):
+# remotefilelog is currently incompatible with the
+# bundle2 flavor of streamclones, so force us to use
+# v1 instead.
+if 'v2' in pullop.remotebundle2caps.get('stream', []):
+pullop.remotebundle2caps['stream'] = [
+c for c in pullop.remotebundle2caps['stream']
+if c != 'v2']
+if bundle2:
+return False, None
+supported, requirements = orig(pullop, bundle2=bundle2)
+if requirements is not None:
 requirements.add(constants.SHALLOWREPO_REQUIREMENT)
-return orig(repo, remote, requirements)
-extensions.wrapfunction(
-localrepo.localrepository, 'stream_in', stream_in_shallow)
+return supported, requirements
+extensions.wrapfunction(
+streamclone, 'canperformstreamclone', canperformstreamclone)
 
 try:
 orig(ui, repo, *args, **opts)



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


[PATCH 2 of 2] py3: do not stringify integers in revlog stats by '%s'

2018-10-24 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1540384144 -32400
#  Wed Oct 24 21:29:04 2018 +0900
# Node ID 27ce24dccddd2c104bdd3e1517b7cb62cc931026
# Parent  491701afb3ec768f82d7985410fcb259a3a4375e
py3: do not stringify integers in revlog stats by '%s'

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1172,7 +1172,7 @@ def debugindexstats(ui, repo):
 if not util.safehasattr(index, 'stats'):
 raise error.Abort(_('debugindexstats only works with native code'))
 for k, v in sorted(index.stats().items()):
-ui.write('%s: %s\n' % (k, v))
+ui.write('%s: %d\n' % (k, v))
 
 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
 def debuginstall(ui, **opts):
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 2] py3: convert revlog stats to a dict of (bytes, int) pairs

2018-10-24 Thread Yuya Nishihara
# HG changeset patch
# User Yuya Nishihara 
# Date 1540384083 -32400
#  Wed Oct 24 21:28:03 2018 +0900
# Node ID 491701afb3ec768f82d7985410fcb259a3a4375e
# Parent  005bc856e9192b2dad6b9d382af9fbd5ce0b6a9a
py3: convert revlog stats to a dict of (bytes, int) pairs

Py_DECREF(t) is replaced with Py_CLEAR(t) so that t is set to NULL once
decrefed. Otherwise, it would be excessively decrefed if a subsequent
PyBytes_FromString() failed.

diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c
--- a/mercurial/cext/revlog.c
+++ b/mercurial/cext/revlog.c
@@ -348,6 +348,7 @@ static PyObject *index_append(indexObjec
 static PyObject *index_stats(indexObject *self)
 {
PyObject *obj = PyDict_New();
+   PyObject *s = NULL;
PyObject *t = NULL;
 
if (obj == NULL)
@@ -355,22 +356,26 @@ static PyObject *index_stats(indexObject
 
 #define istat(__n, __d) \
do { \
+   s = PyBytes_FromString(__d); \
t = PyInt_FromSsize_t(self->__n); \
-   if (!t) \
+   if (!s || !t) \
goto bail; \
-   if (PyDict_SetItemString(obj, __d, t) == -1) \
+   if (PyDict_SetItem(obj, s, t) == -1) \
goto bail; \
-   Py_DECREF(t); \
+   Py_CLEAR(s); \
+   Py_CLEAR(t); \
} while (0)
 
if (self->added) {
Py_ssize_t len = PyList_GET_SIZE(self->added);
+   s = PyBytes_FromString("index entries added");
t = PyInt_FromSsize_t(len);
-   if (!t)
+   if (!s || !t)
goto bail;
-   if (PyDict_SetItemString(obj, "index entries added", t) == -1)
+   if (PyDict_SetItem(obj, s, t) == -1)
goto bail;
-   Py_DECREF(t);
+   Py_CLEAR(s);
+   Py_CLEAR(t);
}
 
if (self->raw_length != self->length)
@@ -392,6 +397,7 @@ static PyObject *index_stats(indexObject
 
 bail:
Py_XDECREF(obj);
+   Py_XDECREF(s);
Py_XDECREF(t);
return NULL;
 }
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5187: help: describe what ui.tweakdefaults changes, concretely

2018-10-24 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > +ui,
  
  Nit: `ui as uimod` per test-check-code.t.
  
  > @@ -436,6 +437,11 @@
  > 
  >   addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
  >   addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
  >   dedent=True)
  > 
  > +def docplaceholder():
  >  +pass
  >  +docplaceholder.__doc__ = ui.tweakrc
  >  +addtopicsymbols('config', '.. tweakdefaultsmarker', {'': docplaceholder},
  >  +dedent=True)
  
  Alternatively, we can register a dedicated loader by `addtopichook()`. Only
  thing we'll have to do is to replace a placeholder with indented tweakrc.

REPOSITORY
  rHG Mercurial

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

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


Re: D5187: help: describe what ui.tweakdefaults changes, concretely

2018-10-24 Thread Yuya Nishihara
> +ui,

Nit: `ui as uimod` per test-check-code.t.

> @@ -436,6 +437,11 @@
>  addtopicsymbols('templates', '.. functionsmarker', templatefuncs.funcs)
>  addtopicsymbols('hgweb', '.. webcommandsmarker', webcommands.commands,
>  dedent=True)
> +def docplaceholder():
> +pass
> +docplaceholder.__doc__ = ui.tweakrc
> +addtopicsymbols('config', '.. tweakdefaultsmarker', {'': docplaceholder},
> +dedent=True)

Alternatively, we can register a dedicated loader by `addtopichook()`. Only
thing we'll have to do is to replace a placeholder with indented tweakrc.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5186: help: when replacing placeholders in help files, insert indented text

2018-10-24 Thread yuja (Yuya Nishihara)
yuja added a comment.


  > - a/mercurial/help.py +++ b/mercurial/help.py @@ -391,6 +391,12 @@ single 
documentation block and use it to overwrite the marker in doc. """ entries = [] 
+markerindent = 0 +markerpos = doc.find(marker) +if markerpos >= 0: 
+newlinepos = doc.rfind('\n', 0, markerpos) +if newlinepos >= 
0: +markerindent = markerpos - newlinepos - 1
  
  Perhaps, it's simpler to use re.sub() instead of doc.replace(...), something
  like:
  
markerre = re.compile(br'^(\s*)%s' % re.escape(marker), re.MULTILINE)
markerre.sub(builditemsdoc, doc)

REPOSITORY
  rHG Mercurial

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

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


Re: D5186: help: when replacing placeholders in help files, insert indented text

2018-10-24 Thread Yuya Nishihara
> --- a/mercurial/help.py
> +++ b/mercurial/help.py
> @@ -391,6 +391,12 @@
>  single documentation block and use it to overwrite the marker in doc.
>  """
>  entries = []
> +markerindent = 0
> +markerpos = doc.find(marker)
> +if markerpos >= 0:
> +newlinepos = doc.rfind('\n', 0, markerpos)
> +if newlinepos >= 0:
> +markerindent = markerpos - newlinepos - 1

Perhaps, it's simpler to use re.sub() instead of doc.replace(...), something
like:

```
markerre = re.compile(br'^(\s*)%s' % re.escape(marker), re.MULTILINE)
markerre.sub(builditemsdoc, doc)
```
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5002: extensions: fix up many many debug logs that use %r

2018-10-24 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG09a37a5d8f5d: extensions: fix up many many debug logs that 
use %r (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5002?vs=12323=12334

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

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

CHANGE DETAILS

diff --git a/tests/test-extension-timing.t b/tests/test-extension-timing.t
--- a/tests/test-extension-timing.t
+++ b/tests/test-extension-timing.t
@@ -46,23 +46,23 @@
   $ hg foo --traceback --config devel.debug.extensions=yes --debug 2>&1
   debug.extensions: loading extensions
   debug.extensions: - processing 1 entries
-  debug.extensions:   - loading extension: 'foobar'
-  debug.extensions:   > 'foobar' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'foobar'
-  debug.extensions: - invoking registered callbacks: 'foobar'
+  debug.extensions:   - loading extension: foobar
+  debug.extensions:   > foobar extension loaded in * (glob)
+  debug.extensions: - validating extension tables: foobar
+  debug.extensions: - invoking registered callbacks: foobar
   debug.extensions: > callbacks completed in * (glob)
   debug.extensions: > loaded 1 extensions, total time * (glob)
   debug.extensions: - loading configtable attributes
   debug.extensions: - executing uisetup hooks
-  debug.extensions:   - running uisetup for 'foobar'
+  debug.extensions:   - running uisetup for foobar
   uisetup called [debug]
   uisetup called
   uisetup called [status]
-  debug.extensions:   > uisetup for 'foobar' took * (glob)
+  debug.extensions:   > uisetup for foobar took * (glob)
   debug.extensions: > all uisetup took * (glob)
   debug.extensions: - executing extsetup hooks
-  debug.extensions:   - running extsetup for 'foobar'
-  debug.extensions:   > extsetup for 'foobar' took * (glob)
+  debug.extensions:   - running extsetup for foobar
+  debug.extensions:   > extsetup for foobar took * (glob)
   debug.extensions: > all extsetup took * (glob)
   debug.extensions: - executing remaining aftercallbacks
   debug.extensions: > remaining aftercallbacks completed in * (glob)
@@ -87,7 +87,7 @@
   debug.extensions:   - running reposetup for foobar
   reposetup called for a
   ui == repo.ui
-  debug.extensions:   > reposetup for 'foobar' took * (glob)
+  debug.extensions:   > reposetup for foobar took * (glob)
   debug.extensions: > all reposetup took * (glob)
   Foo
 
diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t
--- a/tests/test-bad-extension.t
+++ b/tests/test-bad-extension.t
@@ -85,21 +85,21 @@
   > | egrep 'extension..[^p]|^Exception|Traceback|ImportError|not 
import|ModuleNotFound'
   debug.extensions: loading extensions
   debug.extensions: - processing 5 entries
-  debug.extensions:   - loading extension: 'gpg'
-  debug.extensions:   > 'gpg' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'gpg'
-  debug.extensions: - invoking registered callbacks: 'gpg'
+  debug.extensions:   - loading extension: gpg
+  debug.extensions:   > gpg extension loaded in * (glob)
+  debug.extensions: - validating extension tables: gpg
+  debug.extensions: - invoking registered callbacks: gpg
   debug.extensions: > callbacks completed in * (glob)
-  debug.extensions:   - loading extension: 'badext'
+  debug.extensions:   - loading extension: badext
   *** failed to import extension badext from $TESTTMP/badext.py: bit bucket 
overflow
   Traceback (most recent call last):
   Exception: bit bucket overflow
-  debug.extensions:   - loading extension: 'baddocext'
-  debug.extensions:   > 'baddocext' extension loaded in * (glob)
-  debug.extensions: - validating extension tables: 'baddocext'
-  debug.extensions: - invoking registered callbacks: 'baddocext'
+  debug.extensions:   - loading extension: baddocext
+  debug.extensions:   > baddocext extension loaded in * (glob)
+  debug.extensions: - validating extension tables: baddocext
+  debug.extensions: - invoking registered callbacks: baddocext
   debug.extensions: > callbacks completed in * (glob)
-  debug.extensions:   - loading extension: 'badext2'
+  debug.extensions:   - loading extension: badext2
   debug.extensions: - could not import hgext.badext2 (No module named 
*badext2*): trying hgext3rd.badext2 (glob)
   Traceback (most recent call last):
   ImportError: No module named badext2 (no-py3 !)
@@ -121,16 +121,16 @@
   debug.extensions: > loaded 2 extensions, total time * (glob)
   debug.extensions: - loading configtable attributes
   debug.extensions: - executing uisetup hooks
-  debug.extensions:   - running uisetup for 'gpg'
-  debug.extensions:   > uisetup for 'gpg' took * (glob)
-  debug.extensions:   - running uisetup for 'baddocext'
-  

D5184: py3: port test-log-exthook.t to Python 3

2018-10-24 Thread durin42 (Augie Fackler)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG005bc856e919: py3: port test-log-exthook.t to Python 3 
(authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5184?vs=12324=12335

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

AFFECTED FILES
  contrib/python3-whitelist
  tests/test-log-exthook.t

CHANGE DETAILS

diff --git a/tests/test-log-exthook.t b/tests/test-log-exthook.t
--- a/tests/test-log-exthook.t
+++ b/tests/test-log-exthook.t
@@ -9,10 +9,12 @@
   >   logcmdutil,
   >   repair,
   > )
+  > def brot13(b):
+  > return codecs.encode(b.decode('utf8'), 'rot-13').encode('utf8')
   > def rot13description(self, ctx):
-  > summary = codecs.encode("summary", 'rot-13')
-  > description = ctx.description().strip().splitlines()[0].encode('rot13')
-  > self.ui.write("%s: %s\n" % (summary, description))
+  > description = ctx.description().strip().splitlines()[0]
+  > self.ui.write(b"%s: %s\n" % (brot13(b"summary"),
+  >  brot13(description)))
   > def reposetup(ui, repo):
   > logcmdutil.changesetprinter._exthook = rot13description
   > EOF
diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -309,6 +309,7 @@
 test-linerange.py
 test-locate.t
 test-lock-badness.t
+test-log-exthook.t
 test-log-linerange.t
 test-log.t
 test-logexchange.t



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


Re: [PATCH] blackbox: add configitem for format of log timestamps

2018-10-24 Thread Yuya Nishihara
On Tue, 23 Oct 2018 13:49:41 -0700, Matthew DeVore wrote:
> From: Matt DeVore 
> 
> My e-mail client was mangling spaces, which is why you couldn't apply the
> patch earlier. I'm sending this again with a different tool and e-mail 
> address.
> 
> 
> # HG changeset patch
> # User Matt DeVore 
> # Date 1539816481 25200
> #  Wed Oct 17 15:48:01 2018 -0700
> # Node ID 13c2fe6d3b30a743daa1984404a70ed769779d11
> # Parent  a0e7fa019290d5348c4a83f6b287f2612d645025
> blackbox: add configitem for format of log timestamps

Queued, thanks.

You can use Phabricator to submit patches. I don't like it, but it'll be
a better option if your email environment is restricted.

https://www.mercurial-scm.org/wiki/ContributingChanges#Sending_patches

> @@ -169,7 +177,9 @@ def wrapui(ui):
>  return
>  ui._bbinlog = True
>  default = self.configdate('devel', 'default-date')
> -date = dateutil.datestr(default, '%Y/%m/%d %H:%M:%S')
> +format = ui.config('blackbox', 'date-format')

Removed unused variable.

> +date = dateutil.datestr(default,
> +ui.config('blackbox', 'date-format'))
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


Re: [PATCH STABLE] statprof: sort by time percentage as a secondary key

2018-10-24 Thread Yuya Nishihara
On Tue, 23 Oct 2018 23:37:20 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison 
> # Date 1540351037 14400
> #  Tue Oct 23 23:17:17 2018 -0400
> # Branch stable
> # Node ID 3662c0ac3ab4b256ecabb348cc91605ee8973abb
> # Parent  49c7b701fdc2a8659b6f752aef507764d40ed5d0
> statprof: sort by time percentage as a secondary key
> 
> On Windows, os.times() only returns user and system times.  Real elapsed time 
> is
> 0.  That results in no actual times reported, an end wall time of 0.00, 
> and
> seemingly randomly sorted stack frames.  This at least provides test stability
> in test-profile.t.

Sounds like we should change the default back to 'cpu' globally, or at least
on Windows.
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D5188: narrow: replace filtering in list comprehension by set operations

2018-10-24 Thread martinvonz (Martin von Zweigbergk)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5d8f291405e5: narrow: replace filtering in list 
comprehension by set operations (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D5188?vs=12332=12333

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

AFFECTED FILES
  hgext/narrow/narrowcommands.py

CHANGE DETAILS

diff --git a/hgext/narrow/narrowcommands.py b/hgext/narrow/narrowcommands.py
--- a/hgext/narrow/narrowcommands.py
+++ b/hgext/narrow/narrowcommands.py
@@ -400,10 +400,10 @@
 
 # filter the user passed additions and deletions into actual additions and
 # deletions of excludes and includes
-addedincludes = set([i for i in addedincludes if i not in oldincludes])
-removedincludes = set([i for i in removedincludes if i in oldincludes])
-addedexcludes = set([i for i in addedexcludes if i not in oldexcludes])
-removedexcludes = set([i for i in removedexcludes if i in oldexcludes])
+addedincludes -= oldincludes
+removedincludes &= oldincludes
+addedexcludes -= oldexcludes
+removedexcludes &= oldexcludes
 
 widening = addedincludes or removedexcludes
 narrowing = removedincludes or addedexcludes



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