Martin von Zweigbergk <martinvonz@google.com> [Mon, 09 Mar 2020 12:53:21 -0700] rev 44483
hghave: add a check for pygit2
This will make it easy to use availability of pygit2 as in conditions
such as `#if pygit2` and `(pygit2 !)`. It also makes it a little
clearer why the test case skipped (when that happens).
Differential Revision: https://phab.mercurial-scm.org/D8267
Augie Fackler <raf@durin42.com> [Sat, 07 Mar 2020 18:00:53 -0500] rev 44482
localrepo: add git extension to autoextensions list
Differential Revision: https://phab.mercurial-scm.org/D8266
Augie Fackler <raf@durin42.com> [Sat, 07 Mar 2020 17:44:55 -0500] rev 44481
gitlog: implement __iter__ on changelog
This allows `hg phase --force --draft -r .` to work, for example.
Differential Revision: https://phab.mercurial-scm.org/D8264
Augie Fackler <raf@durin42.com> [Sat, 07 Mar 2020 17:42:40 -0500] rev 44480
gitlog: fix embarassing bug that prevented log from showing correct parents
We had the correct parents in the database, but the changelog was
always returning p1 for all parents. Oops.
Differential Revision: https://phab.mercurial-scm.org/D8263
Augie Fackler <raf@durin42.com> [Sat, 07 Mar 2020 16:51:21 -0500] rev 44479
git: add readfast() method to manifest
Mysteriously, on a different system a handful of things don't work
without this, including log. This is especially odd to be because log
works in the test. In any event, it's legal for readfast() to just
return read(), so that's what we do.
Differential Revision: https://phab.mercurial-scm.org/D8262
Martin von Zweigbergk <martinvonz@google.com> [Fri, 06 Mar 2020 14:14:05 -0800] rev 44478
git: make {shortest()} return shortest *unique* prefix
It used to return the prefix of the specified length as long as the
full node was unique (i.e. always).
Differential Revision: https://phab.mercurial-scm.org/D8256
Augie Fackler <augie@google.com> [Tue, 11 Feb 2020 00:44:59 -0500] rev 44477
git: skeleton of a new extension to _directly_ operate on git repos
This is based in part of work I did years ago in hgit, but it's mostly
new code since I'm using pygit2 instead of dulwich and the hg storage
interfaces have improved. Some cleanup of old hgit code by Pulkit,
which I greatly appreciate.
test-git-interop.t does not cover a whole lot of cases, but it
passes. It includes status, diff, making a new commit, and `hg annotate`
working on the git repository.
This is _not_ (yet) production quality code: this is an
experiment. Known technical debt lurking in this implementation:
* Writing bookmarks just totally ignores transactions.
* The way progress is threaded down into the gitstore is awful.
* Ideally we'd find a way to incrementally reindex DAGs. I'm not sure
how to do that efficiently, so we might need a "known only fast-forwards"
mode on the DAG indexer for use on `hg commit` and friends.
* We don't even _try_ to do anything reasonable for `hg pull` or `hg push`.
* Mercurial need an interface for the changelog type.
Tests currently require git 2.24 as far as I'm aware: `git status` has
some changed output that I didn't try and handle in a compatible way.
This patch has produced some interesting cleanups, most recently on
the manifest type. I expect continuing down this road will produce
other meritorious cleanups throughout our code.
Differential Revision: https://phab.mercurial-scm.org/D6734
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Mar 2020 10:38:37 +0100] rev 44476
hg-core: add a compilation error if trying to compile outside of Linux
For now, we can only provide support for Linux in `hg-core`, so we have to be
explicit about it in case anyone wonders why their Dirstate is suddenly broken,
or why the crate does not compile (on Windows for example).
Differential Revision: https://phab.mercurial-scm.org/D8246
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 10 Mar 2020 18:54:44 +0100] rev 44475
gzip: use the stdlib version with python 3 (
issue6284)
It turned out that the stdlib gained the feature we missed in python 3.1. We can
now use it directly.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 10 Mar 2020 18:53:19 +0100] rev 44474
gzip: indent the custom Gzip code
We need a new conditional in the next changesets (Adding 3.8 support). We do the
large code move beforehand for clarity.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 10 Mar 2020 18:57:49 +0100] rev 44473
gzip: rename the argument to `mtime` to match upstream python
Python gained the feature we missed in 3.1. The argument name is `mtime`. We
align our version for consistency.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 10 Mar 2020 16:49:38 +0100] rev 44472
heptapod-ci: run the test from outside the test directory
This will help detecting case where this is broken.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 10 Mar 2020 16:47:02 +0100] rev 44471
run-tests: fix conditional when tests are run outside of `tests`
The logic to find `hghave` was using `__file__` but… non absolute path in
`__file__` gets wrong as soon as we change directory (thanks python… you are
being helpful). The rest of the `run-tests.py` code already deal with this
fine. We simply reuse the `RUNTESTDIR` variable to fix it.
Martin von Zweigbergk <martinvonz@google.com> [Mon, 09 Mar 2020 10:18:40 -0700] rev 44470
merge with stable
Manuel Jacob <me@manueljacob.de> [Mon, 09 Mar 2020 05:19:02 +0100] rev 44469
tests: use native string type for parsed hghave log lines
Before this change, on Python 2, the parsed messages were decoded to unicode,
causing an implicit conversion from unicode to str later.
Manuel Jacob <me@manueljacob.de> [Fri, 06 Mar 2020 10:27:38 +0100] rev 44468
tests: avoid implicit bytes -> unicode -> bytes roundtrip on Python 2
Before the change, there were two implicit conversions:
* The format string was converted to unicode because the substituted values were
unicode.
* When printing the message in log(), the string was converted from unicode to
str.
Pierre-Yves David <pierre-yves.david@octobus.net> [Sun, 08 Mar 2020 16:40:39 +0100] rev 44467
cext: make HgRevlogIndex_GetParents private again
The rust's direct-ffi code need to access this function. Now that it
`direct-ffi` is no more. We can make this function `static` again.
This change was suggested by `Yuya Nishihara`.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 06 Mar 2020 16:49:46 +0100] rev 44466
setup-rust: remove the legacy 'direct-ffi' variant
This variant have been abandoned for a while. Keeping it around just get people
confused.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 18 Feb 2020 18:32:31 +0100] rev 44465
hghave: add a `rust` keyword to detect the use of compiled rust code
The content of some on disk cache can varies when using rust (because it is
faster to do so in the rust variant). So we need to be able to detect this case
for some test.
Differential Revision: https://phab.mercurial-scm.org/D8162
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Feb 2020 14:34:37 +0100] rev 44464
nodemap: check that a simple lookup works fine
I realised the code was not exercised much.
Differential Revision: https://phab.mercurial-scm.org/D8180
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Mar 2020 12:44:51 +0100] rev 44463
debuginstall: print if Rust extensions are installed
This should make it easier to use the Rust extensions.
Another patch on will be exposing a version and more useful information, but
it can only be done on top of this very patch, since it is targeting the stable
branch and the API has already changed on the default branch.
Differential Revision: https://phab.mercurial-scm.org/D8248
Augie Fackler <augie@google.com> [Fri, 06 Mar 2020 13:54:35 -0500] rev 44462
nodemap: fix missing r-prefix on regular expression
Looking at this regular expression, it's pretty obvious from reading
it that it wanted to match literal ., but since the r was missing on
the pattern it was matching any character. I guess we're just lucky
nothing bad happened as a result. This was automatically fixed by
pyupgrade, but I split it out into its own change because it seemed
important.
Differential Revision: https://phab.mercurial-scm.org/D8254
Manuel Jacob <me@manueljacob.de> [Fri, 06 Mar 2020 23:04:58 +0100] rev 44461
tests: use pyflakes module instead of pyflakes executable
This results in that the pyflakes version specific to the configured Python
version is used.
This way, both the Python 2-specific and the Python 3-specific pyflakes are run
by the test suite (depending on the configured Python version).
For downstream projects which are using Mercurial’s test infrastructure and are
not yet ported to Python 3 (e.g. hg-git) it ensures that the correct pyflakes
version is run even when the system’s default pyflakes is the Python 3-specific
one.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 03 Mar 2020 15:56:00 +0100] rev 44460
copies-tests: add a case where with merge with an overwritten files
This is similar to the BF/FB case, but in this case, the other branch updated
the file. So an actual merge happens and the two "independant" file history has
to be merged.
Differential Revision: https://phab.mercurial-scm.org/D8242
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 03 Mar 2020 15:46:28 +0100] rev 44459
copies-tests: add a case where a file is deleted/added but with a merge
This is a case similar to DB/BD, but in this case the other branch updated the
file. So an actual merge happens and the two "independant" file history has to
be merged.
Differential Revision: https://phab.mercurial-scm.org/D8241
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 03 Mar 2020 12:35:24 +0100] rev 44458
copies-tests: add a test with a rename overwriting another file
This is a variation of the "BD" case, but this time, the file is not "new", it
is overwritten by another file being renamed.
Differential Revision: https://phab.mercurial-scm.org/D8240
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 29 Feb 2020 19:50:05 +0100] rev 44457
copies-tests: add a `h` to the root commit (for chain merge tests)
This will be useful for incoming new test cases. We need a new file to rename
around.
Differential Revision: https://phab.mercurial-scm.org/D8239
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 07 Mar 2020 00:03:41 +0100] rev 44456
copies-tests: remove the final summary
The more we add tests, the less useful it is. So after discussion with Martin,
we decided to drop it.
Differential Revision: https://phab.mercurial-scm.org/D8257
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 03 Mar 2020 13:18:31 +0100] rev 44455
copies-tests: clarify the description of the EA/AE cases
The previous description of the merge was just wrong.
(It seems the result a non-updated copy-paste)
Differential Revision: https://phab.mercurial-scm.org/D8238
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 03 Mar 2020 09:27:31 +0100] rev 44454
copies-tests: update the analysis of the BD/DB cases
After thinking more about it, the current change in output between the two
merges is not due to an ambiguity, it is introduce by a bug in merge/commit
that record a wrong file history.
Fixing the bug should fix the output. In the meantime, we have a wrong behavior.
In practice the bug is not in the merge code (who does the right things), but in
the commit code (who get confused when recording the new file revision).
Differential Revision: https://phab.mercurial-scm.org/D8237
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 06 Mar 2020 11:02:02 +0100] rev 44453
copies-tests: swap two branch description
They were swapped and now match their intended block.
Differential Revision: https://phab.mercurial-scm.org/D8247
Augie Fackler <augie@google.com> [Fri, 06 Mar 2020 13:27:41 -0500] rev 44452
cleanup: run pyupgrade on our source tree to clean up varying things
Built with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**" - hgext/fsmonitor/pywatchman/**' | xargs pyupgrade --keep-percent-format --keep-extraneous-parens
and then blackened. pyupgrade comes from
https://github.com/asottile/pyupgrade with a patch to let me preserve
extraneous parens (which we use for marking strings that shouldn't be
translated), and lets us clean up a bunch of idioms that have cruftily
accumulated over the years.
# skip-blame no-op automated code cleanups
Differential Revision: https://phab.mercurial-scm.org/D8255
Manuel Jacob <me@manueljacob.de> [Mon, 09 Mar 2020 01:11:59 +0100] rev 44451
tests: fix isinstance test of wrong variable
3086a8627b2970cd7fbf49bc69413c08c68d5514 changed self._case to be a list, but
it was forgotten to adjust this line.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 06 Mar 2020 23:27:28 +0100] rev 44450
discovery: avoid wrong detection of multiple branch heads (
issue6256)
This fix the code using obsolescence markers to remove "to be obsoleted" heads
during the detection of new head creation from push. The code turned out to not
use the branch information at all. This lead changeset from different branch to
be detected as new head on unrelated branch.
The code fix is actually quite simple. New tests have been added to covers
these cases.
Differential Revision: https://phab.mercurial-scm.org/D8259
Manuel Jacob <me@manueljacob.de> [Fri, 06 Mar 2020 10:52:44 +0100] rev 44449
tests: avoid implicit conversion of str to unicode
On Python 2, str.encode('utf-8') implicitly converts the string to unicode and
then back to str.
Using _sys2bytes() ensures that opt is only encoded on Python 3, where opt is
unicode.
Although contrived, before this change, a UnicodeDecodeError could be triggered
on Python 2 when passing non-ascii values to --extra-config-opt.
Manuel Jacob <me@manueljacob.de> [Fri, 06 Mar 2020 09:50:57 +0100] rev 44448
tests: rename _bytespath() to _sys2bytes() and _strpath() to _sys2str()
The names were not general enough because e.g. _strpath() was used for
converting IP addresses.
Manuel Jacob <me@manueljacob.de> [Thu, 05 Mar 2020 18:19:21 +0100] rev 44447
tests: avoid implicit conversion of str to unicode
On Python 2, str.encode('ascii') implicitly converts the string to unicode and
then back to str.
Since the converted value is a path, _bytespath can be used instead.
Manuel Jacob <me@manueljacob.de> [Thu, 05 Mar 2020 18:10:19 +0100] rev 44446
tests: avoid implicit conversion of str to unicode
On Python 2, str.encode('ascii') implicitly converts the string to unicode and
then back to str.
Since the point of this expression is to convert a bool to a str, the '%r'
conversion specifier can be used instead in the format string.
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 18 Feb 2020 19:11:13 +0100] rev 44445
nodemap: warm the persistent nodemap on disk with debugupdatecache
When appropriate, the nodemap cache file will be created.
Differential Revision: https://phab.mercurial-scm.org/D8173
Pierre-Yves David <pierre-yves.david@octobus.net> [Sat, 29 Feb 2020 19:31:33 +0100] rev 44444
copies-tests: update to null after setup for output stability
This avoid having '@' moving around in graph output when the graph evolves.
after this change, graph evolution is still noisy, but less.
Differential Revision: https://phab.mercurial-scm.org/D8236
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 03 Mar 2020 08:55:27 +0100] rev 44443
copies-tests: remove extra log call at the end of the chain-merge test file
We do not actually need theses as the graph is displayed earlier anyway. I
think they are the remain of me trying to understand that case better.
Differential Revision: https://phab.mercurial-scm.org/D8235
Martin von Zweigbergk <martinvonz@google.com> [Thu, 05 Mar 2020 08:37:08 -0800] rev 44442
commit: print debug message when clearing dirstate and wdir clean
This case is a little weird, so let's have a debug message.
Differential Revision: https://phab.mercurial-scm.org/D8231
Martin von Zweigbergk <martinvonz@google.com> [Thu, 05 Mar 2020 10:46:31 -0800] rev 44441
merge with stable
Augie Fackler <augie@google.com> [Thu, 05 Mar 2020 10:52:51 -0500] rev 44440
merge with stable
Augie Fackler <augie@google.com> [Wed, 04 Mar 2020 14:21:23 -0500] rev 44439
commands: switch one call of check_at_most_one_arg to strings
This opts hasn't been through the byteskwargs mulcher, so we can just use
strings here instead of bytes. Fixes the test changes from D8204 on Python 3,
which was the only place this was a problem.
Differential Revision: https://phab.mercurial-scm.org/D8222
Martin von Zweigbergk <martinvonz@google.com> [Fri, 28 Feb 2020 11:32:27 -0800] rev 44438
cleanup: remove redundant clearing of mergestate in rebase and shelve
`repo.commit()` now clears the merge state even if it ends up not
creating a commit because there were no changes to commit.
Differential Revision: https://phab.mercurial-scm.org/D8197
Martin von Zweigbergk <martinvonz@google.com> [Fri, 28 Feb 2020 11:32:02 -0800] rev 44437
commit: clear resolved mergestate even if working copy is clean
If the mergestate has resolved conflicts and a commit is successfully
created (either because there are changes in the working copy or
because ui.allowemptycommit=yes), we will also clear the merge
state. However, if the working copy is clean (and
ui.allowemptycommit=no), we leave the mergestate there. The user may
notice it in `hg resolve -l` output (but not in `hg status -v`
output). It's not clear how the user should clear it, but probably via
`hg co -C .`. It's also quite likely that they won't even notice it
and it will get cleared by a later `hg commit` (of unrelated
changes).
This patch makes it so that `hg commit` also clears resolved merge
conflicts even if the command doesn't end up writing a commit because
the working copy was empty. That's probably a little weird (commands
that abort should generally avoid changing the repo), but it still
seems mostly harmless, and it reduces the risk of more bugs like
https://bz.mercurial-scm.org/show_bug.cgi?id=5494. I just ran into a
version of that bug in the Evolve extension and that's what triggered
this series.
Differential Revision: https://phab.mercurial-scm.org/D8196
Matt Harbison <matt_harbison@yahoo.com> [Wed, 04 Mar 2020 00:45:54 -0500] rev 44436
phabricator: avoid a stacktrace when command arguments are missing
Previously, the TypeError wasn't properly converted to a SignatureError when
improper arguments were supplied to the inner function, because the stack depth
is 2 inside the vcrcommand decorator. The `__name__` and `__doc__` attributes
need to be reassigned to the new wrapper so that the help summary is available.
Differential Revision: https://phab.mercurial-scm.org/D8209