Gregory Szorc <gregory.szorc@gmail.com> [Fri, 12 Oct 2018 18:26:10 +0200] rev 40194
py3: use write() instead of print()
Because print() expects str and we want to write bytes.
There should be no functional changes as part of this.
Differential Revision: https://phab.mercurial-scm.org/D5011
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 12 Oct 2018 17:35:54 +0200] rev 40193
py3: use %d to format ints
Differential Revision: https://phab.mercurial-scm.org/D5009
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 12 Oct 2018 17:31:10 +0200] rev 40192
py3: convert sorting field to sysstr
This is used as part of an attribute name check and needs to be native str.
Differential Revision: https://phab.mercurial-scm.org/D5008
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 12 Oct 2018 17:25:02 +0200] rev 40191
py3: encode json output to bytes and use write()
Differential Revision: https://phab.mercurial-scm.org/D5007
Mark Thomas <mbthomas@fb.com> [Fri, 12 Oct 2018 17:48:40 +0000] rev 40190
absorb: prompt user to accept absorb changes by default
Change the default absorb behaviour to print the changes out and then prompt
the user if they want to absorb the changes or not.
Providing the `-p` option still prints the result and exits. A new `-a` option
is provided which applies the changes without printing them, giving the
equivalent of the old behaviour.
Differential Revision: https://phab.mercurial-scm.org/D4999
Mark Thomas <mbthomas@fb.com> [Fri, 12 Oct 2018 15:46:52 +0000] rev 40189
templatefuncs: add truncate parameter to pad
Add a truncate option to pad that additionally truncates the text to the pad
width if it is wider.
Since color codes can cause a problem with this, when the text is truncated,
the color codes are also stripped. Users of the truncate option should label
the text outside the pad.
Differential Revision: https://phab.mercurial-scm.org/D5000
Mark Thomas <mbthomas@fb.com> [Fri, 12 Oct 2018 15:46:51 +0000] rev 40188
absorb: print summary of changesets affected
Differential Revision: https://phab.mercurial-scm.org/D4998
Mark Thomas <mbthomas@fb.com> [Fri, 12 Oct 2018 13:35:58 +0000] rev 40187
absorb: use a formatter to generate output
Change absorb to use a formatter to generate its output. This allows the use
of templates to customize the output.
Differential Revision: https://phab.mercurial-scm.org/D4997
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 12:31:17 -0400] rev 40186
tests: fix up test-bad-extension.t's inline extension
Upcoming patches will be simpler, I think.
Differential Revision: https://phab.mercurial-scm.org/D5003
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 11:44:27 -0400] rev 40185
polib: update to latest release 1.0.7 (upstream rev d75ce6dbbc2a)
# no-check-commit third-party code that doesn't match our style
Differential Revision: https://phab.mercurial-scm.org/D5001
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 10:01:09 -0400] rev 40184
tests: glob away some annoying py3 differences
Differential Revision: https://phab.mercurial-scm.org/D4994
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 10:00:43 -0400] rev 40183
tests: fix a repr on python3 in test-extension.t
Differential Revision: https://phab.mercurial-scm.org/D4993
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 10:00:14 -0400] rev 40182
tests: so many b prefixes in test-extension.t
# skip-blame because it's b prefixes
Differential Revision: https://phab.mercurial-scm.org/D4992
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 09:59:11 -0400] rev 40181
tests: ensure print() statements in test-extension.t all flush
Differential Revision: https://phab.mercurial-scm.org/D4991
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 12 Oct 2018 16:19:21 +0200] rev 40180
revlog: update pure nodecache start lookup offset on insertion
test-storage.py is failing in pure builds because the population of the node
cache isn't accounting for the new starting offset after a revlog insertion.
This commit updates the node cache start offset to account for insertions.
I'm not 100% convinced this is the ideal solution. But it works and seems
correct.
Differential Revision: https://phab.mercurial-scm.org/D4996
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 03 Oct 2018 13:57:42 -0700] rev 40179
exchangev2: use filesdata
filesdata is a more efficient mechanism for bulk fetching files data for a
range of changesets. Let's use it in exchangev2.
With this change, a client performing a full clone of mozilla-unified
transmits substantially fewer bytes across the wire:
before: 139,124,863 bytes sent
after: 20,522,499 bytes sent
The bulk of the remaining bytes is likely the transfer of ~1M nodes for
changesets and manifests. We can eliminate this by making requests in
terms of node ranges instead of explicit node lists...
Differential Revision: https://phab.mercurial-scm.org/D4982
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 03 Oct 2018 12:54:39 -0700] rev 40178
wireprotov2: define and implement "filesdata" command
Previously, the only way to access file revision data was the
"filedata" command. This command is useful to have. But, it only
allowed resolving revision data for a single file. This meant that
clients needed to send 1 command for each tracked path they were
seeking data on. Furthermore, those commands would need to enumerate
the exact file nodes they wanted data for.
This approach meant that clients were sending a lot of data to
remotes in order to request file data. e.g. if there were 1M
file revisions, we'd need at least 20,000,000 bytes just to encode
file nodes! Many clients on the internet don't have that kind of
upload capacity.
In order to limit the amount of data that clients must send, we'll
need more efficient ways to request repository data.
This commit defines and implements a new "filesdata" command. This
command allows the retrieval of data for multiple files by specifying
changeset revisions and optional file patterns. The command figures
out what file revisions are "relevant" and sends them in bulk.
The logic around choosing which file revisions to send in the case of
haveparents not being set is overly simple and will over-send files. We
will need more smarts here eventually. (Specifically, the client will
need to tell the server which revisions it knows about.) This work
is deferred until a later time.
Differential Revision: https://phab.mercurial-scm.org/D4981
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 02 Oct 2018 10:31:36 -0700] rev 40177
wireprotov2: extract file object emission to own function
An upcoming commit will introduce another caller.
Differential Revision: https://phab.mercurial-scm.org/D4980
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 18:17:12 -0700] rev 40176
wireprotov2: change how revisions are specified to changesetdata
Right now, we have a handful of arguments for specifying the revisions
whose data should be returned. Defining how all these arguments
interact when various combinations are present is difficult.
This commit establishes a new, generic mechanism for specifying
revisions. Instead of a hodgepodge of arguments defining things, we
have a list of dicts that specify revision selectors. The final set
of revisions is a union of all these selectors.
We implement support for specifying revisions based on:
* An explicit list of changeset revisions
* An explicit list of changeset revisions plus ancestry depth
* A DAG range between changeset roots and heads
If you squint hard enough, this problem has already been solved by
revsets. But I'm reluctant to expose revsets to the wire protocol
because that would require servers to implement a revset parser.
Plus there are security and performance implications: the set
of revision selectors needs to be narrowly and specifically tailored
for what is appropriate to be executing on a server. Perhaps there
would be a way for us to express the "parse tree" of a revset
query, for example. I'm not sure. We can explore this space another
time. For now, the new mechanism should bring sufficient flexibility
while remaining relatively simple.
The selector "types" are prefixed with "changeset" because I plan
to add manifest and file-flavored selectors as well. This will enable
us to e.g. select file revisions based on a range of changeset
revisions.
Differential Revision: https://phab.mercurial-scm.org/D4979
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 17:54:14 -0700] rev 40175
wireprotov2: stop sending phase updates for base revisions
This feature is broken and doesn't work properly in all scenarios.
e.g. if we have the following DAGs:
client server
D draft
C draft C draft
B draft B public
A public A public
The current code would only send the phase data for C. The
client wouldn't see that B moved from draft to public.
This feature will be restored in a future commit. For now, it is
making refactoring of how revisions are specified in the wire protocol
a bit difficult...
Differential Revision: https://phab.mercurial-scm.org/D4978
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 09:47:52 +0200] rev 40174
debugcommands: support wrapping long lines
If a line within a block is indented more than the line that came before,
we automatically concatenate it with the previous line. This allows us to
pretty format data. This will make tests easier to read.
At some point we may just want to evaluate entire blocks as Python
code or something, as even with this change, things aren't perfect, as we
can't e.g. have formatting like:
foo eval:[
True
]
But this is strictly better than before, where we couldn't wrap long lines.
Differential Revision: https://phab.mercurial-scm.org/D4977
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 03 Oct 2018 13:17:00 -0700] rev 40173
exchangev2: honor server advertised manifestdata recommended batch size
Let's plug the client up to the server-advertised recommended batch size
for manifestdata requests.
Differential Revision: https://phab.mercurial-scm.org/D4976
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 17:45:51 -0700] rev 40172
wireprotov2: advertise recommended batch size for requests
Currently, exchangev2 hardcodes the batch size for how many revisions
to fetch per command request. A single value is not appropriate
for every repository because some repositories may have a drastically
different "shape" from other repositories. e.g. a repo with lots of
small files may benefit from larger batch sizes than a repo with lots
of large files. And depending on caching used by the server, the server
may wish to control the number of commands (to e.g. mitigate overhead
of following content redirects).
This commit teaches wireprotov2 commands to declare extra metadata
which is advertised as part of the command descriptor. The manifestdata
command has been taught to advertise a recommended batch size for
requests.
Differential Revision: https://phab.mercurial-scm.org/D4975
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 03 Oct 2018 13:07:28 -0700] rev 40171
httppeer: expose API descriptor on httpv2peer
The API descriptor in wireprotov2 is much more expressive than
space-delimited tokens and it will be difficult to define methods
to query it in all of the ways we'll want to query it. So let's
just declare defeat and expose the API descriptor on the peer
instance.
As part of this, we define a new interface for version 2 peers,
fulfilling a TODO in the process.
Differential Revision: https://phab.mercurial-scm.org/D4974
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 09:26:05 +0200] rev 40170
tests: use baseurl instead of advertisedbaseurl
The distinction matters for e.g. hosts behind load balancers. But for
the test environment, it doesn't matter.
For whatever reason, advertisedbaseurl is resolving to
http://1.0.0.127.in-addr.arpa:$HGPORT on my MBP. This hostname fails
to resolve, causing the test to fail. No clue what's up with that
behavior.
Differential Revision: https://phab.mercurial-scm.org/D4973
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 09:23:55 -0400] rev 40169
py3: another one started passing
Differential Revision: https://phab.mercurial-scm.org/D4990
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 06:55:11 -0400] rev 40168
py3: one more passing test
Differential Revision: https://phab.mercurial-scm.org/D4989
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 06:50:01 -0400] rev 40167
scmutil: wrap locker information in bytestr before repr()ing it
Differential Revision: https://phab.mercurial-scm.org/D4988
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 06:50:46 -0400] rev 40166
py3: more passing tests
Differential Revision: https://phab.mercurial-scm.org/D4987
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 06:35:55 -0400] rev 40165
py3: whitelist another passing test
Differential Revision: https://phab.mercurial-scm.org/D4986
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 06:22:15 -0400] rev 40164
obsolete: convert error string to a sysstr
This should be okay because we're just %-formatting a hash into a
localized string.
Differential Revision: https://phab.mercurial-scm.org/D4985
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 06:39:32 -0400] rev 40163
tests: ensure the python 3 passing test list stays sorted
Differential Revision: https://phab.mercurial-scm.org/D4984
Augie Fackler <augie@google.com> [Fri, 12 Oct 2018 06:35:33 -0400] rev 40162
py3: sort passing test list
Differential Revision: https://phab.mercurial-scm.org/D4983
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 23:07:23 +0200] rev 40161
py3: tweak stdout writing in test-hgweb-no-path-info.t
We want to write bytes for convenience. This requires sys.stdout.buffer.
But using sys.stdout.buffer introducing buffered output. So we sprinkle
code with sys.stdout.flush() to force immediate writes.
After all that, Python 3 was emitting b'' prefixed output for errors.
So we only print errors if there were some. There aren't, so b'' don't
come into play and output is identical in Python 2 and 3.
Differential Revision: https://phab.mercurial-scm.org/D4972
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 22:53:44 +0200] rev 40160
py3: use .+ instead of .* in regexp pattern
Python 3.7 changed the behavior of re.sub(). See
https://bugs.python.org/issue33585.
The new code should work on old and new Pythons.
Differential Revision: https://phab.mercurial-scm.org/D4971
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 22:26:12 +0200] rev 40159
py3: coerce bytestr to bytes to appease urllib.parse.quote_from_bytes()
Differential Revision: https://phab.mercurial-scm.org/D4969
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 21:47:39 +0200] rev 40158
py3: pass str and return bytes from mimetypes.guess_type()
This function wants a str (which represents a path) and returns a str.
We normalize input to str and output to bytes.
Differential Revision: https://phab.mercurial-scm.org/D4967
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 22:27:52 +0200] rev 40157
py3: use bytes literal in test-hgweb-json.t
# skip-blame just b'' prefix
Differential Revision: https://phab.mercurial-scm.org/D4970
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 22:01:54 +0200] rev 40156
py3: convert diff opcode name to bytes
Differential Revision: https://phab.mercurial-scm.org/D4968
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 21:22:43 +0200] rev 40155
py3: byteify hgweberror.py
# skip-blame just b'' prefixes
Differential Revision: https://phab.mercurial-scm.org/D4966
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 21:18:58 +0200] rev 40154
py3: encode JSON str to bytes
json.dumps() will emit UTF-8 str on Python 2 and 3. Use sysbytes to
force the .encode('utf-8') on Python 3 and no-op on Python 2.
Differential Revision: https://phab.mercurial-scm.org/D4965
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 11 Oct 2018 21:05:03 +0200] rev 40153
py3: use b'' in test-check-interfaces.py
# skip-blame just b'' prefixes
Differential Revision: https://phab.mercurial-scm.org/D4964
Yuya Nishihara <yuya@tcha.org> [Fri, 12 Oct 2018 06:22:43 +0200] rev 40152
revlog: optimize ancestors() to not check filtered revisions for each
While reviewing the Rust implementation, I noticed iter(ancestors) doesn't
need to check filtering state for each parent revision. And doing that appears
to have some measurable perf win.
$ hg perfancestors -R mercurial
(orig) wall 0.038093 comb 0.040000 user 0.040000 sys 0.000000 (best of 100)
(this) wall 0.024795 comb 0.020000 user 0.020000 sys 0.000000 (best of 117)
Matt Harbison <matt_harbison@yahoo.com> [Thu, 11 Oct 2018 21:51:17 -0400] rev 40151
phabricator: drop support for the legacy phabricator.auth.token config (BC)
The test for this broke in dc82ad1b7f77 when statistics started being tracked.
It wasn't noticed because none of the bots have the vcr module installed. It
looks like the custom_patches argument should patch in the custom
httpconnection, and I can't figure out what is going on.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 11 Oct 2018 22:39:11 -0400] rev 40150
absorb: print '{rev}:' as a prefix to the hash
I don't see a sane way to print the summary to identify the changed commit, but
this at least makes it a bit easier to identify a commit when a group of them
changes.
muxator <a.mux@inwind.it> [Thu, 11 Oct 2018 19:02:42 +0200] rev 40149
packaging: fix "make centos{5,6,7}"
Without this change, make centos{5,6,7} fails with error:
cp: cannot stat '<basedir>/rpmbuild/RPMS/*/*': No such file or directory
This change is the exact equivalent of bc4bbc42899a (which applied to Fedora).
Pulkit Goyal <pulkit@yandex-team.ru> [Wed, 10 Oct 2018 19:46:13 +0300] rev 40148
narrow: don't compress the bundle2 when sending 'error:abort'
This is similar to waht getbundle() does and also explicitly specifies that we
should get a compressed bundle2 in normal cases when not sending 'error:abort'.
Differential Revision: https://phab.mercurial-scm.org/D4934
Taapas Agrawal <taapas2897@gmail.com> [Thu, 11 Oct 2018 03:38:23 +0530] rev 40147
push: add "remote" to 'repository changed while pushing' messages (issue5971)
Differential Revision: https://phab.mercurial-scm.org/D4933
Augie Fackler <augie@google.com> [Thu, 11 Oct 2018 07:27:24 -0400] rev 40146
fuzz: try setting PYTHONNOUSERSITE=1 to avoid loading site-packages
Right now the fuzzer is crashing trying to look up the home dir for
uid 0, which is breaking in the fuzz environment.
Differential Revision: https://phab.mercurial-scm.org/D4936
Boris Feld <boris.feld@octobus.net> [Wed, 03 Oct 2018 10:46:56 +0200] rev 40145
perf: extract result formatting in its own function
This will make it easier to reuse in another changesets.
Boris Feld <boris.feld@octobus.net> [Tue, 02 Oct 2018 18:54:06 +0200] rev 40144
perf: extract the timing of a section in a context manager
This makes it easier to reuse it in other (future) part of the code that
requires their own time management.
Boris Feld <boris.feld@octobus.net> [Mon, 01 Oct 2018 17:23:54 +0200] rev 40143
pref: support negative indexing in perfrevlogrevisions
This is useful to check for a consistent final slice in multiple different repositories.
Boris Feld <boris.feld@octobus.net> [Mon, 01 Oct 2018 17:37:38 +0200] rev 40142
perf: accept formatter option for perfmanifest
Boris Feld <boris.feld@octobus.net> [Mon, 01 Oct 2018 17:53:47 +0200] rev 40141
perf: fix -T json
The previous code was mixing formatting and data, breaking `-T json` with
unexpected data. We fix the issue and add a test to prevent future regression.
Boris Feld <boris.feld@octobus.net> [Mon, 01 Oct 2018 17:37:53 +0200] rev 40140
formatter: more details on assertion failure
This is useful when the assertion fails.
Gregory Szorc <gregory.szorc@gmail.com> [Wed, 10 Oct 2018 23:19:42 -0700] rev 40139
wireprotov2: raise ProgrammingError on unknown action
Suggested by @durin42 in review of D4923.
Differential Revision: https://phab.mercurial-scm.org/D4935
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 17:24:28 -0700] rev 40138
wireprotov2: send content encoded frames from server
Now that we have support for negotiating encodings and configuring
an encoder, we can start sending content encoded frames from the
server.
This commit teaches the wireprotov2 server code to send content
encoded frames.
On the mozilla-unified repository with zstd enabled peers, this change
reduces the total amount of data transferred from server to client
drastically:
befor: 7,190,995,812 bytes
after: 1,605,508,691 bytes
Differential Revision: https://phab.mercurial-scm.org/D4927
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 15:19:32 -0700] rev 40137
wireprotov2: raise exception in objects() if future has been resolved
Differential Revision: https://phab.mercurial-scm.org/D4926
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 05 Oct 2018 23:49:18 +0000] rev 40136
wireprotov2: don't emit empty frames
Staring at logs revealed the presence of empty frames that should have
contained payload. Let's stop that from happening.
Differential Revision: https://phab.mercurial-scm.org/D4925
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 05 Oct 2018 10:29:36 -0700] rev 40135
wireprotov2: remove functions for creating response frames from bytes
All code in the actual server uses oncommandresponsereadyobjects().
Test code was ported to that method. This resulted in a handful of
subtle test changes.
Differential Revision: https://phab.mercurial-scm.org/D4924
Gregory Szorc <gregory.szorc@gmail.com> [Fri, 05 Oct 2018 09:23:06 -0700] rev 40134
wireprotov2: handle noop action
This action can be returned from the client reactor. We should
handle it.
Differential Revision: https://phab.mercurial-scm.org/D4923
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 17:00:16 -0700] rev 40133
wireprotov2: send protocol settings frame from client
Now that we have client and server reactor support for protocol
settings and encoding frames, we can start to send them out over
the wire!
This commit teaches the client reactor to send out a protocol
settings frame when needed. The httpv2 peer has been taught to
gather a list of supported content encoders and to advertise them
through the client reactor.
Because the client is now sending new frame types by default, this
constitutes a compatibility break in the framing protocol. The
media type version has been bumped accordingly. This will ensure
existing clients won't attempt to send the new frames to old
servers not supporting this explicit media type. I'm not bothering
with the BC annotation because everything wireprotov2 is highly
experimental and nobody should be running a server yet.
Differential Revision: https://phab.mercurial-scm.org/D4922
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 17:10:59 -0700] rev 40132
wireprotov2: define and use stream encoders
Now that we have basic support for defining stream encoding, it is
time to start doing something with it.
We define various classes implementing stream encoders/decoders for
the defined encoding profiles. This is relatively straightforward.
We teach the inputstream and outputstream classes how to encode,
decode, and flush data.
We then teach the clientreactor how to filter received data through
the inputstream decoder.
One of the features of the framing format is that streams can span
requests. This is a differentiating feature from say HTTP/2, which
associates streams with requests. By allowing streams to span requests,
we can reuse compression context data across requests/responses. But
in order to do this, we need a mechanism to "flush" the encoder at
logical boundaries so that receivers receive all data where it is
expected. And a "flush" event is distinct from a "finish" event from
the perspective of certain compressors because a "flush" will retain
compression context state whereas a "finish" operation will not. This
is why encoders have both a flush() and a finish() and each uses
specific flushing semantics on the underlying compressor.
The added tests verify various behavior of decoders via clientreactor.
These tests do test some compression behavior via use of outputstream.
But for all intents and purposes, server reactor support for encoding
is not yet implemented.
Differential Revision: https://phab.mercurial-scm.org/D4921
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 04 Oct 2018 17:39:16 -0700] rev 40131
wireprotov2: establish dedicated classes for input and output streams
Streams are unidirectional. As part of implementing encoding/decoding
support, it became clear that it didn't make sense for a generic
"stream" class to hold functionality related to both encoding and
decoding. So we create new classes to represent the flavor of
stream.
Differential Revision: https://phab.mercurial-scm.org/D4920
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 04 Oct 2018 17:17:57 -0700] rev 40130
wireprotov2: pass ui into clientreactor and serverreactor
This will allow us to use config options to influence compression
settings.
Differential Revision: https://phab.mercurial-scm.org/D4919
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 04 Oct 2018 16:44:21 -0700] rev 40129
wireprotov2: handle stream encoding settings frames
Like what we just did for the server reactor, we teach the client
reactor to handle stream encoding settings frames. The code is
very similar.
We define a method on the stream class to handle processing the data
within the decoded frames. However, it doesn't yet do anything useful.
Differential Revision: https://phab.mercurial-scm.org/D4918
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 04 Oct 2018 15:43:21 -0700] rev 40128
wireprotov2: document client reactor actions
We should document these so consumers have an easier life.
Differential Revision: https://phab.mercurial-scm.org/D4917
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 04 Oct 2018 16:26:45 -0700] rev 40127
wireprotov2: handle sender protocol settings frames
We teach the server reactor to handle the optional sender protocol
settings frames, which can only be sent at the beginning of frame
exchange.
Right now, we simply decode the data and record the sender protocol
settings on the server reactor instance: we don't yet do anything
meaningful with the data.
Differential Revision: https://phab.mercurial-scm.org/D4916
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 04 Oct 2018 14:05:16 -0700] rev 40126
wireprotov2: update stream encoding specification
The encoding of data within streams in the frame-based protocol is
not yet defined or implemented. This means that all data in wire
protocol version 2 is currently being sent out raw, without
compression. That's obviously not ideal.
This commit formalizes the beginnings of stream encoding support
in the protocol.
I suspect we'll change behavior substantially in the future. My goal
is to get something landed so we can use compression. We can build
out more robust support later.
Because the frame type ID changed, this is strictly BC. But existing
code wasn't using the frame. I'll bump the framing protocol version
later once code is introduced to use the new frame.
Differential Revision: https://phab.mercurial-scm.org/D4915
Gregory Szorc <gregory.szorc@gmail.com> [Thu, 04 Oct 2018 15:08:42 -0700] rev 40125
cborutil: cast bytearray to bytes
This code didn't like passing in bytearray instances. Let's cast
bytearray to bytes so it works.
Differential Revision: https://phab.mercurial-scm.org/D4914
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 17:06:24 -0700] rev 40124
tests: disable zstd in test
This makes the test pass in pure installs.
Differential Revision: https://phab.mercurial-scm.org/D4913
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 17:20:41 -0700] rev 40123
wireprotov2: remove "compression" from capabilities response
This is not used. And future commits will change how this mechanism
works. Let's remove it.
As a bonus, this fixes some test failures on pure installs (due to
zstd references).
Differential Revision: https://phab.mercurial-scm.org/D4912
Gregory Szorc <gregory.szorc@gmail.com> [Mon, 08 Oct 2018 16:27:40 -0700] rev 40122
zstandard: vendor python-zstandard 0.10.1
This was just released.
The upstream source distribution from PyPI was extracted. Unwanted
files were removed.
The clang-format ignore list was updated to reflect the new source
of files.
setup.py was updated to pass a new argument to python-zstandard's
function for returning an Extension instance. Upstream had to change
to use relative paths because Python 3.7's packaging doesn't
seem to like absolute paths when defining sources, includes, etc.
The default relative path calculation is relative to setup_zstd.py
which is different from the directory of Mercurial's setup.py.
The project contains a vendored copy of zstandard 1.3.6. The old
version was 1.3.4.
The API should be backwards compatible and nothing in core should
need adjusted. However, there is a new "chunker" API that we
may find useful in places where we want to emit compressed chunks
of a fixed size.
There are a pair of bug fixes in 0.10.0 with regards to
compressobj() and decompressobj() when block flushing is used. I
actually found these bugs when introducing these APIs in Mercurial!
But existing Mercurial code is not affected because we don't
perform block flushing.
# no-check-commit because 3rd party code has different style guidelines
Differential Revision: https://phab.mercurial-scm.org/D4911
Yuya Nishihara <yuya@tcha.org> [Tue, 25 Sep 2018 20:55:03 +0900] rev 40121
rust-chg: install signal handlers to forward signals to server
I use sync::Once as a synchronization primitive because it's quite easy
to use, and is good enough to prevent data race in these C functions.
Yuya Nishihara <yuya@tcha.org> [Mon, 24 Sep 2018 22:19:49 +0900] rev 40120
rust-chg: remove SIGCHLD handler which won't work in oxidized chg
Since pager is managed by the Rust part, the C code doesn't know the pager
pid. I could make the Rust part teach the pid to C, but still installing
SIGCHLD handler seems horrible idea since we no longer use handcrafted
low-level process management functions.
Instead, I'm thinking of adding async handler to send SIGPIPE at the exit
of the pager.
Yuya Nishihara <yuya@tcha.org> [Mon, 24 Sep 2018 22:04:57 +0900] rev 40119
rust-chg: extract signal handlers from chg/procutil.c
abortmsgerrno() and debugmsg() are removed, and the public interface instead
returns success/error status. Since signal handlers can't propagate errors,
the result of kill() is just ignored.
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Oct 2018 23:19:49 +0900] rev 40118
help: document about "version" template keywords
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Oct 2018 23:14:21 +0900] rev 40117
help: document about "tags" template keywords
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Oct 2018 23:12:04 +0900] rev 40116
help: document about "status" template keywords
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Oct 2018 23:05:00 +0900] rev 40115
help: document about "resolve" template keywords
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Oct 2018 23:00:50 +0900] rev 40114
help: document about "paths" template keywords
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Oct 2018 22:56:37 +0900] rev 40113
help: document about "identify" template keywords
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Oct 2018 22:50:12 +0900] rev 40112
help: document about "grep" template keywords
Yuya Nishihara <yuya@tcha.org> [Sun, 07 Oct 2018 17:35:25 +0900] rev 40111
chgserver: catch Abort while parsing early args to shut down cleanly
_loadnewui() calls dispatcher functions, which may raise Abort if unparsable
arguments are passed in. The server should catch such errors and translate
them to the "exit 255" instruction so the client can finish the IPC session
cleanly.
Spotted while porting the chg client to Rust.
Yuya Nishihara <yuya@tcha.org> [Fri, 05 Oct 2018 22:08:37 +0900] rev 40110
chg: upgrade client to use "setumask2" command
No compatibility code is added to the client side, since it's unlikely for
new client to communicate with the old server.
Yuya Nishihara <yuya@tcha.org> [Thu, 04 Oct 2018 23:25:55 +0900] rev 40109
chgserver: add "setumask2" command which uses correct message frame
The first 4 bytes should be a length field, not a value. Spotted while
porting chg functions to the Rust one.
muxator <a.mux@inwind.it> [Tue, 09 Oct 2018 22:29:10 +0200] rev 40108
packaging: "make deb" no longer fails
Release 4.7 rationalized the layout of the build scripts.
Unfortunately, while "make docker-ubuntu-*" and "make docker-debian-*" worked as
expected, "make deb" was broken.
Before this change "make deb" was failing with the following error:
You are not inside a Mercurial repository!
Or, after the latest changes:
You are inside <fullpath>, which is not the root of a Mercurial repository
Moreover, when "make deb" failed, the cleanup routine deleted the wrong
directory (contrib/packaging/debian instead of <reporoot>/debian) resulting in
a corrupted working copy that needed to be hg revert-ed.
After this change the docker targets continue to work, and the deb one is able
to finish.
muxator <a.mux@inwind.it> [Tue, 09 Oct 2018 22:24:38 +0200] rev 40107
packaging: cleanup() did not read the value of $CLEANUP
When the original author put CLEANUP in a conditional statement he was probably
willing to use it to control the "if". This change tries to restore that
behaviour: the "rm" clause is triggered if and only if CLEANUP is defined and
not empty.
muxator <a.mux@inwind.it> [Tue, 09 Oct 2018 22:18:35 +0200] rev 40106
packaging: builddeb's cleanup needs to expand PWD, safely
Single quotes would not expand the variable.
muxator <a.mux@inwind.it> [Tue, 09 Oct 2018 22:16:25 +0200] rev 40105
packaging: blindly factor out trap's cleanup function in builddeb
This commit blindly extracts builddeb's trap routine in a dedicated function.
While doing so, I think two bugs are exposed, which will be addressed in the
next commits:
- single quoting around '$CLEANUP' will always evaluate to the literal
'$CLEANUP' regardless of the variable's value. The "if" will always be true.
- the removal operation will not expand $PWD (and a variable expansion would
need double quotes, anyways.
muxator <a.mux@inwind.it> [Tue, 09 Oct 2018 21:40:49 +0200] rev 40104
packaging: print full path to the packages when builddeb finishes successfully
muxator <a.mux@inwind.it> [Tue, 09 Oct 2018 21:39:39 +0200] rev 40103
packaging: print more specific error messages when builddeb fails
Gregory Szorc <gregory.szorc@gmail.com> [Tue, 09 Oct 2018 12:56:11 -0700] rev 40102
cmdutil: sort unresolved paths
I noticed that `hg status` was printing unresolved paths in a
non-deterministic order. This patch fixes that.
I'm not sure if the sorting should be done in
merge.mergestate.unresolved() instead. Either way fixes the
presentation issue.
Differential Revision: https://phab.mercurial-scm.org/D4929
Yuya Nishihara <yuya@tcha.org> [Tue, 09 Oct 2018 07:46:01 +0900] rev 40101
fuzz: report error if Python code raised exception
I think that's what we wanted to do, given the most of the code block is
surrounded by try-except. 'lazymanifest(mdata)' is moved to the try block
as it can fail.
Yuya Nishihara <yuya@tcha.org> [Tue, 09 Oct 2018 07:42:05 +0900] rev 40100
revlog: explicitly initialize static variables
I know .bss section is zero-filled, but explicit initialization should be
better as we rely on that.
Joerg Sonnenberger <joerg@bec.de> [Mon, 08 Oct 2018 21:53:32 +0200] rev 40099
tests: do not change sys.path, it can break loading cext.parsers
When running this tests with run-tests, the prefix would resolve
mercurial.cext to the source tree and the attempt to load
mercurial.cext.parsers would therefore fail since it doesn't exist in
it. With the regular search path from run-tests, it is picked up from
the temporary prefix correctly.
Differential Revision: https://phab.mercurial-scm.org/D4910
Joerg Sonnenberger <joerg@bec.de> [Mon, 08 Oct 2018 21:51:20 +0200] rev 40098
tests: deal with differences in tic from ncurses and NetBSD
Differential Revision: https://phab.mercurial-scm.org/D4909
Joerg Sonnenberger <joerg@bec.de> [Mon, 08 Oct 2018 20:07:13 +0200] rev 40097
closehead: fix close-head -r listification
Differential Revision: https://phab.mercurial-scm.org/D4908
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Thu, 23 Aug 2018 12:25:54 +0900] rev 40096
import-checker: use testparseutil.embedded() to centralize detection logic
This patch fixes issues of embedded() in import-checker.py below, too.
- overlook (or mis-detect) the end of inline script in doctest style
- overlook inline script in doctest style at the end of file
(and ignore invalid un-closed heredoc at the end of file, too)
- overlook code fragment in styles below
- "python <<EOF" (heredoc should be "cat > file <<EOF" style)
- "cat > foobar.py << ANYLIMIT" (limit mark should be "EOF")
- "cat << EOF > foobar.py" (filename should be placed before limit mark)
- "cat >> foobar.py << EOF" (appending is ignored)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Thu, 23 Aug 2018 12:25:54 +0900] rev 40095
tests: use NO_CHECK_EOF as heredoc limit mark to omit checking code fragments
This patch uses NO_CHECK_EOF as heredoc limit mark instead of EOF, in
order to avoid checking all python code fragments in
test-contrib-check-code.t, because almost all of them has
un-recommended implementations intentionally.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Thu, 23 Aug 2018 12:25:54 +0900] rev 40094
contrib: add an utility module to parse test scripts
This patch centralizes the logic to pick up code fragments embedded in
*.t script, in order to:
- apply checking with patterns in check-code.py on such embedded
code fragments
Now, check-code.py completely ignores embedded code
fragments. I'll post another patch series to check them.
- replace similar code path in contrib/import-checker.py
Current import-checker.py has problems below. Fixing each of them
is a little difficult, because parsing logic and pattern strings
are tightly coupled.
- overlook (or mis-detect) the end of inline script in doctest
style
8a8dd6e4a97a fixed a part of this issue, but not enough.
- it overlooks inline script in doctest style at the end of file
(and ignores invalid un-closed heredoc at the end of file, too)
- it overlooks code fragment in styles below
- "python <<EOF" (heredoc should be "cat > file <<EOF" style)
- "cat > foobar.py << ANYLIMIT" (limit mark should be "EOF")
- "cat << EOF > foobar.py" (filename should be placed before limit mark)
- "cat >> foobar.py << EOF" (appending is ignored)
- it is not extensible for other than python code fragments
(e.g. shell script, hgrc file, and so on)
This new module can detect python code fragments in styles below:
- inline script in doctest style (starting by " >>> " line)
- python invocation with heredoc script ("python <<EOF")
- python script in heredoc style (redirected into ".py" file)
As an example of extensibility of new module, this patch also contains
implementation to pick up code fragment below. This will be useful to
add additional restriction for them, for example.
- shell script in heredoc style (redirected into ".sh" file)
- hgrc configuration in heredoc style (redirected into hgrc or $HGRCPATH)
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Thu, 23 Aug 2018 12:24:41 +0900] rev 40093
tests: use environment variable indirectly
Using environment variable directly in heredoc python code will cause
syntax error at checking module importation by import-checker.py
strictly, because "$varname" is invalid in Python syntax. "$varname"
becomes valid after environment variable substitution by shell at
writing text into file.
Current import-checker.py overlooks code fragment changed in this
patch, because of a restriction below for a line starting code
fragment.
- filename must be specified before limit mark
NG: cat <<EOF > FILE.py
OK: cat > FILE.py <<EOF
import-checker.py itself is fixed in subsequent patch.
FUJIWARA Katsunori <foozy@lares.dti.ne.jp> [Thu, 23 Aug 2018 12:20:41 +0900] rev 40092
tests: import multiple modules separately
Current import-checker.py overlooks code fragment changed in this
patch, because of restrictions below for a line starting code
fragment.
- filename must be specified before limit mark
NG: cat <<EOF > FILE.py
OK: cat > FILE.py <<EOF
- limit mark must not be quoted
NG: cat > FILE.py <<'EOF'
OK: cat > FILE.py <<EOF
import-checker.py itself is fixed in subsequent patch.
Augie Fackler <augie@google.com> [Mon, 08 Oct 2018 11:50:25 -0400] rev 40091
fuzz: allow manifest fuzzer to detect leaks
Huzzah!
Differential Revision: https://phab.mercurial-scm.org/D4907
Augie Fackler <augie@google.com> [Mon, 08 Oct 2018 11:47:25 -0400] rev 40090
fuzzers: init Python in LLVMFuzzerInitialize and intentionally leak it
This sidesteps leaks (or "leaks", I'm not sure) in CPython, and lets
our fuzzer work.
Differential Revision: https://phab.mercurial-scm.org/D4906
Augie Fackler <augie@google.com> [Mon, 08 Oct 2018 11:42:06 -0400] rev 40089
revlog: if the module is initialized more than once, don't leak nullentry
Caught (annoyingly) by the manifest fuzzer.
Differential Revision: https://phab.mercurial-scm.org/D4905
Martin von Zweigbergk <martinvonz@google.com> [Mon, 01 Oct 2018 14:31:15 -0700] rev 40088
narrow: move remaining narrow-limited dirstate walks to core
In most places we now filter at a higher level (the context object),
but there are few places that relied on the dirstate walk to be
filtered by the narrowspec. The important cases are those used by `hg
add` and `hg addremove`. This patch updates them to pass in a matcher
instead of relying on the dirstate to do the filtering. The dirstate
filtering is also dropped in narrowdirstate.py.
Not always filtering in the dirstate should be useful for a future `hg
status --include-outside-narrow` option.
These places now end up doing an unrestricted dirstate walk after this
patch:
* debugfileset
* perfwalk
* sparse (but restricted to sparse config)
* largefiles
I'll let anyone who cares about these cases adapt them to work with
narrow if necessary.
Differential Revision: https://phab.mercurial-scm.org/D4901
Martin von Zweigbergk <martinvonz@google.com> [Mon, 01 Oct 2018 10:11:00 -0700] rev 40087
narrow: allow repo.narrowmatch(match) to include exact matches from "match"
Differential Revision: https://phab.mercurial-scm.org/D4900
Martin von Zweigbergk <martinvonz@google.com> [Fri, 28 Sep 2018 22:35:05 -0700] rev 40086
narrow: filter files by narrowspec in ctx.matches()
This has no effect yet because 1) for committed changes, ctx.matches()
just calls ctx.walk(), which we updated in the previous patch, and 2)
for the working copy, the filtering is also done in the overridden
dirstate.walk() in narrowdirstate.
Differential Revision: https://phab.mercurial-scm.org/D4899
Martin von Zweigbergk <martinvonz@google.com> [Fri, 28 Sep 2018 17:09:15 -0700] rev 40085
narrow: only walk files within narrowspec also for committed revisions
Narrow has been walking only paths matching the narrowspec when
walking the working copy. We have not done the same filtering when
walking committed revisions (e.g. "hg files -r "), which seems a
little odd. Let's make it consistent.
Differential Revision: https://phab.mercurial-scm.org/D4898
Martin von Zweigbergk <martinvonz@google.com> [Thu, 27 Sep 2018 23:01:26 -0700] rev 40084
status: intersect matcher with narrow matcher instead of filtering afterwards
I seem to have done a very naive move of the code from the narrow
extension into core in e411774a2e0f (narrow: move status-filtering to
core and to ctx, 2018-08-02). It seems obvious that a better way is to
intersect the matchers.
Note that this means that when requesting status for the working
directory in a narrow repo, we now pass the narrow matcher (possibly
intersected with a user-provided matcher) into _buildstatus() and then
into dirstate.status() and dirstate.walk(), which will the intersect
it again with the narrow matcher. That's functionally fine, but
wasteful. I hope to later remove the dirstate wrapping that adds the
second layer of matcher intersection.
Differential Revision: https://phab.mercurial-scm.org/D4897
Martin von Zweigbergk <martinvonz@google.com> [Fri, 28 Sep 2018 12:29:21 -0700] rev 40083
localrepo: allow narrowmatch() to accept matcher to intersect with
It's pretty common that we need to intersect a matcher we already have
(usually from the user) with the narrow matcher. Let's make
repo.narrowmatch() take an optional matcher to intersect with.
Differential Revision: https://phab.mercurial-scm.org/D4896
Zharaskhan Aman <aman.zharaskhan@gmail.com> [Fri, 05 Oct 2018 01:55:51 +0300] rev 40082
obsolete: fix ValueError when stored note contains ':' char (issue5783)
The newer version of `amend -n 'Some some'` accepts containing ':' char.
The information contained in this note 'Testing::Obstore' gives ValueError,
because we are trying to store more than 2 values in key and value.
Differential Revision: https://phab.mercurial-scm.org/D4883
Differential Revision: https://phab.mercurial-scm.org/D4882
Martin von Zweigbergk <martinvonz@google.com> [Fri, 05 Oct 2018 16:06:51 -0700] rev 40081
narrow: update TODO.rst now that we share format with sparse
The narrowspec format was unified with the sparse format in
f64ebe7d2259 (narrowspec: use sparse.parseconfig() to parse narrowspec
file (BC), 2018-08-03).
Differential Revision: https://phab.mercurial-scm.org/D4904
Martin von Zweigbergk <martinvonz@google.com> [Fri, 05 Oct 2018 16:04:25 -0700] rev 40080
narrow: update TODO.rst now that we filter status in ctx
The comment referred to was addressed in e411774a2e0f (narrow: move
status-filtering to core and to ctx, 2018-08-02). I also think
84092edd5c88 (narrow: drop unnecessary overrides of patch, 2018-09-28)
suggests that it was the right thing to do.
Differential Revision: https://phab.mercurial-scm.org/D4903
Martin von Zweigbergk <martinvonz@google.com> [Fri, 05 Oct 2018 16:01:21 -0700] rev 40079
narrow: update TODO.rst now that the narrowspec is in .hg/store
We no longer have the unfortunate wrappostshare() and
unsharenarrowspec() since 576eef1ab43d (narrow: move .hg/narrowspec to
.hg/store/narrowspec (BC), 2018-08-02).
Differential Revision: https://phab.mercurial-scm.org/D4902
Pulkit Goyal <pulkit@yandex-team.ru> [Fri, 05 Oct 2018 23:28:14 +0300] rev 40078
py3: add 8 new passing tests to whitelist found by buildbot
We are getting close!
Differential Revision: https://phab.mercurial-scm.org/D4893
Pulkit Goyal <pulkit@yandex-team.ru> [Fri, 05 Oct 2018 23:31:51 +0300] rev 40077
py3: use '%f' for floats instead of '%s'
I remember Yuya saying we need to use bytestr() or '%r' because '%s' was clever.
Not sure it applies to this or not.
Differential Revision: https://phab.mercurial-scm.org/D4894
Pulkit Goyal <pulkit@yandex-team.ru> [Fri, 05 Oct 2018 22:52:24 +0300] rev 40076
narrow: move adding of narrow server capabilities to core
We use the experimental.narrow config option introduced in one of the previous
patch and move the functionality of adding narrow server capabilities to core.
Differential Revision: https://phab.mercurial-scm.org/D4891
Pulkit Goyal <pulkit@yandex-team.ru> [Fri, 05 Oct 2018 22:31:12 +0300] rev 40075
wireprotoserver: move narrow capabilities to wireprototypes.py
This is done because wireprotoserver import wireprotov1server, so you cannot
import wireprotoserver in wireprotov1server to use the capabilities constants.
Differential Revision: https://phab.mercurial-scm.org/D4890