D6709: config: add --registered flag to show all known configs

2019-08-20 Thread av6 (Anton Shestakov)
av6 added inline comments.

INLINE COMMENTS

> commands.py:1893
>  else:
> -fm.write('name value', '%s=%s\n', entryname, value)
> -fm.data(defaultvalue=defaultvalue)
> +value_ = value
> +for tfopt in [('True', 'yes'), ('False', 'no'), ('true', 'yes'),

Let's rename this variable to better reflect its intent. AFAIU, a better name 
would be `rawvalue` or `origvalue`.

REPOSITORY
  rHG Mercurial

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

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

To: navaneeth.suresh, #hg-reviewers, av6, marmoute, durin42
Cc: durin42, mharbison72, yuja, pulkit, marmoute, av6, mjpieters, 
mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6754: contrib: proof of concept script to build Mac packages without system python

2019-08-20 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This isn't close to being ready- I'm just looking for ideas before I get too 
far
  off into the weeds.  It will build a *.pkg that does install, and both
  `hg version` and `hg debuginstall` look healthy.  As noted in the script 
though,
  there are still references to /Library/Frameworks/Python.framework (which is 
the
  python.org installed stuff), so it may not work on a fresh system.
  
  At this point, I'm wondering if we should just curl the source for OpenSSL and
  Python, and build the non-framework version with the destination set to the
  proper directory.  The packaging for thg does this (though it probably doesn't
  have to), and it takes about 10 minutes on a Mac Mini.  5 Minutes of that is
  running the tests on the python build, so maybe there's a way to shut that 
off.
  
  As far as alternatives, I started down the path of using virtualenv here, and
  shipping that.  I'm skeptical of the experimental nature of --relocatable, and
  grepping on the tree showed the build path in the *.pyc files.  I have no idea
  if that matters.  I left pip in place so that things like evolve could be
  installed, but it errored out when specifying `--user`.  I didn't look into 
why.
  
  I also looked at pyinstaller.  I couldn't figure out how to convince it to
  bundle the C extensions, and it appears to append its own output when the hg
  script exits with a non zero value.  I briefly looked at bbfreeze and 
cx_freeze,
  but didn't get as far.  I've had enough frustration with py2exe and py2app 
that
  I'm not wanting to struggle with yet another packager.
  
  Ultimately I think we should keep the target for building against system 
python
  (there was some special functionality unlocked with a specifically crafted 
dummy
  cert), and this should possibly be a different target.  (I don't see a way to
  switch between the two by simply overriding $PYTHON the way this is going.)  I
  basically copy/pasted the makefile as a starting point, but moved it into a
  shell script so the environment could be activated.  This either needs to be
  moved to contrib/, or folded back into the makefile.  I kinda lean towards the
  former, and have that called by make.  The readme in the installer will also
  have to be conditionalize/updated, since it mentions relying on system python.
  
  It would be nice to open up the range of supported platforms back to say, 
10.9.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  make_osx.sh

CHANGE DETAILS

diff --git a/make_osx.sh b/make_osx.sh
new file mode 100755
--- /dev/null
+++ b/make_osx.sh
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+set -e
+
+# Extra args passed in, not version
+OSXVERSIONFLAGS=
+
+# TODO: default MACOSX_DEPLOYMENT_TARGET=10.9
+# TODO: adjust ${OSXVER} accordingly
+
+rm -rf build/mercurial
+python -m virtualenv build/mercurial/usr/local/mercurial
+source build/mercurial/usr/local/mercurial/bin/activate
+
+# TODO: Don't install this into the virtual environment. Also, use 
docutils-python3
+python -m pip install docutils
+
+python setup.py install --optimize=1  \
+ --root=build/mercurial/ --prefix=/usr/local/mercurial
+
+make -C doc all install DESTDIR="`pwd`/build/mercurial/"
+
+# Place a bogon .DS_Store file in the target dir so we can be
+# sure it doesn't get included in the final package.
+touch build/mercurial/.DS_Store
+
+# install zsh completions - this location appears to be
+# searched by default as of macOS Sierra.
+install -d build/mercurial/usr/local/share/zsh/site-functions/
+install -m 0644 contrib/zsh_completion 
build/mercurial/usr/local/share/zsh/site-functions/_hg
+
+# install bash completions - there doesn't appear to be a
+# place that's searched by default for bash, so we'll follow
+# the lead of Apple's git install and just put it in a
+# location of our own.
+install -d build/mercurial/usr/local/hg/contrib/
+install -m 0644 contrib/bash_completion 
build/mercurial/usr/local/hg/contrib/hg-completion.bash
+
+make -C contrib/chg \
+ HGPATH=/usr/local/bin/hg \
+ PYTHON=python \
+ HGEXTDIR=/usr/local/mercurial/lib/python2.7/site-packages/hgext \
+ DESTDIR=../../build/mercurial \
+ PREFIX=/usr/local \
+ clean install
+
+# Keep pip around so that things like evolve can be installed.
+rm -f build/mercurial/usr/local/mercurial/bin/rst* \
+  build/mercurial/usr/local/mercurial/bin/activate* \
+  build/mercurial/usr/local/mercurial/bin/wheel \
+  build/mercurial/usr/local/mercurial/bin/easy_install
+
+# LANG=C' to avoid "sed: RE error: illegal byte sequence"
+LANG=C sed -i '' -e "s|`pwd`/build/mercurial||g" 
build/mercurial/usr/local/mercurial/bin/*
+
+# The virtualenv contains a symlink back to the real python install.  We can
+# either slim this down somehow (to avoid distributing whatever random 

D6753: contrib: simplify the genosxversion.py command to find the hg libraries

2019-08-20 Thread mharbison72 (Matt Harbison)
mharbison72 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I forget what problem I ran into while trying to teach the makefile to use a
  non-system python.  (It might have ben missing hg-evolve and/or keyring, but
  `check_output()` was raising an error.)  This still isn't great because it 
will
  return non zero for something like the username not being set, even though we
  aren't asking for it.  But I suppose it's still useful to simplify.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/genosxversion.py

CHANGE DETAILS

diff --git a/contrib/genosxversion.py b/contrib/genosxversion.py
--- a/contrib/genosxversion.py
+++ b/contrib/genosxversion.py
@@ -2,14 +2,13 @@
 from __future__ import absolute_import, print_function
 
 import argparse
-import json
 import os
 import subprocess
 import sys
 
 # Always load hg libraries from the hg we can find on $PATH.
-hglib = json.loads(subprocess.check_output(
-['hg', 'debuginstall', '-Tjson']))[0]['hgmodules']
+hglib = subprocess.check_output(
+['hg', 'debuginstall', '-T', '{hgmodules}'])
 sys.path.insert(0, os.path.dirname(hglib))
 
 from mercurial import util



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


Re: Interest in integrating hg-git into Mercurial

2019-08-20 Thread Tim Delaney
On Wed, 21 Aug 2019 at 07:47, Tim Delaney 
wrote:

> On Fri, 2 Aug 2019 at 03:04, Gregory Szorc 
> wrote:
>
>> Is there any interest in integrating hg-git (or hg-git functionality)
>> into the Mercurial distribution as an officially supported extension?
>>
>> Huge interest, given I received the following email from Atlassian this
> morning. I echo the desire to make git effectively an alternative repo
> format for Mercurial, rather than using hg-git.
>

I should make it clear that in the end all I really care about is being
able to cleanly push and pull to git repos. My use cases would be treating
the git repo as a final location i.e. the changesets are effectively all
public, so obsolescence markers and changeset evolution aren't a major
issue (though it would be nice if they could be supported somehow).

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


Re: Interest in integrating hg-git into Mercurial

2019-08-20 Thread Tim Delaney
On Fri, 2 Aug 2019 at 03:04, Gregory Szorc  wrote:

> Is there any interest in integrating hg-git (or hg-git functionality) into
> the Mercurial distribution as an officially supported extension?
>
> Given the popularity of Git and the difficulty of installing semi-complex
> Python software like hg-git, I was thinking it would be beneficial to
> end-users for Mercurial to support interacting with Git repositories
> out-of-the-box with as little set-up pain as possible. hg-git feels like
> the path of least resistance towards attaining that goal. (I would
> eventually like to see support for Mercurial opening Git repositories
> natively. While I think this is technically viable, it is probably a year
> or two away, as it needs significant work to shore up Mercurial's storage
> interfaces and internal code contracts to support such a significant
> invariant as interfacing with Git repositories.)
>
> Vendoring hg-git would like also entail vendoring its dependencies:
> urllib3, certifi, and dulwich. Vendoring urllib3 and certifi is probably
> not the worst thing in the world, as it would give us an excuse to refactor
> Mercurial's HTTP internals to move off the ugly hacks we employ to use
> Python's standard library.
>
> I'm not promising I will follow through and do this work. At this time I'm
> mostly interested in taking a quick pulse to see if there is any interest
> in doing it. If there is general support, I may follow through :)
>

Huge interest, given I received the following email from Atlassian this
morning. I echo the desire to make git effectively an alternative repo
format for Mercurial, rather than using hg-git.

It's sad that the less user-friendly VCS has effectively won due to who
created it, but that's the world we live in. Even Python development has
moved to git for basically the reasons listed below.

> After much consideration, we've decided to remove Mercurial support
> from Bitbucket Cloud and the API. Mercurial features and repositories
> will be officially removed from Bitbucket and its API on June 1, 2020.
>
> What used to be a very fragmented version control software market has
> rapidly matured. Mercurial usage on Bitbucket is steadily declining,
> and the percentage of new Bitbucket users choosing Mercurial has
> fallen to less than 1%. At the same time, Git has become the standard.
> According to a Stack Overflow Developer Survey, almost 90% of
> developers use Git, while Mercurial is the least popular version
> control system with only about 3% developer adoption.
>
> Given that Git has emerged as the version control system of choice for
>  the industry, we have decided to focus our priorities and roadmap on
> building the best possible experience for the market and our users.

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


[PATCH 7 of 7] revlog: split `rawtext` retrieval out of _revisiondata

2019-08-20 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1566313956 -7200
#  Tue Aug 20 17:12:36 2019 +0200
# Node ID 9f906301d3f152b00935a519fafc216499ead4df
# Parent  5b8bcfd5ef2cb077fe3c8bd2c4f62f693ebcf2fc
# EXP-Topic revisiondata
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
9f906301d3f1
revlog: split `rawtext` retrieval out of _revisiondata

This part is reasonably independant. Having it on its own clarify the code flow
and will help code that inherit from revlog to overwrite specific area only.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1623,80 +1623,77 @@ class revlog(object):
 if node == nullid:
 return ""
 
-# revision in the cache (could be useful to apply delta)
-cachedrev = None
-# the revlog's flag for this revision
-# (usually alter its state or content)
-flags = None
 # The text as stored inside the revlog. Might be the revision or might
 # need to be processed to retrieve the revision.
 rawtext = None
+
+rev, rawtext, validated = self._rawtext(node, rev, _df=_df)
+
+if raw and validated:
+# if we are don't want to process the raw text and that raw
+# text is cached, we can exit early.
+return rawtext
+if rev is None:
+rev = self.rev(node)
+# the revlog's flag for this revision
+# (usually alter its state or content)
+flags = self.flags(rev)
+
+if validated and flags == REVIDX_DEFAULT_FLAGS:
+# no extra flags set, no flag processor runs, text = rawtext
+return rawtext
+
+text, validatehash = self._processflags(rawtext, flags, 'read', 
raw=raw)
+if validatehash:
+self.checkhash(text, node, rev=rev)
+if not validated:
+self._revisioncache = (node, rev, rawtext)
+
+return text
+
+def _rawtext(self, node, rev, _df=None):
+"""return the possibly unvalidated rawtext for a revision
+
+returns is (rev, rawtext, validated)
+"""
+
+# revision in the cache (could be useful to apply delta)
+cachedrev = None
 # An intermediate text to apply deltas to
 basetext = None
-# Do we need to update the rawtext cache once it is validated ?
-needcaching = True
 
 # Check is we are the entry in cache
 # The cache entry looks like (node, rev, rawtext)
 if self._revisioncache:
 if self._revisioncache[0] == node:
-needcaching = False
-# _cache only stores rawtext
-# rawtext is reusable. but we might need to run flag processors
-rawtext = self._revisioncache[2]
-if raw:
-# if we are don't want to process the raw text and that raw
-# text is cached, we can exit early.
-return rawtext
-# duplicated, but good for perf
-if rev is None:
-rev = self.rev(node)
-if flags is None:
-flags = self.flags(rev)
-# no extra flags set, no flag processor runs, text = rawtext
-if flags == REVIDX_DEFAULT_FLAGS:
-return rawtext
-
+return (rev, self._revisioncache[2], True)
 cachedrev = self._revisioncache[1]
 
-# look up what we need to read
-if rawtext is None:
-if rev is None:
-rev = self.rev(node)
-
-chain, stopped = self._deltachain(rev, stoprev=cachedrev)
-if stopped:
-basetext = self._revisioncache[2]
-
-# drop cache to save memory
-self._revisioncache = None
-
-targetsize = None
-rawsize = self.index[rev][2]
-if 0 <= rawsize:
-targetsize = 4 * rawsize
-
-bins = self._chunks(chain, df=_df, targetsize=targetsize)
-if basetext is None:
-basetext = bytes(bins[0])
-bins = bins[1:]
-
-rawtext = mdiff.patches(basetext, bins)
-del basetext # let us have a change to free memory early
-
-if flags is None:
-if rev is None:
-rev = self.rev(node)
-flags = self.flags(rev)
-
-text, validatehash = self._processflags(rawtext, flags, 'read', 
raw=raw)
-if validatehash:
-self.checkhash(text, node, rev=rev)
-
-if needcaching:
-self._revisioncache = (node, rev, rawtext)
-
-return text
+if rev is None:
+rev = self.rev(node)
+
+chain, stopped = self._deltachain(rev, stoprev=cachedrev)
+if stopped:
+basetext = self._revisioncache[2]
+
+   

[PATCH 6 of 7] revlog: avoid caching raw text too early in _revisiondata

2019-08-20 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1566224983 -7200
#  Mon Aug 19 16:29:43 2019 +0200
# Node ID 5b8bcfd5ef2cb077fe3c8bd2c4f62f693ebcf2fc
# Parent  b8286cf6ab132b2d132e1565bc7bc100b4c69596
# EXP-Topic revisiondata
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
5b8bcfd5ef2c
revlog: avoid caching raw text too early in _revisiondata

Without this change, we could cache the rawtext without considering for it
validating the cache or not. If the exception raised by the invalid hash were to
be caught and the same revision accessed again, the invalid rawtext would be
returned.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1633,11 +1633,14 @@ class revlog(object):
 rawtext = None
 # An intermediate text to apply deltas to
 basetext = None
+# Do we need to update the rawtext cache once it is validated ?
+needcaching = True
 
 # Check is we are the entry in cache
 # The cache entry looks like (node, rev, rawtext)
 if self._revisioncache:
 if self._revisioncache[0] == node:
+needcaching = False
 # _cache only stores rawtext
 # rawtext is reusable. but we might need to run flag processors
 rawtext = self._revisioncache[2]
@@ -1680,7 +1683,6 @@ class revlog(object):
 
 rawtext = mdiff.patches(basetext, bins)
 del basetext # let us have a change to free memory early
-self._revisioncache = (node, rev, rawtext)
 
 if flags is None:
 if rev is None:
@@ -1691,6 +1693,9 @@ class revlog(object):
 if validatehash:
 self.checkhash(text, node, rev=rev)
 
+if needcaching:
+self._revisioncache = (node, rev, rawtext)
+
 return text
 
 def rawdata(self, nodeorrev, _df=None):
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 5 of 7] revlog: add some documentation to `_revisiondata` code

2019-08-20 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1565214901 -7200
#  Wed Aug 07 23:55:01 2019 +0200
# Node ID b8286cf6ab132b2d132e1565bc7bc100b4c69596
# Parent  8dd3d57f5d4780a1c8e6aeccc78c54c856999215
# EXP-Topic revisiondata
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
b8286cf6ab13
revlog: add some documentation to `_revisiondata` code

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1611,6 +1611,7 @@ class revlog(object):
 return self._revisiondata(nodeorrev, _df, raw=raw)
 
 def _revisiondata(self, nodeorrev, _df=None, raw=False):
+# deal with  argument type
 if isinstance(nodeorrev, int):
 rev = nodeorrev
 node = self.node(rev)
@@ -1618,19 +1619,31 @@ class revlog(object):
 node = nodeorrev
 rev = None
 
+# fast path the special `nullid` rev
 if node == nullid:
 return ""
 
+# revision in the cache (could be useful to apply delta)
 cachedrev = None
+# the revlog's flag for this revision
+# (usually alter its state or content)
 flags = None
+# The text as stored inside the revlog. Might be the revision or might
+# need to be processed to retrieve the revision.
 rawtext = None
+# An intermediate text to apply deltas to
 basetext = None
+
+# Check is we are the entry in cache
+# The cache entry looks like (node, rev, rawtext)
 if self._revisioncache:
 if self._revisioncache[0] == node:
 # _cache only stores rawtext
 # rawtext is reusable. but we might need to run flag processors
 rawtext = self._revisioncache[2]
 if raw:
+# if we are don't want to process the raw text and that raw
+# text is cached, we can exit early.
 return rawtext
 # duplicated, but good for perf
 if rev is None:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 4 of 7] revlog: move `nullid` early return sooner in `_revisiondata`

2019-08-20 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1565214775 -7200
#  Wed Aug 07 23:52:55 2019 +0200
# Node ID 8dd3d57f5d4780a1c8e6aeccc78c54c856999215
# Parent  bab054f6cc691c74c503e043ee82482695b403a4
# EXP-Topic revisiondata
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
8dd3d57f5d47
revlog: move `nullid` early return sooner in `_revisiondata`

Let us deal with the special case before we start dealing with more generic
case.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1618,12 +1618,13 @@ class revlog(object):
 node = nodeorrev
 rev = None
 
+if node == nullid:
+return ""
+
 cachedrev = None
 flags = None
 rawtext = None
 basetext = None
-if node == nullid:
-return ""
 if self._revisioncache:
 if self._revisioncache[0] == node:
 # _cache only stores rawtext
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 3 of 7] revlog: stop calling `basetext` `rawtext` in _revisiondata

2019-08-20 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1565214534 -7200
#  Wed Aug 07 23:48:54 2019 +0200
# Node ID bab054f6cc691c74c503e043ee82482695b403a4
# Parent  598ab124d9b67810662db9a5d770e90cf913b9a4
# EXP-Topic revisiondata
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
bab054f6cc69
revlog: stop calling  `basetext` `rawtext` in _revisiondata

If the cache entry is used as a base test for delta it is not the rawtext we
need. We update the variable name to clarify this.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1621,6 +1621,7 @@ class revlog(object):
 cachedrev = None
 flags = None
 rawtext = None
+basetext = None
 if node == nullid:
 return ""
 if self._revisioncache:
@@ -1648,7 +1649,7 @@ class revlog(object):
 
 chain, stopped = self._deltachain(rev, stoprev=cachedrev)
 if stopped:
-rawtext = self._revisioncache[2]
+basetext = self._revisioncache[2]
 
 # drop cache to save memory
 self._revisioncache = None
@@ -1659,11 +1660,12 @@ class revlog(object):
 targetsize = 4 * rawsize
 
 bins = self._chunks(chain, df=_df, targetsize=targetsize)
-if rawtext is None:
-rawtext = bytes(bins[0])
+if basetext is None:
+basetext = bytes(bins[0])
 bins = bins[1:]
 
-rawtext = mdiff.patches(rawtext, bins)
+rawtext = mdiff.patches(basetext, bins)
+del basetext # let us have a change to free memory early
 self._revisioncache = (node, rev, rawtext)
 
 if flags is None:
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 2 of 7] revlog: assign rawtext earlier in `_revisiondata`

2019-08-20 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1565214374 -7200
#  Wed Aug 07 23:46:14 2019 +0200
# Node ID 598ab124d9b67810662db9a5d770e90cf913b9a4
# Parent  5a46fc205da7509e937c826720e0211bd80f2c52
# EXP-Topic revisiondata
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
598ab124d9b6
revlog: assign rawtext earlier in `_revisiondata`

Assigning the revision earlier make the code easier to read.

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1626,8 +1626,10 @@ class revlog(object):
 if self._revisioncache:
 if self._revisioncache[0] == node:
 # _cache only stores rawtext
+# rawtext is reusable. but we might need to run flag processors
+rawtext = self._revisioncache[2]
 if raw:
-return self._revisioncache[2]
+return rawtext
 # duplicated, but good for perf
 if rev is None:
 rev = self.rev(node)
@@ -1635,9 +1637,7 @@ class revlog(object):
 flags = self.flags(rev)
 # no extra flags set, no flag processor runs, text = rawtext
 if flags == REVIDX_DEFAULT_FLAGS:
-return self._revisioncache[2]
-# rawtext is reusable. need to run flag processor
-rawtext = self._revisioncache[2]
+return rawtext
 
 cachedrev = self._revisioncache[1]
 
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


[PATCH 1 of 7] revlog: drop silly `raw` parameter to `rawdata` function

2019-08-20 Thread Pierre-Yves David
# HG changeset patch
# User Pierre-Yves David 
# Date 1566224067 -7200
#  Mon Aug 19 16:14:27 2019 +0200
# Node ID 5a46fc205da7509e937c826720e0211bd80f2c52
# Parent  581a658e3fc8f73bed80d5457d09dfddbe8d44ea
# EXP-Topic revisiondata
# Available At https://bitbucket.org/octobus/mercurial-devel/
#  hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 
5a46fc205da7
revlog: drop silly `raw` parameter to `rawdata` function

This is a leftover from `revision` and does not make sense for `rawdata`

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -1677,7 +1677,7 @@ class revlog(object):
 
 return text
 
-def rawdata(self, nodeorrev, _df=None, raw=False):
+def rawdata(self, nodeorrev, _df=None):
 """return an uncompressed raw data of a given node or revision number.
 
 _df - an existing file handle to read from. (internal-only)
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D6709: config: add --registered flag to show all known configs

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 16286.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6709?vs=16248=16286

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

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/ui.py
  tests/test-basic.t
  tests/test-commandserver.t
  tests/test-completion.t
  tests/test-config.t
  tests/test-hgrc.t

CHANGE DETAILS

diff --git a/tests/test-hgrc.t b/tests/test-hgrc.t
--- a/tests/test-hgrc.t
+++ b/tests/test-hgrc.t
@@ -80,9 +80,9 @@
 
   $ hg showconfig --config ui.verbose=True --quiet
   bundle.mainreporoot=$TESTTMP
-  ui.verbose=False
-  ui.debug=False
-  ui.quiet=True
+  ui.verbose=no
+  ui.debug=no
+  ui.quiet=yes
 
   $ touch foobar/untracked
   $ cat >> foobar/.hg/hgrc < done
   $ HGRCPATH=configs hg config section.key
   99
+
+test --registered flag
+
+  $ hg showconfig --registered
+  annotate.git=no
+  annotate.ignoreblanklines=no
+  annotate.ignorews=no
+  annotate.ignorewsamount=no
+  annotate.ignorewseol=no
+  annotate.nobinary=no
+  annotate.nodates=no
+  annotate.noprefix=no
+  annotate.showfunc=no
+  annotate.unified=None
+  annotate.word-diff=no
+  auth.cookiefile=None
+  bookmarks.pushing=
+  bundle.mainreporoot=$TESTTMP (default: )
+  chgserver.idletimeout=3600
+  chgserver.skiphash=no
+  cmdserver.log=None
+  cmdserver.max-log-files=7
+  cmdserver.max-log-size=1 MB
+  cmdserver.track-log=chgserver cmdserver repocache
+  color.mode=auto
+  commands.commit.interactive.git=no
+  commands.commit.interactive.ignoreblanklines=no
+  commands.commit.interactive.ignorews=no
+  commands.commit.interactive.ignorewsamount=no
+  commands.commit.interactive.ignorewseol=no
+  commands.commit.interactive.nobinary=no
+  commands.commit.interactive.nodates=no
+  commands.commit.interactive.noprefix=no
+  commands.commit.interactive.showfunc=no
+  commands.commit.interactive.unified=None
+  commands.commit.interactive.word-diff=no
+  commands.commit.post-status=no
+  commands.rebase.requiredest=no
+  commands.resolve.confirm=no
+  commands.resolve.explicit-re-merge=no
+  commands.resolve.mark-check=none
+  commands.revert.interactive.git=no
+  commands.revert.interactive.ignoreblanklines=no
+  commands.revert.interactive.ignorews=no
+  commands.revert.interactive.ignorewsamount=no
+  commands.revert.interactive.ignorewseol=no
+  commands.revert.interactive.nobinary=no
+  commands.revert.interactive.nodates=no
+  commands.revert.interactive.noprefix=no
+  commands.revert.interactive.showfunc=no
+  commands.revert.interactive.unified=None
+  commands.revert.interactive.word-diff=no
+  commands.show.aliasprefix=
+  commands.status.relative=no
+  commands.status.terse=
+  commands.status.verbose=no
+  commands.update.check=None
+  commands.update.requiredest=no
+  convert.bzr.saverev=yes
+  convert.cvsps.cache=yes
+  convert.cvsps.fuzz=60
+  convert.cvsps.logencoding=None
+  convert.cvsps.mergefrom=None
+  convert.cvsps.mergeto=None
+  convert.git.committeractions=messagedifferent
+  convert.git.extrakeys=
+  convert.git.findcopiesharder=no
+  convert.git.remoteprefix=remote
+  convert.git.renamelimit=400
+  convert.git.saverev=yes
+  convert.git.similarity=50
+  convert.git.skipsubmodules=no
+  convert.hg.clonebranches=no
+  convert.hg.ignoreerrors=no
+  convert.hg.preserve-hash=no
+  convert.hg.revs=None
+  convert.hg.saverev=no
+  convert.hg.sourcename=None
+  convert.hg.startrev=None
+  convert.hg.tagsbranch=default
+  convert.hg.usebranchnames=yes
+  convert.localtimezone=no
+  convert.p4.startrev=0
+  convert.skiptags=no
+  convert.svn.branches=None
+  convert.svn.debugsvnlog=yes
+  convert.svn.startrev=0
+  convert.svn.tags=None
+  convert.svn.trunk=None
+  diff.git=no
+  diff.ignoreblanklines=no
+  diff.ignorews=no
+  diff.ignorewsamount=no
+  diff.ignorewseol=no
+  diff.nobinary=no
+  diff.nodates=no
+  diff.noprefix=no
+  diff.showfunc=no
+  diff.unified=None
+  diff.word-diff=no
+  email.bcc=None
+  email.cc=None
+  email.charsets=
+  email.from=None
+  email.method=smtp
+  email.reply-to=None
+  email.to=None
+  format.bookmarks-in-store=no
+  format.dotencode=yes
+  format.obsstore-version=None
+  format.revlog-compression=$BUNDLE2_COMPRESSIONS$
+  format.sparse-revlog=yes
+  format.usefncache=yes
+  format.usegeneraldelta=yes
+  format.usestore=yes
+  fsmonitor.warn_update_file_count=5
+  fsmonitor.warn_when_unused=yes
+  hostsecurity.ciphers=None
+  hostsecurity.disabletls10warning=no
+  http.timeout=None
+  http_proxy.always=no
+  http_proxy.host=None
+  http_proxy.no=
+  http_proxy.passwd=None
+  http_proxy.user=None
+  logtoprocess.command=None
+  logtoprocess.commandexception=None
+  logtoprocess.commandfinish=None
+  logtoprocess.develwarn=None
+  logtoprocess.uiblocked=None
+  merge.checkignored=abort
+  merge.checkunknown=abort
+  merge.followcopies=yes
+  merge.on-failure=continue
+  merge.strict-capability-check=no
+  

D6750: context: filter out invalid copies from workingctx.p[12]copies()

2019-08-20 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  workingctx normally gets its lists of modified, added, removed files
  etc. based on the dirstate status. Its constructor also accepts a
  "changes" argument to override the status from the dirstate. This is
  used for partial commits. If a "changed" argument was passed, we
  should clearly also filter out copies to those paths, which I had
  previously missed. This patch adds that filtering and fixes the bugs
  demonstrated in the previous patch.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/context.py
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -197,13 +197,37 @@
   $ echo a2 > a
   $ hg mv b c
   $ hg ci -m 'modify a, move b to c'
-  $ (hg --config ui.interactive=yes split 2>&1 | grep mercurial.error) < y
   > y
   > n
   > y
   > EOF
-  mercurial.error.ProgrammingError: some copy targets missing from file list
+  diff --git a/a b/a
+  1 hunks, 1 lines changed
+  examine changes to 'a'?
+  (enter ? for help) [Ynesfdaq?] y
+  
+  @@ -1,1 +1,1 @@
+  -a
+  +a2
+  record this change to 'a'?
+  (enter ? for help) [Ynesfdaq?] y
+  
+  diff --git a/b b/c
+  rename from b
+  rename to c
+  examine changes to 'b' and 'c'?
+  (enter ? for help) [Ynesfdaq?] n
+  
+  created new head
+  diff --git a/b b/c
+  rename from b
+  rename to c
+  examine changes to 'b' and 'c'?
+  (enter ? for help) [Ynesfdaq?] y
+  
+  saved backup bundle to 
$TESTTMP/split/.hg/strip-backup/9a396d463e04-2d9e6864-split.hg
   $ cd ..
 
 Test committing half a rename
@@ -213,6 +237,5 @@
   $ echo a > a
   $ hg ci -Aqm 'add a'
   $ hg mv a b
-  $ hg ci -m 'remove a' a 2>&1 | grep mercurial.error
-  mercurial.error.ProgrammingError: some copy targets missing from file list
+  $ hg ci -m 'remove a' a
   $ cd ..
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1558,9 +1558,10 @@
 parents = self._repo.dirstate.parents()
 p1manifest = self._repo[parents[0]].manifest()
 p2manifest = self._repo[parents[1]].manifest()
+changedset = set(self.added()) | set(self.modified())
 narrowmatch = self._repo.narrowmatch()
 for dst, src in self._repo.dirstate.copies().items():
-if not narrowmatch(dst):
+if dst not in changedset or not narrowmatch(dst):
 continue
 if src in p1manifest:
 p1copies[dst] = src



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


D6752: copies: remove existing copy info from the changeset on amend (BC)

2019-08-20 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  When amending a changeset with copy information in the changeset and
  the new changeset doesn't have any copy information (or similar for
  "filesadded" and "filesremoved"), we shouldn't keep it.
  
  A drawback of this is that we now unconditionally remove these four
  entries from the extras, breaking any extensions that happened to
  write entries with the same names (which seems very unlikely).
  
  I think I'd heard that there was list of blacklisted keys that would
  be removed from the extras when a commit is rewritten, but I couldn't
  find that. It would make sense to add the keys mentioned above there
  instead of the custom filtering I've added in this patch.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/changelog.py
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -140,11 +140,7 @@
   saved backup bundle to 
$TESTTMP/repo/.hg/strip-backup/dd7bb9581359-a6e6b6d2-amend.hg
   $ hg changesetcopies
   files: j
-  filesadded: 0
-  filesremoved: 
   
-  p1copies: 0\x00a (esc)
-  p2copies: 
   $ hg showcopies --config experimental.copies.read-from=filelog-only
   a -> j
 The entries should be written to extras even if they're empty (so the client
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -637,6 +637,9 @@
 if extra is None and any(x is not None for x in extrasentries):
 extra = {}
 sortedfiles = sorted(files)
+if extra is not None:
+for name in ('p1copies', 'p2copies', 'filesadded', 'filesremoved'):
+extra.pop(name, None)
 if p1copies is not None:
 extra['p1copies'] = encodecopies(sortedfiles, p1copies)
 if p2copies is not None:



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


D6751: test: show invalid copies when turning off copies-in-changeset

2019-08-20 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  If you turn on copies in changesets and write a commit with a copy,
  then turn it off and amend the commit while undoing the copy, the
  invalid copy information will remain. The read path doesn't crash in
  invalid copy data, but it seems better to not produce the invalid
  data.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -133,6 +133,20 @@
   a -> j
   $ hg showcopies --config experimental.copies.read-from=filelog-only
   a -> j
+Existing copy information in the changeset gets removed on amend and writing
+copy information on to the filelog
+  $ hg ci --amend -m 'copy a to j, v2' \
+  > --config experimental.copies.write-to=filelog-only
+  saved backup bundle to 
$TESTTMP/repo/.hg/strip-backup/dd7bb9581359-a6e6b6d2-amend.hg
+  $ hg changesetcopies
+  files: j
+  filesadded: 0
+  filesremoved: 
+  
+  p1copies: 0\x00a (esc)
+  p2copies: 
+  $ hg showcopies --config experimental.copies.read-from=filelog-only
+  a -> j
 The entries should be written to extras even if they're empty (so the client
 won't have to fall back to reading from filelogs)
   $ echo x >> j



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


D6749: tests: demonstrate crash when committing subset of copies to changeset

2019-08-20 Thread martinvonz (Martin von Zweigbergk)
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  When writing copy metadata to the changeset and not committing all
  copies in the dirstate, we get a ProgrammingError. This commit adds
  two tests showing how to trigger this bug.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  tests/test-copies-in-changeset.t

CHANGE DETAILS

diff --git a/tests/test-copies-in-changeset.t b/tests/test-copies-in-changeset.t
--- a/tests/test-copies-in-changeset.t
+++ b/tests/test-copies-in-changeset.t
@@ -10,6 +10,7 @@
   > showcopies = log -r . -T '{file_copies % "{source} -> {name}\n"}'
   > [extensions]
   > rebase =
+  > split =
   > EOF
 
 Check that copies are recorded correctly
@@ -185,3 +186,33 @@
 a
   R a
   $ cd ..
+
+Test splitting a commit
+
+  $ hg init split
+  $ cd split
+  $ echo a > a
+  $ echo b > b
+  $ hg ci -Aqm 'add a and b'
+  $ echo a2 > a
+  $ hg mv b c
+  $ hg ci -m 'modify a, move b to c'
+  $ (hg --config ui.interactive=yes split 2>&1 | grep mercurial.error) < y
+  > y
+  > n
+  > y
+  > EOF
+  mercurial.error.ProgrammingError: some copy targets missing from file list
+  $ cd ..
+
+Test committing half a rename
+
+  $ hg init partial
+  $ cd partial
+  $ echo a > a
+  $ hg ci -Aqm 'add a'
+  $ hg mv a b
+  $ hg ci -m 'remove a' a 2>&1 | grep mercurial.error
+  mercurial.error.ProgrammingError: some copy targets missing from file list
+  $ cd ..



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


D6718: repository: suppress typing errors on functions without arguments

2019-08-20 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  I tried to queue but `test-check-code.t` and `test-check-commit.t` fails.

REPOSITORY
  rHG Mercurial

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

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

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


D6746: perf: don't pass experimental argument in config for older Mercurial versions

2019-08-20 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  Folded https://www.mercurial-scm.org/repo/hg-committed/rev/9f2189b6bf2a. This 
can be closed now. Thanks for the quick fix.

REPOSITORY
  rHG Mercurial

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

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

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


D6746: perf: don't pass experimental argument in config for older Mercurial versions

2019-08-20 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In D6746#99035 , @martinvonz 
wrote:
  
  > When this patch is ready, could we fold this into `a11fd395e83f`? I have 
`extensions.perf=contrib/perf.py` in my config and it's pretty annoying to have 
any commit in the broken range checked out.
  
  Folding this into `a11fd395e83f`.

REPOSITORY
  rHG Mercurial

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

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

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


D6745: perf: don't depend on pycompat for older Mercurial versions

2019-08-20 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHG1b0af23c71c1: perf: dont depend on pycompat for older 
Mercurial versions (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6745?vs=16265=16274

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

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -126,6 +126,7 @@
 getargspec = pycompat.getargspec  # added to module after 4.5
 _byteskwargs = pycompat.byteskwargs  # since 4.1 (or fbc3f73dc802)
 _sysstr = pycompat.sysstr # since 4.0 (or 2219f4f82ede)
+_bytestr = pycompat.bytestr   # since 4.2 (or b70407bd84d5)
 _xrange = pycompat.xrange # since 4.8 (or 7eba8f83129b)
 fsencode = pycompat.fsencode  # since 3.9 (or f4a5e0e86a7e)
 if pycompat.ispy3:
@@ -136,6 +137,7 @@
 import inspect
 getargspec = inspect.getargspec
 _byteskwargs = identity
+_bytestr = str
 fsencode = identity   # no py3 support
 _maxint = sys.maxint  # no py3 support
 _sysstr = lambda x: x # no py3 support
@@ -357,16 +359,16 @@
  % item))
 continue
 try:
-time_limit = float(pycompat.sysstr(parts[0]))
+time_limit = float(_sysstr(parts[0]))
 except ValueError as e:
 ui.warn((b'malformatted run limit entry, %s: %s\n'
- % (pycompat.bytestr(e), item)))
+ % (_bytestr(e), item)))
 continue
 try:
-run_limit = int(pycompat.sysstr(parts[1]))
+run_limit = int(_sysstr(parts[1]))
 except ValueError as e:
 ui.warn((b'malformatted run limit entry, %s: %s\n'
- % (pycompat.bytestr(e), item)))
+ % (_bytestr(e), item)))
 continue
 limits.append((time_limit, run_limit))
 if not limits:
@@ -3061,7 +3063,7 @@
 
 def doprogress():
 with ui.makeprogress(topic, total=total) as progress:
-for i in pycompat.xrange(total):
+for i in _xrange(total):
 progress.increment()
 
 timer(doprogress)



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


D6744: perf: don't try to call `util.queue` on Mercurial version before it existed

2019-08-20 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGb1e53b192497: perf: dont try to call `util.queue` on 
Mercurial version before it existed (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6744?vs=16264=16273

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

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -149,7 +149,7 @@
 try:
 queue = pycompat.queue
 except (NameError, AttributeError, ImportError):
-queue = util.queue
+import Queue as queue
 
 try:
 from mercurial import logcmdutil



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


D6743: perf: handle NameError for `pycompat.foo` when pycompat wasn't imported

2019-08-20 Thread martinvonz (Martin von Zweigbergk)
Closed by commit rHGfd62b027d6a4: perf: handle NameError for `pycompat.foo` 
when pycompat wasnt imported (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6743?vs=16263=16272

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

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -132,7 +132,7 @@
 _maxint = sys.maxsize  # per py3 docs for replacing maxint
 else:
 _maxint = sys.maxint
-except (ImportError, AttributeError):
+except (NameError, ImportError, AttributeError):
 import inspect
 getargspec = inspect.getargspec
 _byteskwargs = identity
@@ -144,11 +144,11 @@
 try:
 # 4.7+
 queue = pycompat.queue.Queue
-except (AttributeError, ImportError):
+except (NameError, AttributeError, ImportError):
 # <4.7.
 try:
 queue = pycompat.queue
-except (AttributeError, ImportError):
+except (NameError, AttributeError, ImportError):
 queue = util.queue
 
 try:



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


D6746: perf: don't pass experimental argument in config for older Mercurial versions

2019-08-20 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  When this patch is ready, could we fold this into `a11fd395e83f`? I have 
`extensions.perf=contrib/perf.py` in my config and it's pretty annoying to have 
any commit in the broken range checked out.

REPOSITORY
  rHG Mercurial

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

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

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


D6746: perf: don't pass experimental argument in config for older Mercurial versions

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh marked an inline comment as done.
navaneeth.suresh updated this revision to Diff 16271.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6746?vs=16268=16271

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

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -267,6 +267,30 @@
 )
 except (ImportError, AttributeError):
 pass
+except TypeError:
+# compatibility fix for a11fd395e83f
+# hg version: 5.2
+configitem(b'perf', b'presleep',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'stub',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'parentscount',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'all-timing',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'pre-run',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'profile-benchmark',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'run-limits',
+default=mercurial.configitems.dynamicdefault,
+)
 
 def getlen(ui):
 if ui.configbool(b"perf", b"stub", False):



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


D6741: interfaces: create a new folder for interfaces and move repository.py in it

2019-08-20 Thread martinvonz (Martin von Zweigbergk)
martinvonz added a comment.


  In D6741#99030 , @durin42 wrote:
  
  > In D6741#99023 , @pulkit wrote:
  >
  >> In D6741#98947 , @martinvonz 
wrote:
  >>
   I was trying to understand current interfaces and write new ones and I 
realized
   we need to improve how current interfaces are organised.
  >>>
  >>> And what was the reason we need to improve it? I assume we don't really 
"need" to change it. Will it somehow help with future patches? Or you just like 
this structure better?
  >>
  >> Looking through Augie's hgit patch, I found we need to add more interfaces 
and decided to work on adding for `store.basicstore`. I found all the current 
interfaces in repository.py which has grown very large. I decided to create a 
new file to have interface for the store class, and maybe a new one for 
dirstate too, and having them in a separate folder dedicated to interfaces will 
be nice.
  >
  > I'm inclined to agree - the repository.py file full of interfaces has 
gotten crufty. It'd be nice to split it out into more files by topic.
  
  That makes sense to me too.

REPOSITORY
  rHG Mercurial

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

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

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


D6741: interfaces: create a new folder for interfaces and move repository.py in it

2019-08-20 Thread durin42 (Augie Fackler)
durin42 added a comment.


  In D6741#99023 , @pulkit wrote:
  
  > In D6741#98947 , @martinvonz 
wrote:
  >
  >>> I was trying to understand current interfaces and write new ones and I 
realized
  >>> we need to improve how current interfaces are organised.
  >>
  >> And what was the reason we need to improve it? I assume we don't really 
"need" to change it. Will it somehow help with future patches? Or you just like 
this structure better?
  >
  > Looking through Augie's hgit patch, I found we need to add more interfaces 
and decided to work on adding for `store.basicstore`. I found all the current 
interfaces in repository.py which has grown very large. I decided to create a 
new file to have interface for the store class, and maybe a new one for 
dirstate too, and having them in a separate folder dedicated to interfaces will 
be nice.
  
  I'm inclined to agree - the repository.py file full of interfaces has gotten 
crufty. It'd be nice to split it out into more files by topic.

REPOSITORY
  rHG Mercurial

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

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

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


D6741: interfaces: create a new folder for interfaces and move repository.py in it

2019-08-20 Thread pulkit (Pulkit Goyal)
pulkit added a comment.


  In D6741#98947 , @martinvonz 
wrote:
  
  >> I was trying to understand current interfaces and write new ones and I 
realized
  >> we need to improve how current interfaces are organised.
  >
  > And what was the reason we need to improve it? I assume we don't really 
"need" to change it. Will it somehow help with future patches? Or you just like 
this structure better?
  
  Looking through Augie's hgit patch, I found we need to add more interfaces 
and decided to work on adding for `store.basicstore`. I found all the current 
interfaces in repository.py which has grown very large. I decided to create a 
new file to have interface for the store class, and maybe a new one for 
dirstate too, and having them in a separate folder dedicated to interfaces will 
be nice.

REPOSITORY
  rHG Mercurial

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

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

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


D6748: hgit: define invalidatecaches for gitstore()

2019-08-20 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

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

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
@@ -71,6 +71,9 @@
 # TODO handle storenarrowmatch and figure out if we need the repo arg
 return gitlog.manifestlog(self.git, self._db)
 
+def invalidatecaches(self):
+pass
+
 def _makestore(orig, requirements, storebasepath, vfstype):
 if (os.path.exists(os.path.join(storebasepath, 'this-is-git'))
 and os.path.exists(os.path.join(storebasepath, '..', '.git'))):



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


D6747: hgit: fix some pyflakes and check-code warning

2019-08-20 Thread pulkit (Pulkit Goyal)
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  I mostly added absolute_import and fixed warnings related to undefined name.
  This should get folded in the main hgit RFC patch.
  
  There are still more failures but they are harmless as of now.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  hgext/git/__init__.py
  hgext/git/dirstate.py
  hgext/git/gitlog.py
  hgext/git/index.py

CHANGE DETAILS

diff --git a/hgext/git/index.py b/hgext/git/index.py
--- a/hgext/git/index.py
+++ b/hgext/git/index.py
@@ -1,8 +1,13 @@
+from __future__ import absolute_import
+
 import os
 import sqlite3
 
+from mercurial.i18n import _
+
 from mercurial import (
 encoding,
+error,
 node as nodemod,
 )
 
diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py
--- a/hgext/git/gitlog.py
+++ b/hgext/git/gitlog.py
@@ -1,3 +1,7 @@
+from __future__ import absolute_import
+
+from mercurial.i18n import _
+
 from mercurial import (
 ancestor,
 changelog as hgchangelog,
@@ -24,7 +28,7 @@
 'SELECT rev FROM changelog WHERE node = ?',
 (nodemod.hex(n),)).fetchone()
 if t is None:
-raise error.LookupError(node, '00changelog.i', _('no node'))
+raise error.LookupError(n, '00changelog.i', _('no node'))
 return t[0]
 
 def node(self, r):
@@ -34,7 +38,7 @@
 'SELECT node FROM changelog WHERE rev = ?',
 (r,)).fetchone()
 if t is None:
-raise error.LookupError(node, '00changelog.i', _('no node'))
+raise error.LookupError(r, '00changelog.i', _('no node'))
 return nodemod.bin(t[0])
 
 
@@ -112,7 +116,7 @@
 if c.parents:
 p1 = self.rev(c.parents[0].id.raw)
 if len(c.parents) > 2:
-raise util.Abort('TODO octopus merge handling')
+raise error.Abort('TODO octopus merge handling')
 if len(c.parents) == 2:
 p2 = self.rev(c.parents[0].id.raw)
 return p1, p2
@@ -172,7 +176,7 @@
 parts = relpath.split('/')
 for p in parts:
 te = t[p]
-t = repo[te.id]
+t = self.gitrepo[te.id]
 return gittreemanifestctx(t)
 
 class filelog(baselog):
diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py
--- a/hgext/git/dirstate.py
+++ b/hgext/git/dirstate.py
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+
 import errno
 import os
 import stat
@@ -18,7 +20,7 @@
 
 
 def readpatternfile(orig, filepath, warn, sourceinfo=False):
-if not ('info/exclude' in fp.name or fp.name.endswith('.gitignore')):
+if not ('info/exclude' in filepath or filepath.endswith('.gitignore')):
 return orig(filepath, warn, sourceinfo=False)
 result = []
 warnings = []
@@ -270,7 +272,7 @@
 
 # git stores symlinks with a mode of 000, we need it to be 777
 if mode == stat.S_IFLNK:
-mode = mode | 0777
+mode = mode | 0o777
 
 # this is a crude hack, but makes 'hg forget' work
 if p not in p1:
diff --git a/hgext/git/__init__.py b/hgext/git/__init__.py
--- a/hgext/git/__init__.py
+++ b/hgext/git/__init__.py
@@ -4,6 +4,8 @@
 firstborn a la Rumpelstiltskin, etc.
 """
 
+from __future__ import absolute_import
+
 import os
 
 from mercurial import (



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


D6746: perf: don't pass experimental argument in config for older Mercurial versions

2019-08-20 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> perf.py:270
>  pass
> +except TypeError:
> +configitem(b'perf', b'presleep',

Can you add the commit hash and hg version (5.2 in this case) as comment due to 
which the compatibility is need?

REPOSITORY
  rHG Mercurial

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

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

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


D6746: perf: don't pass experimental argument in config for older Mercurial versions

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This is a follow-up patch to a11fd395e83f 
. 
This patch makes older Mercurial
  versions to not use `experimental` argument in config options.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  contrib/perf.py

CHANGE DETAILS

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -267,6 +267,28 @@
 )
 except (ImportError, AttributeError):
 pass
+except TypeError:
+configitem(b'perf', b'presleep',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'stub',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'parentscount',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'all-timing',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'pre-run',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'profile-benchmark',
+default=mercurial.configitems.dynamicdefault,
+)
+configitem(b'perf', b'run-limits',
+default=mercurial.configitems.dynamicdefault,
+)
 
 def getlen(ui):
 if ui.configbool(b"perf", b"stub", False):



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


D6731: exchange: abort on pushing bookmarks pointing to secret changesets (issue6159)

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added inline comments.

INLINE COMMENTS

> pulkit wrote in exchange.py:1044
> You won't need `ctx = pushop.repo[node]` anymore then.
> 
> In general, I suggest understanding the error as why are they are happening 
> and you will find a fix.

`ctx = pushop.repo[node]` is needed to check the phase of the ctx. also, iiuc, 
if i write `if a and b: pass` in python, both a and b are evaluated before 
performing the comparison. iiuc, when ctx is `None`, `ctx.phase()` won't exist 
as `ctx = repo[None]` is not actually a changeset but, the uncommitted changes 
in the working directory instead. if we need to skip the return, we need to 
have the `ctx = pushop.repo[node]` inside the `if` statement. but, for me, 
skipping the further evaluation earlier using a `return` without the nested 
`if` with more alignment sounds good.

REPOSITORY
  rHG Mercurial

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

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

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


D6731: exchange: abort on pushing bookmarks pointing to secret changesets (issue6159)

2019-08-20 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> navaneeth.suresh wrote in exchange.py:1044
> I'm getting the following error with the code snippet that you've suggested:
> 
>   +  Traceback (most recent call last):
>   +File "/tmp/hgtests.nS3TJv/install/bin/hg", line 43, in 
>   +  dispatch.run()
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
> line 99, in run
>   +  status = dispatch(req)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
> line 225, in dispatch
>   +  ret = _runcatch(req) or 0
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
> line 376, in _runcatch
>   +  return _callcatch(ui, _runcatchfunc)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
> line 384, in _callcatch
>   +  return scmutil.callcatch(ui, func)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/scmutil.py", 
> line 167, in callcatch
>   +  return func()
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
> line 367, in _runcatchfunc
>   +  return _dispatch(req)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
> line 1021, in _dispatch
>   +  cmdpats, cmdoptions)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
> line 756, in runcommand
>   +  ret = _runcommand(ui, options, cmd, d)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
> line 1030, in _runcommand
>   +  return cmdfunc()
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
> line 1018, in 
>   +  d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/util.py", line 
> 1682, in check
>   +  return func(*args, **kwargs)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/commands.py", 
> line 4666, in push
>   +  opargs=opargs)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
> line 568, in push
>   +  _pushbundle2(pushop)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
> line 1149, in _pushbundle2
>   +  ret = partgen(pushop, bundler)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
> line 1025, in _pushb2bookmarks
>   +  return _pushb2bookmarkspart(pushop, bundler)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
> line 1052, in _pushb2bookmarkspart
>   +  _abortonsecretctx(pushop, new, book)
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
> line 1039, in _abortonsecretctx
>   +  ctx = pushop.repo[node]
>   +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/localrepo.py", 
> line 1430, in __getitem__
>   +  (changeid, type(changeid)))
>   +  mercurial.error.ProgrammingError: unsupported changeid '' of type  'str'>
>  [1]

You won't need `ctx = pushop.repo[node]` anymore then.

In general, I suggest understanding the error as why are they are happening and 
you will find a fix.

REPOSITORY
  rHG Mercurial

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

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

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


D6731: exchange: abort on pushing bookmarks pointing to secret changesets (issue6159)

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added inline comments.
navaneeth.suresh marked an inline comment as done.

INLINE COMMENTS

> pulkit wrote in exchange.py:1044
> If the node is None, then `if node and ` will be false and the second 
> condition won't be executed.

I'm getting the following error with the code snippet that you've suggested:

  +  Traceback (most recent call last):
  +File "/tmp/hgtests.nS3TJv/install/bin/hg", line 43, in 
  +  dispatch.run()
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
line 99, in run
  +  status = dispatch(req)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
line 225, in dispatch
  +  ret = _runcatch(req) or 0
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
line 376, in _runcatch
  +  return _callcatch(ui, _runcatchfunc)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
line 384, in _callcatch
  +  return scmutil.callcatch(ui, func)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/scmutil.py", line 
167, in callcatch
  +  return func()
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
line 367, in _runcatchfunc
  +  return _dispatch(req)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
line 1021, in _dispatch
  +  cmdpats, cmdoptions)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
line 756, in runcommand
  +  ret = _runcommand(ui, options, cmd, d)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
line 1030, in _runcommand
  +  return cmdfunc()
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/dispatch.py", 
line 1018, in 
  +  d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/util.py", line 
1682, in check
  +  return func(*args, **kwargs)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/commands.py", 
line 4666, in push
  +  opargs=opargs)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
line 568, in push
  +  _pushbundle2(pushop)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
line 1149, in _pushbundle2
  +  ret = partgen(pushop, bundler)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
line 1025, in _pushb2bookmarks
  +  return _pushb2bookmarkspart(pushop, bundler)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
line 1052, in _pushb2bookmarkspart
  +  _abortonsecretctx(pushop, new, book)
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/exchange.py", 
line 1039, in _abortonsecretctx
  +  ctx = pushop.repo[node]
  +File "/tmp/hgtests.nS3TJv/install/lib/python/mercurial/localrepo.py", 
line 1430, in __getitem__
  +  (changeid, type(changeid)))
  +  mercurial.error.ProgrammingError: unsupported changeid '' of type 
 [1]

REPOSITORY
  rHG Mercurial

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

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

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


D6736: shelve: add method for storing mergestate in changeset extras

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added inline comments.

INLINE COMMENTS

> pulkit wrote in shelve.py:416
> What do you think about refactoring the code to write mergestate v2 on disk 
> and use that encoding to achieve this?

i feel like the current approach is more simpler and easy to understand.

REPOSITORY
  rHG Mercurial

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

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

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


D6738: unshelve: add --unresolved flag to unshelve mergestate with unresolved files

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added inline comments.

INLINE COMMENTS

> pulkit wrote in shelve.py:754
> we should write both the versions, `_writerecords()` should be used.

i had tried to support it earlier. but, it throws the following error. i think 
it's okay to use the latest format only since, we haven't stored any mergestate 
using the previous format. the repo won't get corrupted.

  +  Traceback (most recent call last):
  +File "/tmp/hgtests.TEheee/install/bin/hg", line 43, in 
  +  dispatch.run()
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/dispatch.py", 
line 99, in run
  +  status = dispatch(req)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/dispatch.py", 
line 225, in dispatch
  +  ret = _runcatch(req) or 0
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/dispatch.py", 
line 376, in _runcatch
  +  return _callcatch(ui, _runcatchfunc)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/dispatch.py", 
line 384, in _callcatch
  +  return scmutil.callcatch(ui, func)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/scmutil.py", line 
167, in callcatch
  +  return func()
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/dispatch.py", 
line 367, in _runcatchfunc
  +  return _dispatch(req)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/dispatch.py", 
line 1021, in _dispatch
  +  cmdpats, cmdoptions)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/dispatch.py", 
line 756, in runcommand
  +  ret = _runcommand(ui, options, cmd, d)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/dispatch.py", 
line 1030, in _runcommand
  +  return cmdfunc()
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/dispatch.py", 
line 1018, in 
  +  d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/util.py", line 
1682, in check
  +  return func(*args, **kwargs)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/commands.py", 
line 6229, in unshelve
  +  return shelvemod.dounshelve(ui, repo, *shelved, **opts)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/shelve.py", line 
1090, in dounshelve
  +  restoreunresolvedshelve(ui, repo, shelvectx, basename)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/shelve.py", line 
754, in restoreunresolvedshelve
  +  ms._writerecords(_decodemergerecords(records))
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/merge.py", line 
452, in _writerecords
  +  self._writerecordsv1(records)
  +File "/tmp/hgtests.TEheee/install/lib/python/mercurial/merge.py", line 
460, in _writerecordsv1
  +  assert lrecords[0] == RECORD_LOCAL
  +  AssertionError
  +  [1]

REPOSITORY
  rHG Mercurial

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

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

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


D6731: exchange: abort on pushing bookmarks pointing to secret changesets (issue6159)

2019-08-20 Thread pulkit (Pulkit Goyal)
pulkit added inline comments.

INLINE COMMENTS

> navaneeth.suresh wrote in exchange.py:1044
> updated to get rid of one return. if node is `None`, then hg will throw an 
> error there.

If the node is None, then `if node and ` will be false and the second 
condition won't be executed.

REPOSITORY
  rHG Mercurial

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

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

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


D6731: exchange: abort on pushing bookmarks pointing to secret changesets (issue6159)

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added inline comments.
navaneeth.suresh marked 2 inline comments as done.

INLINE COMMENTS

> pulkit wrote in exchange.py:1044
> What does the return value mean here? I think we can get rid of this.
> 
> Something like this:
> 
>   if node and pushop.repo[node].phase() == phases.secret:
>  raise 

updated to get rid of one return. if node is `None`, then hg will throw an 
error there.

REPOSITORY
  rHG Mercurial

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

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

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


D6731: exchange: abort on pushing bookmarks pointing to secret changesets (issue6159)

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh updated this revision to Diff 16267.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6731?vs=16258=16267

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

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

AFFECTED FILES
  mercurial/exchange.py
  tests/test-bookmarks-pushpull.t

CHANGE DETAILS

diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -1345,10 +1345,15 @@
   $ hg log -r . --template '{node}'
   cf489fd8a374cab73c2dc19e899bde6fe3a43f8f (no-eol)
 
+Create a bookmark that points to a non-secret changeset
+  $ hg bookmark bar
+  $ echo c > c
+  $ hg ci -Am_
+  adding c
 
 Pushing the bookmark "foo" now fails as it contains a secret changeset
 #if b2-pushkey
-  $ hg push -r foo
+  $ hg push
   pushing to $TESTTMP/issue6159remote
   searching for changes
   no changes found (ignored 1 secret changesets)
@@ -1357,26 +1362,10 @@
 #endif
 
 #if b2-binary
-  $ hg push -r foo
+  $ hg push
   pushing to $TESTTMP/issue6159remote
   searching for changes
-  no changes found (ignored 1 secret changesets)
-  updating bookmark foo
-  [1]
+  no changes found (ignored 2 secret changesets)
+  abort: cannot push bookmark foo as it points to a secret changeset
+  [255]
 #endif
-
-Now the "remote" repo contains a bookmark pointing to a nonexistent revision
-$ cd ../issue6159remote
-#if b2-pushkey
-  $ hg bookmark
-   * foo   1:cf489fd8a374
-  $ hg log -r cf489fd8a374
-  1:cf489fd8a374 _ (no-eol)
-#endif
-
-#if b2-binary
-  $ hg bookmark
-   * foo   1:cf489fd8a374
-  $ hg log -r cf489fd8a374
-  1:cf489fd8a374 _ (no-eol)
-#endif
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1034,6 +1034,15 @@
 return 'delete'
 return 'update'
 
+def _abortonsecretctx(pushop, node, b):
+"""abort if a given bookmark points to a secret changeset"""
+if not node:
+return
+ctx = pushop.repo[node]
+if node and ctx.phase() == phases.secret:
+raise error.Abort(_('cannot push bookmark %s as it points to a secret'
+' changeset') % b)
+
 def _pushb2bookmarkspart(pushop, bundler):
 pushop.stepsdone.add('bookmarks')
 if not pushop.outbookmarks:
@@ -1042,6 +1051,7 @@
 allactions = []
 data = []
 for book, old, new in pushop.outbookmarks:
+_abortonsecretctx(pushop, new, book)
 new = bin(new)
 data.append((book, new))
 allactions.append((book, _bmaction(old, new)))
@@ -1070,6 +1080,7 @@
 assert False
 
 for book, old, new in pushop.outbookmarks:
+_abortonsecretctx(pushop, new, book)
 part = bundler.newpart('pushkey')
 part.addparam('namespace', enc('bookmarks'))
 part.addparam('key', enc(book))



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


D6740: tests: add test to demonstrate issue6159

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh added a comment.


  @pulkit Now I'm unable to reproduce the test result given in the bug report. 
It seems like the remote repo recognizes the secret changeset `cf489fd8a374`.

REPOSITORY
  rHG Mercurial

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

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

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


D6740: tests: add test to demonstrate issue6159

2019-08-20 Thread navaneeth.suresh (Navaneeth Suresh)
navaneeth.suresh marked 3 inline comments as done.
navaneeth.suresh updated this revision to Diff 16266.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6740?vs=16257=16266

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

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

AFFECTED FILES
  tests/test-bookmarks-pushpull.t

CHANGE DETAILS

diff --git a/tests/test-bookmarks-pushpull.t b/tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t
+++ b/tests/test-bookmarks-pushpull.t
@@ -1322,3 +1322,61 @@
   abort: push failed on remote
   [255]
 #endif
+
+-- test for pushing bookmarks pointing to secret changesets
+
+Set up a "remote" repo
+  $ hg init issue6159remote
+  $ cd issue6159remote
+  $ echo a > a
+  $ hg add a
+  $ hg commit -m_
+  $ hg bookmark foo
+  $ cd ..
+
+Clone a local repo
+  $ hg clone -q issue6159remote issue6159local
+  $ cd issue6159local
+  $ hg up -qr foo
+  $ echo b > b
+
+Move the bookmark "foo" to point at a secret changeset
+  $ hg commit -qAm_ --config phases.new-commit=secret
+  $ hg log -r . --template '{node}'
+  cf489fd8a374cab73c2dc19e899bde6fe3a43f8f (no-eol)
+
+
+Pushing the bookmark "foo" now fails as it contains a secret changeset
+#if b2-pushkey
+  $ hg push -r foo
+  pushing to $TESTTMP/issue6159remote
+  searching for changes
+  no changes found (ignored 1 secret changesets)
+  abort: updating bookmark foo failed!
+  [255]
+#endif
+
+#if b2-binary
+  $ hg push -r foo
+  pushing to $TESTTMP/issue6159remote
+  searching for changes
+  no changes found (ignored 1 secret changesets)
+  updating bookmark foo
+  [1]
+#endif
+
+Now the "remote" repo contains a bookmark pointing to a nonexistent revision
+$ cd ../issue6159remote
+#if b2-pushkey
+  $ hg bookmark
+   * foo   1:cf489fd8a374
+  $ hg log -r cf489fd8a374
+  1:cf489fd8a374 _ (no-eol)
+#endif
+
+#if b2-binary
+  $ hg bookmark
+   * foo   1:cf489fd8a374
+  $ hg log -r cf489fd8a374
+  1:cf489fd8a374 _ (no-eol)
+#endif



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