Martin von Zweigbergk <martinvonz@google.com> [Thu, 24 Mar 2022 16:55:09 -0700] rev 49088
histedit: remove an unnecessary default value of `b''` for commit message
I don't think `ctx.description()` is ever anything falsy other than
`b''`. I think the comment added in 4c4232e51167 (histedit: extract
common summary code into method, 2016-05-27) is mistaken (I don't see
any code following that pattern before the function was added).
Differential Revision: https://phab.mercurial-scm.org/D12406
Martin von Zweigbergk <martinvonz@google.com> [Thu, 24 Mar 2022 16:51:20 -0700] rev 49087
histedit: use new function for getting first line of a string
This fixes a crash you can run into if you enter a commit message
that's just a "newline-like" byte, like a form feed byte (`hg ci -m
\x0f` in Fish). That bug is the motivation for this series.
Differential Revision: https://phab.mercurial-scm.org/D12405
Martin von Zweigbergk <martinvonz@google.com> [Thu, 24 Mar 2022 16:09:12 -0700] rev 49086
templates: extract function to `stringutil` for getting first line of text
It's surprisingly hard to get the first line from a string, so let's
have our own function in `stringutil` for it.
Differential Revision: https://phab.mercurial-scm.org/D12404
Martin von Zweigbergk <martinvonz@google.com> [Thu, 24 Mar 2022 15:41:29 -0700] rev 49085
templates: make `firstline` filter not keep '\v', '\f' and similar
In b288b4bb8448 (hide some functions behind lambdas, so demandload is
useful., 2006-02-28), `x.splitlines(1)[0]` was replaced by
`x.splitlines(1)[0].rstrip('\r\n')`, i.e. stripping trailing '\r' and
'\n'. Combined with the "truthy" `1` passed to `splitlines()` to get
it to keep line endings, that results in e.g. trailing '\v' (Line
Tabulation) and '\f' (Form Feed) being preserved. I can't see why one
would want that, and I doubt that was the intention; I suspect the
author just didn't think to instead remove the `1` argument. Perhaps
they thought the 1 being passed there - added by themselves in
a7e416bf3c1d (improve templating., 2006-02-27) - was to limit the
number of splits to 1 (i.e. thinking about it as `maxsplit=1` rather
than `keepends=1`).
Differential Revision: https://phab.mercurial-scm.org/D12403
Matt Harbison <matt_harbison@yahoo.com> [Tue, 22 Mar 2022 11:22:09 -0400] rev 49084
pytype: drop py3.6 support
Pytype 2022.01.07 only supports 3.7+.
Differential Revision: https://phab.mercurial-scm.org/D12400
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 13 Mar 2022 16:14:34 +0100] rev 49083
perf-util: add a `compare-discovery-case` script
This script run the same discovery case using multiple variants of the algorithm
and report differences in behavior, especially regarding the numbers of roundtrip.
Differential Revision: https://phab.mercurial-scm.org/D12399
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 14 Mar 2022 05:59:20 +0100] rev 49082
discovery: also audit the number of queries done
In addition to the number of roundtrip, we now also track the number of queries
we perform, this is useful to assert the tradeoff between number of roundtrip and
the number of queries.
Differential Revision: https://phab.mercurial-scm.org/D12398
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 13 Mar 2022 16:10:53 +0100] rev 49081
search-discovery-case: display more information about the interresting case
We display information about the total number of revs and the common/missing
numbers. This is useful to spot the interresting case.
Differential Revision: https://phab.mercurial-scm.org/D12397
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 21 Mar 2022 20:06:51 +0100] rev 49080
subsetmaker: rework the antichain generation to be usable
Before this, antichain computation can run for 10s of hours without completion in
sight. We use a more direct approach in the computation to keep the computation
in complexity in check. With good result.
We can now have a full antichain computation on mozilla-try in about one
minute. Which is usable.
Differential Revision: https://phab.mercurial-scm.org/D12396
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 13 Mar 2022 16:24:01 +0100] rev 49079
subsetmaker: use SortedSet for the scratch variant
This provides a massive speedup on wide repository with many heads. For example
on mozilla-try, this move from un-usable slow to fairly instant.
Differential Revision: https://phab.mercurial-scm.org/D12395
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 13 Mar 2022 15:53:29 +0100] rev 49078
subsetmaker: stabilize the computation of `scratch` subset
`heads` is set, order of the element are not deterministic and we need to
stabilize that if we want to get reproducible results.
Differential Revision: https://phab.mercurial-scm.org/D12394
Joerg Sonnenberger <joerg@bec.de> [Tue, 20 Jul 2021 15:07:10 +0200] rev 49077
revlog: recommit 49fd21f32695 with a fix for issue6528
`filelog.size` currently special cases two forms of metadata encoding:
- copy data via the parent order as flag bit
- censor data by peaking into the raw delta
All other forms of metadata encoding including the empty metadata block
are mishandled. In `basefilectx.cmp` the empty metadata block is
explicitly checked to compensate for this.
Restore 49fd21f32695, but disable it for filelog, so that the original
flag bit use contines to work. Document all this mess for now in
preparation of a proper rework.
Differential Revision: https://phab.mercurial-scm.org/D11203
Martin von Zweigbergk <martinvonz@google.com> [Fri, 18 Mar 2022 12:23:47 -0700] rev 49076
merge-lists: make it possible to specify pattern to match
The `merge-lists` tool doesn't know anything about Python other than
its regex that attempts to match import lines. Let's make it possible
to pass in a custom regex so it's easy to use the tool for e.g. C/C++
`#include` lines or Rust `use` lines (given the limited).
Differential Revision: https://phab.mercurial-scm.org/D12392
Martin von Zweigbergk <martinvonz@google.com> [Fri, 04 Mar 2022 16:12:56 -0800] rev 49075
contrib: add a partial-merge tool for sorted lists (such as Python imports)
This is a pretty naive tool that uses a regular expression for
matching lines. It is based on a Google-internal tool that worked in a
similar way.
For now, the regular expression is hard-coded to attempt to match
single-line Python imports. The only commit I've found in the hg core
repo where the tool helped was commit 9cd6292abfdf. I think that's
because we often use multiple imports per import statement. I think
this tool is still a decent first step (especially once the regex is
made configurable in the next patch). The merging should ideally use a
proper Python parser and do the merge at the AST (or CST?) level, but
that's significantly harder, especially if you want to preserve
comments and whitespace. It's also less generic.
Differential Revision: https://phab.mercurial-scm.org/D12380
Raphaël Gomès <rgomes@octobus.net> [Tue, 05 Apr 2022 17:31:18 +0200] rev 49074
branching: merge stable into default
Raphaël Gomès <rgomes@octobus.net> [Tue, 05 Apr 2022 11:09:03 +0200] rev 49073
merge: stable into default
Matt Harbison <matt_harbison@yahoo.com> [Wed, 30 Mar 2022 00:57:08 -0400] rev 49072
tests: stop excluding the pycompat module from pyflakes
I assume this was skipped because of all of the py2 stuff causing a lot of spew.
The "unused" imports are left in place in case any 3rd party stuff is using it.
I don't care about most of it, but TortoiseHg uses `io` and `queue`, so
minimally I'd like to keep those.
Differential Revision: https://phab.mercurial-scm.org/D12423
Matt Harbison <matt_harbison@yahoo.com> [Wed, 30 Mar 2022 00:44:55 -0400] rev 49071
tests: drop some py2 specific pyflake failures
Differential Revision: https://phab.mercurial-scm.org/D12422
Matt Harbison <matt_harbison@yahoo.com> [Tue, 29 Mar 2022 23:31:37 -0400] rev 49070
util: drop a duplicate import
This was already imported several lines above.
Differential Revision: https://phab.mercurial-scm.org/D12421
Matt Harbison <matt_harbison@yahoo.com> [Tue, 29 Mar 2022 23:34:18 -0400] rev 49069
pycompat: drop the pickle import
I suspect this is what df56e6bd37f6 meant to eliminate.
Differential Revision: https://phab.mercurial-scm.org/D12420
Matt Harbison <matt_harbison@yahoo.com> [Tue, 29 Mar 2022 22:22:36 -0400] rev 49068
util: restore the util.pickle symbol
This was accidently dropped in df56e6bd37f6, which started importing pickle
directly. That commit explicitly says it will retain it for compatibility with
external stuff though.
The unused import in pycompat isn't flagged because that module is skipped.
Just importing with a comment seemed cleaner than `import X as Y` and then
assigning to a `pickle` variable, just to avoid the pyflakes warning.
Differential Revision: https://phab.mercurial-scm.org/D12419
Raphaël Gomès <rgomes@octobus.net> [Tue, 29 Mar 2022 14:27:45 +0200] rev 49067
merge: stable into default
Matthew Martin <phy1729@gmail.com> [Thu, 24 Mar 2022 21:26:45 -0500] rev 49066
completion: install completers to conventional locations
Installs the bash and zsh completers to the convential locations so they will
automatically be picked up without user intervention. The zsh completer
on Debian is still installed to vendor-completions to match their policy.
bash: https://github.com/scop/bash-completion#faq
zsh: https://github.com/zsh-users/zsh/blob/57305cf245853b8b30895b41a90142dffab97e38/INSTALL#L254
Debian zsh: https://salsa.debian.org/debian/zsh/-/blob/5086b5356abcef8849dc8a09902b7c55f01db3c0/debian/README.Debian#L73
Matt Harbison <matt_harbison@yahoo.com> [Wed, 23 Mar 2022 13:51:40 -0400] rev 49065
pytype: disable a few errors about Windows specific module attributes
These were flagged by pytype 2022.03.21.
Differential Revision: https://phab.mercurial-scm.org/D12401
Raphaël Gomès <rgomes@octobus.net> [Sat, 19 Mar 2022 15:44:38 +0100] rev 49064
rhg: sort unsupported extensions in error message
This caused some flakiness in test output, and is also just better for users.
Differential Revision: https://phab.mercurial-scm.org/D12389
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 13 Mar 2022 15:48:18 +0100] rev 49063
hgignore: ignore .testtimes in more location
See the inline comment.
Differential Revision: https://phab.mercurial-scm.org/D12393
Augie Fackler <augie@google.com> [Fri, 25 Mar 2022 11:33:12 -0400] rev 49062
merge: with stable
Martin von Zweigbergk <martinvonz@google.com> [Thu, 17 Mar 2022 11:19:06 -0700] rev 49061
partial-merge: add support for `.args` config (`$local` etc.)
It will be useful to be able to define custom command-line arguments
per partial merge tool just like we have for regular merge tools. In
particular, I expect the same binary to handle multiple languages, so
it will be useful to be able to pass some argument indicating the
language, or perhaps simply an argument defining a regex that's used
for finding lines to merge as a sorted set.
Differential Revision: https://phab.mercurial-scm.org/D12383
Martin von Zweigbergk <martinvonz@google.com> [Tue, 18 Jan 2022 13:05:21 -0800] rev 49060
filemerge: add support for partial conflict resolution by external tool
A common class of merge conflicts is in imports/#includes/etc. It's
relatively easy to write a tool that can resolve these conflicts,
perhaps by naively just unioning the statements and leaving any
cleanup to other tools to do later [1]. Such specialized tools cannot
generally resolve all conflicts in a file, of course. Let's therefore
call them "partial merge tools". Note that the internal simplemerge
algorithm is such a partial merge tool - one that only resolves
trivial "conflicts" where one side is unchanged or both sides change
in the same way.
One can also imagine having smarter language-aware partial tools that
merge the AST. It may be useful for such tools to interactively let
the user resolve any conflicts it can't resolve itself. However,
having the option of implementing it as a partial merge tool means
that the developer doesn't *need* to create a UI for it. Instead, the
user can resolve any remaining conflicts with their regular merge tool
(e.g. `:merge3` or `meld).
We don't currently have a way to let the user define such partial
merge tools. That's what this patch addresses. It lets the user
configure partial merge tools to run. Each tool can be configured to
run only on files matching certain patterns (e.g. "*.py"). The tool
takes three inputs (local, base, other) and resolves conflicts by
updating these in place. For example, let's say the inputs are these:
base:
```
import sys
def main():
print('Hello')
```
local:
```
import os
import sys
def main():
print('Hi')
```
other:
```
import re
import sys
def main():
print('Howdy')
```
A partial merge tool could now resolve the conflicting imports by
replacing the import statements in *all* files by the following
snippet, while leaving the remainder of the files unchanged.
```
import os
import re
import sys
```
As a result, simplemerge and any regular merge tool that runs after
the partial merge tool(s) will consider the imports to be
non-conflicting and will only present the conflict in `main()` to the
user.
Differential Revision: https://phab.mercurial-scm.org/D12356
Raphaël Gomès <rgomes@octobus.net> [Mon, 21 Mar 2022 10:55:50 +0100] rev 49059
branching: merge stable into default