Matt Harbison <matt_harbison@yahoo.com> [Tue, 25 Sep 2018 22:46:18 -0400] rev 39833
convert: fix a file descriptor leak
test-check-code flagged this after I changed this line for something unrelated.
Yuya Nishihara <yuya@tcha.org> [Wed, 26 Sep 2018 20:33:09 +0900] rev 39832
merge with stable
Yuya Nishihara <yuya@tcha.org> [Tue, 25 Sep 2018 22:19:40 +0900] rev 39831
revlog: catch more specific exception in shortest()
Since revlog._partialmatch() catches RevlogError coming from cext and
re-raises AmbiguousPrefixLookupError, catching RevlogError here seems
less correct.
Differential Revision: https://phab.mercurial-scm.org/D4735
Matt Harbison <matt_harbison@yahoo.com> [Mon, 24 Sep 2018 22:32:30 -0400] rev 39830
py3: update missing module list in test-check-py3-compat.t for Windows
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 24 Sep 2018 20:31:42 -0700] rev 39829
py3: add b'' prefixes to wire protocol test
Otherwise the CBOR encoder fails on Python 3 due to lacking support
for encoding str/unicode.
# skip-blame just some b'' prefixes
Differential Revision: https://phab.mercurial-scm.org/D4734
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 24 Sep 2018 20:17:42 -0700] rev 39828
py3: use pycompat.strkwargs()
Otherwise we get an error attempting to dispatch a command with
arguments because we're passing a dict with bytes keys.
Differential Revision: https://phab.mercurial-scm.org/D4732
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 24 Sep 2018 20:10:01 -0700] rev 39827
py3: ensure _start_response() is called with system string
This was preventing HTTP 500's from being sent in Python 3.
Differential Revision: https://phab.mercurial-scm.org/D4730
Matt Harbison <matt_harbison@yahoo.com> [Sun, 23 Sep 2018 00:47:04 -0400] rev 39826
py3: convert arguments, cwd and env to native strings when spawning subprocess
This keeps Windows happy.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 21 Sep 2018 21:14:27 -0400] rev 39825
py3: apply byteskwargs to contrib/perf
Matt Harbison <matt_harbison@yahoo.com> [Fri, 21 Sep 2018 20:28:00 -0400] rev 39824
py3: un-byteify strings around os.system() and os.devnull in contrib/perf
Matt Harbison <matt_harbison@yahoo.com> [Fri, 21 Sep 2018 20:16:13 -0400] rev 39823
py3: work around the lack of sys.maxint in contrib/perf
Matt Harbison <matt_harbison@yahoo.com> [Fri, 21 Sep 2018 20:13:14 -0400] rev 39822
py3: switch contrib/perf from xrange to pycompat.xrange
Matt Harbison <matt_harbison@yahoo.com> [Fri, 21 Sep 2018 20:10:36 -0400] rev 39821
py3: handle sysstr conversion around get/set attr in contrib/perf
Matt Harbison <matt_harbison@yahoo.com> [Fri, 21 Sep 2018 20:03:07 -0400] rev 39820
py3: proxy posixfile objects to re-add a useful 'name' attribute on Windows
This file object is used in the vfs layer, so there are many errors like this:
...
File "mercurial\localrepo.py", line 2569, in savecommitmessage
return self.pathto(fp.name[len(self.root) + 1:])
TypeError: 'int' object is not subscriptable
It looks like the 'name' value is actually the fileno() value, and the
documentation says the name parameter to PyFile_FromFd() is ignored. [1] I
tried just assigning the attribute after osutil.posixfile() returns, but that
crashes saying that it's read-only.
[1] https://docs.python.org/3.6/c-api/file.html
Matt Harbison <matt_harbison@yahoo.com> [Sun, 23 Sep 2018 22:36:44 -0400] rev 39819
py3: don't use os.getcwdb() on Windows to avoid DeprecationWarnings
See also
ac32685011a3.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 21 Sep 2018 19:48:23 -0400] rev 39818
py3: rename pycompat.getcwd() to encoding.getcwd() (API)
We need to avoid os.getcwdb() on Windows to avoid DeprecationWarnings, and we
need encoding.strtolocal() to encode the result of os.getcwd().
Augie Fackler <augie@google.com> [Mon, 24 Sep 2018 22:46:22 -0400] rev 39817
py3: whitelist two more passing tests
Caught by the ratchet, but initially only the non-legacy path of
test-clone-uncompressed.t was passing. That required the preceding
patch.
Differential Revision: https://phab.mercurial-scm.org/D4729
Augie Fackler <augie@google.com> [Mon, 24 Sep 2018 22:45:32 -0400] rev 39816
keepalive: be more careful about self._rbuf when calling super impls
In Python 3, HTTPResponse implements read() in terms of readinto(),
which was calling back into our readinto(), which duplicates
self._rbuf if it's not empty. Before calling into super's read(),
ensure self._rbuf is empty.
Inheritance is bad, and undocumented self-use of your public API is
one of many reasons.
Differential Revision: https://phab.mercurial-scm.org/D4728
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 17 Sep 2018 11:50:59 -0700] rev 39815
wireprotov2: teach changesetdata to fetch ancestors until depth
For shallow clone, it is useful to specify a starting node and tell
the server to send up to N ancestors from that starting point. This
enables the server to perform the DAG walk without the client having
to discover the base/stop node(s) first.
This commit implements support for said queries on the changesetdata
command.
Differential Revision: https://phab.mercurial-scm.org/D4621
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 20 Sep 2018 12:57:23 -0700] rev 39814
wireprotov2: allow multiple fields to follow revision maps
The *data wire protocol commands emit a series of CBOR values.
Because revision/delta data may be large, their data is emitted
outside the map as a top-level bytestring value.
Before this commit, we'd emit a single optional bytestring
value after the revision descriptor map. This got the job done.
But it was limiting in that we could only send a single field.
And, it required the consumer to know that the presence of a
key in the map implied the existence of a following bytestring
value.
This commit changes the encoding strategy so top-level bytestring
values in the stream are explicitly denoted in a "fieldsfollowing"
key. This key contains an array defining what fields that follow
and the expected size of each field.
By defining things this way, we can easily send N bytestring
values without any ambiguity about their order. In addition,
clients only need to know how to parse ``fieldsfollowing`` to
know if extra values are present.
Because this breaks backwards compatibility, we've bumped the version
number of the wire protocol version 2 API endpoint.
Differential Revision: https://phab.mercurial-scm.org/D4620
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 17 Sep 2018 11:54:00 -0700] rev 39813
wireprotov2: advertise set of valid values for requestable fields
changesetdata, manifestdata, and filedata all allow the caller to
specify what data fields to request.
Data fields are extensible and may evolve over time. In order to
prevent clients from making requests for fields that are not
available, the client needs to know what fields are available.
This commit teaches the server to declare a set of "valid values"
for wire protocol command arguments. That set of values is exposed
in the command's capabilities descriptor. The changesetdata,
manifestdata, and filedata commands all declare their set of
available "fields."
Differential Revision: https://phab.mercurial-scm.org/D4619
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 17 Sep 2018 10:15:27 -0700] rev 39812
wireprotov2: expose rich arguments metadata
Now that we internally store rich metadata about arguments, it makes
sense to make that metadata available to the client. This will allow
clients to validate outgoing command requests before they are sent
over the wire.
Strictly speaking, we should bump the wire protocol version for this
change since it is backwards incompatible. But no client-side code
touches the arguments map and I don't want to incur the work.
Differential Revision: https://phab.mercurial-scm.org/D4618
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 17 Sep 2018 09:49:28 -0700] rev 39811
wireprotov2: advertise recognized path filter prefixes
While the wire protocol doesn't yet support it, we'll eventually
have commands that accept narrow patterns to specify the set of
files relevant to a command.
For security and performance reasons, only specific filter types
are allowed.
This commit teaches the server to advertise the set of allowed
filter types. By doing so, clients can e.g. validate user-specified
patterns against the server's abilities without having to send
a command to retrieve data.
Having the data in the capabilities data structure will also serve
as a check against unwanted BC.
Differential Revision: https://phab.mercurial-scm.org/D4616
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 30 Aug 2018 17:43:47 -0700] rev 39810
wireprotov2: declare command arguments richly
Previously, we declared command arguments with an example of
their value. After this commit, we declare command arguments
as a dict of metadata. This allows us to define the value
type, whether the argument is required, and provide default
values. This in turn allows us to have nice things, such as
less boilerplate code in individual commands for validating
input and assigning default values. It should also make command
behavior more consistent as a result.
Test output changed slightly because I realized that the "fields"
argument wasn't being consistently defined as a set. Oops!
Other test output changed because of slight differences in code
performing type validation.
Differential Revision: https://phab.mercurial-scm.org/D4615
Yuya Nishihara <yuya@tcha.org> [Wed, 26 Sep 2018 21:24:14 +0900] rev 39809
chgserver: do not send system() back to client if stdio redirected (
issue5992)
As the chg client doesn't know server-side stdio redirection, the server
shouldn't upcall on "runsystem" request if the stdio streams are redirected.
This patch teaches ui to remember the redirection flag, which is updated by
the caller right now. Future patches (for default) will add ui methods to
manage this flag internally.
Yuya Nishihara <yuya@tcha.org> [Wed, 26 Sep 2018 21:21:05 +0900] rev 39808
chgserver: update comment describing when to fall back to core _runsystem()
The condition "output needs to be captured" was moved to the core ui, and
removed at
fbce78c58f1e "chg: refactor ui.system() to be partly overridden."
The next patch will add one more "if" to address the issue 5992.
Yuya Nishihara <yuya@tcha.org> [Wed, 26 Sep 2018 20:53:59 +0900] rev 39807
procutil: compare fd number to see if stdio protection is needed (
issue5992)
When I wrote this function for commandserver at
69f86b937035, testing object
identity was suffice, and I was sloppy enough not to compare fileno() values.
However, it doesn't work in chg session because chgserver reopens stdio to
apply new buffering mode.
This patch partially fixes the issue 5992. Still we have another problem in
chgui._runsystem().
Yuya Nishihara <yuya@tcha.org> [Tue, 25 Sep 2018 23:06:02 +0900] rev 39806
test-ssh: show that stdio redirection doesn't work with chg
Running tests with --chg doesn't mean all hg invocations are replaced by
chg. This patch explicitly adds the test for "chg serve --stdio", which does
weird stdio dance.
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Tue, 25 Sep 2018 16:32:38 -0400] rev 39805
revset: make heads(commonancestors(x + x^)) be x^, not x
Differential Revision: https://phab.mercurial-scm.org/D4742
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Tue, 25 Sep 2018 16:29:39 -0400] rev 39804
revset: add tests of heads(commonancestors(..))
The second-to-last one shows the same bug as commonancestors(..): the
result should be 8, not 9.
Differential Revision: https://phab.mercurial-scm.org/D4741
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Tue, 25 Sep 2018 16:18:43 -0400] rev 39803
revset: reword commonancestor()'s help
The new version seems a bit more consistent with other doc comments,
and feels clearer to me (doesn't explain "commonancestors(set)" as
"common ancestors of set").
Differential Revision: https://phab.mercurial-scm.org/D4740
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Tue, 25 Sep 2018 16:14:57 -0400] rev 39802
revset: remove part of the commonancestors() comment
The reason is that:
- it shows up in "hg help revset", but it doesn't look like
documentation targeted at users
- it doesn't make sense to me: it doesn't say what happens with < 2
revisions, and is not quite right because my understanding is that
this revset was created precisely because "::x and ::y" was not
quite the same (when x and y don't evaluate to singletons).
Differential Revision: https://phab.mercurial-scm.org/D4739
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Tue, 25 Sep 2018 16:05:21 -0400] rev 39801
revset: make commonancestors(x + x^) be ::(x^), not ::x
Differential Revision: https://phab.mercurial-scm.org/D4738
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Tue, 25 Sep 2018 15:27:41 -0400] rev 39800
revset: add test demonstrating a bug with commonancestor()
Specifically, 9 is clearly not in "::8 and ::9".
Differential Revision: https://phab.mercurial-scm.org/D4737
Valentin Gatien-Baron <vgatien-baron@janestreet.com> [Tue, 25 Sep 2018 16:03:14 -0400] rev 39799
revset: fix commonancestor test so it demonstrates correct behavior
The problem is that hg log -r 'head()' is every changeset in the
repository, because in this test repository, every changeset has a
different branch. The author probably assumed all commits were on the
default branch, and that they were getting topological heads, 7 and 9.
As a result, this test was showing that the common ancestors of
0:9 are 0+1+2+4, which is not correct (next commit will test this).
Differential Revision: https://phab.mercurial-scm.org/D4736
Yuya Nishihara <yuya@tcha.org> [Sat, 15 Sep 2018 17:26:23 +0900] rev 39798
annotate: pass in wdir rev and node to formatter (BC)
This is a part of the unification series. The 'ff..' hash is preferred over
None as it is a valid revision specifier.
https://www.mercurial-scm.org/wiki/GenericTemplatingPlan#Sanity_check_output
Yuya Nishihara <yuya@tcha.org> [Sat, 15 Sep 2018 17:26:22 +0900] rev 39797
annotate: pass around full hex node until formatting plain output
In short, this patch moves h[:12] from hexfn() to formathex() so that
formathex() can test if h is the wdirhex or not. This helps switching the
wdir value to wdirrev/wdirhex. See the next patch.
Yuya Nishihara <yuya@tcha.org> [Sat, 15 Sep 2018 17:26:21 +0900] rev 39796
log: fill in pseudo rev and node as wdir() manifest identifiers
While we'll never support such identifiers to look up the manifest,
this behavior seems more consistent.
Yuya Nishihara <yuya@tcha.org> [Sat, 15 Sep 2018 17:26:20 +0900] rev 39795
log: have changesetformatter fill in wdir() rev and node (BC)
This matches the behavior of the default template keywords. wdir() support
is still experimental so we can change the output.
Yuya Nishihara <yuya@tcha.org> [Sun, 23 Sep 2018 16:11:01 +0900] rev 39794
hgweb: use scmutil.binnode() to translate None to wdir hash (
issue5988)
I left some of ctx.node() calls unchanged as they seemed unlikely to be
workingctx, or passed to diff functions where None is the default value.
Note that a None revision can also cause a similar problem, but I'm not sure
if we can simply bulk-replace ctx.rev() with scmutil.intrev(ctx) as there's
large hole between tip revision and wdir revision. If such pair were passed
in to xrange() for example, we would waste CPU time.
Yuya Nishihara <yuya@tcha.org> [Sun, 23 Sep 2018 16:15:48 +0900] rev 39793
hgweb: register web.static to the config table
Otherwise we would got a develwarn.
Yuya Nishihara <yuya@tcha.org> [Sun, 23 Sep 2018 17:01:26 +0900] rev 39792
help: document web.static config
Spotted by check-config.py.
Pulkit Goyal <pulkit@yandex-team.ru> [Mon, 24 Sep 2018 00:00:04 +0300] rev 39791
py3: use pycompat.strkwargs() in contrib/simplemerge
Differential Revision: https://phab.mercurial-scm.org/D4699
Pulkit Goyal <pulkit@yandex-team.ru> [Sun, 23 Sep 2018 23:59:35 +0300] rev 39790
py3: add b'' prefixes in contrib/simplemerge
They were added using byteify-strings.py.
# skip-blame because just b'' prefixes
Differential Revision: https://phab.mercurial-scm.org/D4698
Pulkit Goyal <pulkit@yandex-team.ru> [Sun, 23 Sep 2018 23:39:07 +0300] rev 39789
tests: use assertTrue() instead of assert_() in test-bdiff.py
The later is deprecated in Python 3.
This patch also makes the test pass on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D4697
Pulkit Goyal <pulkit@yandex-team.ru> [Sun, 23 Sep 2018 23:35:38 +0300] rev 39788
py3: use '%d' for integers instead of '%s'
Python 3 does not allow using "%s" for integers.
This makes the test works on Python 3. The test still does not pass because
there is a deprecation warning.
Differential Revision: https://phab.mercurial-scm.org/D4696
Pulkit Goyal <pulkit@yandex-team.ru> [Sun, 23 Sep 2018 23:34:22 +0300] rev 39787
py3: add b'' prefixes in tests/test-bdiff.py
This makes the test close to passing
# skip-blame because just b'' prefixes
Differential Revision: https://phab.mercurial-scm.org/D4695
Pulkit Goyal <pulkit@yandex-team.ru> [Sun, 23 Sep 2018 22:57:17 +0300] rev 39786
py3: fix kwargs handling in hgext/absorb.py
This fixes couple of tests on Python 3. There is only one absorb test left
failing on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D4694