Raphaël Gomès <rgomes@octobus.net> [Tue, 24 Mar 2020 17:55:59 +0100] rev 44601
rust-matchers: use the `regex` crate
Instead of falling back to Python when a code path with "ignore" functionality
is reached and `Re2` is not installed, the default compilation (i.e. without
the `with-re2` feature) will use the `regex` crate for all regular expressions
business.
As with the introduction of `Re2` in a previous series, this yields a big
performance boost compared to the Python + C code in `status`, `diff`, `commit`,
`update`, and maybe others.
For now `Re2` looks to be faster at compiling the DFA (1.5ms vs 5ms for
Netbeans' `.hgignore`) and a bit faster in actual use: (123ms vs 137ms for
the parallel traversal of Netbeans' clean repo). I am in talks with the author
of `regex` to see whether that performance difference is a bug, a "won't fix",
or a tuning issue.
The `regex` crate is already one of our dependencies and using this code does
not require any additional work from the end-user than to use the Rust
extensions.
Differential Revision: https://phab.mercurial-scm.org/D8323
Yuya Nishihara <yuya@tcha.org> [Sun, 15 Mar 2020 16:11:58 +0900] rev 44600
templater: add subsetparents(rev, revset) function
Naming suggestions are welcome. And this could be flagged as an (ADVANCED)
function since the primary use case is to draw a graph.
This provides all data needed for drawing revisions graph filtered by revset,
and allows us to implement a GUI graph viewer in some languages better than
Python. A frontend grapher will be quite similar to our graphmod since
subsetparents() just returns parent-child relations in the filtered sub graph.
Frontend example:
https://hg.sr.ht/~yuja/hgv/browse/default/core/hgchangesetgrapher.cpp
However, the resulting graph will be simpler than the one "hg log -G" would
generate because redundant edges are eliminated. This should be the same graph
rendering strategy as TortoiseHg.
This function could be implemented as a revset predicate, but that would mean
the scanning state couldn't be cached and thus slow.
Test cases are split to new file since test-template-functions.t is quite
big and we'll need a new branchy repository anyway.
Yuya Nishihara <yuya@tcha.org> [Sun, 15 Mar 2020 16:00:45 +0900] rev 44599
templater: remember cache key of evaluated revset
This provides a hint for caching further computation result of the given
revset. See the next patch for example.
Yuya Nishihara <yuya@tcha.org> [Sun, 15 Mar 2020 22:01:38 +0900] rev 44598
templater: fix cbor() filter to accept smartset
So the wrapper type can return a bare smartset.
Yuya Nishihara <yuya@tcha.org> [Sun, 15 Mar 2020 15:12:44 +0900] rev 44597
templater: introduce wrapper for smartset (API)
I want to add a template function which takes a revset as an argument:
{somefunc(..., revset(...))}
^^^^^^^^^^^
evaluates to a revslist
This wrapper will provide a method to get an underlying smartset. It should
also be good for performance since count(revset(...)) will no longer have to
fully consume the smartset for example, but that isn't the point of this
change.
Matt Harbison <matt_harbison@yahoo.com> [Fri, 20 Mar 2020 23:30:23 -0400] rev 44596
setup: build C extensions with -Werror=declaration-after-statement
MSVC 2008 still needs declarations at the top of the scope. I added it to the
3rd party code too in case somebody vendors a new version with a problem-
they'll get an early warning. Clang seems to ignore this (at least on 10.14
with Xcode 10), and gcc 7.4 will error out as desired on Ubuntu 18.04. Thanks
to Yuya for remembering the name of the option.
Differential Revision: https://phab.mercurial-scm.org/D8318
Yuya Nishihara <yuya@tcha.org> [Tue, 24 Mar 2020 21:41:24 +0900] rev 44595
merge with stable
Yuya Nishihara <yuya@tcha.org> [Sun, 22 Mar 2020 18:40:04 +0900] rev 44594
osutil: move declaration to top of the scope
Otherwise the build would fail with -Werror=declaration-after-statement.
Yuya Nishihara <yuya@tcha.org> [Sat, 21 Mar 2020 14:01:10 +0900] rev 44593
phabricator: remove *-argument from _getdrevs()
It can't take more than one specs arguments per len(*specs).
Yuya Nishihara <yuya@tcha.org> [Sat, 21 Mar 2020 13:42:08 +0900] rev 44592
revset: leverage internal _rev() function to implement rev()
Now 'rev(n)' is identical to 'present(_rev(n))'.
Yuya Nishihara <yuya@tcha.org> [Sat, 21 Mar 2020 13:39:39 +0900] rev 44591
revset: fix crash by repo.revs('%d', tip + 1)
IndexError shouldn't be raised from a revset predicate. The error message
is copied from scmutil.revsymbol().
Yuya Nishihara <yuya@tcha.org> [Sat, 21 Mar 2020 13:27:47 +0900] rev 44590
revset: allow repo.revs('%d', wdirrev)
Otherwise we can't write repo.revs('null:%d', subset.max()) to build
a smartset covering the range {null .. tip} + {wdir} if subset includes
wdir.
Micha Wiedenmann <mw-u2@posteo.de> [Thu, 19 Mar 2020 16:06:24 +0100] rev 44589
ui: use "procutil.shellsplit" to parse command
A commandline containing a space ('"C:\\Program Files\\bar.exe" "..."')
must not simply split at whitespace, instead quoting has to be taken into
account. Use "shlex.split()" to parse it instead.
This can improve the error message if we fail to launch a user
configured
editor which does not exist. Consider
[ui]
editor = "C:\Program Files\editor\editor.exe"
where the path does not exist. "hg histedit" currently aborts with
> Abort: edit failed: Program exited with status 1
here "Program" is not part of the message but the name of the program
that failed (i.e. `basename("C:\\Program ")`). With this change the message
instead reads
> Abort: edit failed: C:\Program Files\editor\editor.exe exited with
> status 1
which is also not ideal since infact "cmd.exe" exited with code 1, not
the editor. But the real error message ("File not found") gets swallowed by
`procutil` and including the correct path improves the error message
nevertheless.
Matt Harbison <matt_harbison@yahoo.com> [Thu, 05 Mar 2020 11:02:07 -0500] rev 44588
phabricator: allow multiple DREVSPEC args to phabread|phabimport|phabupdate
Per Augie's request. Like regular revsets, the result is the union of all given
specs. Unlike regular revsets, these don't resolve in parent -> child order,
and should be specified as such on the command line.
This change invalidated a previous test using an empty `hg phabread`, so it has
been switched to `hg debugcallconduit` to preserve that coverage.
Differential Revision: https://phab.mercurial-scm.org/D8233
Matt Harbison <matt_harbison@yahoo.com> [Thu, 05 Mar 2020 11:00:00 -0500] rev 44587
phabricator: add a helper function to convert DREVSPECs to a DREV dict list
Prep work for allowing multiple DREVSPECs to various commands, and properly
validating the input.
Differential Revision: https://phab.mercurial-scm.org/D8232
Yuya Nishihara <yuya@tcha.org> [Fri, 20 Mar 2020 17:18:14 +0900] rev 44586
merge with stable
Matt Harbison <matt_harbison@yahoo.com> [Thu, 19 Mar 2020 14:54:10 -0400] rev 44585
tests: avoid logging a commit with a Unicode character in test-phabricator.t
The previous output was generated on Windows, and should have been wrapped in
`HGENCODING=utf-8` like it is earlier in the test. It's simpler to just avoid
it. I only noticed the output change when I got around to running it on a Mac.
Differential Revision: https://phab.mercurial-scm.org/D8303
Martin von Zweigbergk <martinvonz@google.com> [Fri, 13 Mar 2020 12:16:20 -0700] rev 44584
fix: mark -r as advanced
See the previous patch for reasoning. I planned to even mark it
deprecated, but someone (timeless?) on the #mercurial IRC channel said
they sometimes wanted to use `-r` with its existing semantics.
Differential Revision: https://phab.mercurial-scm.org/D8288
Martin von Zweigbergk <martinvonz@google.com> [Fri, 13 Mar 2020 12:16:00 -0700] rev 44583
fix: add a -s option to format a revision and its descendants
`hg fix -r abc123` will format that commit but not its
descendants. That seems expected given the option name (`-r`), but
it's very rarely what the user wants to do. The problem is that any
descendants of that commit will not be formatted, leaving them as
orphans that are hard to evolve. They are hard to evolve because the
new parent will have formatting changes that the orphan doesn't have.
I talked to Danny Hooper (who wrote most of the fix extension) about
the problem and we agreed that deprecating `-r` in favor of a new `-s`
argument (mimicing rebase's `-s`) would be a good way of reducing the
risk that users end up with these hard-to-evolve orphans. So that's
what this patch implements.
Differential Revision: https://phab.mercurial-scm.org/D8287
Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Dec 2019 16:32:01 -0800] rev 44582
fix: move handling of --all into getrevstofix() for consistency
Differential Revision: https://phab.mercurial-scm.org/D8286
Raphaël Gomès <rgomes@octobus.net> [Wed, 18 Mar 2020 14:26:47 +0100] rev 44581
rust-status: add trace-level logging for Rust status fallback for debugging
The added `log` crate is already a sub-dependency.
Differential Revision: https://phab.mercurial-scm.org/D8300
Augie Fackler <augie@google.com> [Wed, 18 Mar 2020 15:08:14 -0400] rev 44580
hg: make _local() behave consistently on Python 3.8 (issue6287)
Python 3.8 makes os.path.isfile quietly eat "path invalid" errors and
return False instead of allowing the exception to propagate. Given
that this is a change from 2018 (sigh) and it's mentioned in the
release notes (double sigh) we're definitely too late to complain to
Python about the behavior change, so open-code part of
os.path.isfile() in this method so we can catch invalid-path errors
and handle them appropriately. I confirmed that posixpath and ntpath
both delegate to genericpath, which uses os.stat() under the covers.
Differential Revision: https://phab.mercurial-scm.org/D8302
Augie Fackler <augie@google.com> [Tue, 17 Mar 2020 17:26:05 -0400] rev 44579
remotefilelog: add fake heads() method that allows viewing a file in hgweb
As best I can discern, this is not going to hurt anything, but it'll
cause a couple of options to exist in the UI that are
nonsensical. That seems fine, given the nature of remotefilelog.
Differential Revision: https://phab.mercurial-scm.org/D8299
Augie Fackler <augie@google.com> [Tue, 17 Mar 2020 17:21:34 -0400] rev 44578
tests: add test for remotefilelog interactions with hgweb
It's not uncommon for hg users to rely on hgweb as a simple GUI and
history browser (I do this all the time on Mercurial), but we lack any
tests to ensure things keep working.
At present, this merely demonstrates the "view contents of a single
file" endpoint is broken. I'll fix that in a subsequent change.
Differential Revision: https://phab.mercurial-scm.org/D8298
Augie Fackler <augie@google.com> [Wed, 18 Mar 2020 12:03:27 -0400] rev 44577
phabricator: remove duplicated byteskwargs conversion
Fixes things on Python 3.
Differential Revision: https://phab.mercurial-scm.org/D8301
Kyle Lippincott <spectral@google.com> [Tue, 17 Mar 2020 12:59:31 -0700] rev 44576
chistedit: support histedit.summary-template in curses histedit plan
Differential Revision: https://phab.mercurial-scm.org/D8296
Kyle Lippincott <spectral@google.com> [Mon, 22 Jul 2019 09:58:23 -0700] rev 44575
vfs: fix typo in comment (remove extra "l")
Differential Revision: https://phab.mercurial-scm.org/D8297
Kyle Lippincott <spectral@google.com> [Thu, 12 Mar 2020 20:18:52 -0700] rev 44574
tests: make test-doctest.t automatically find files to run tests on
Differential Revision: https://phab.mercurial-scm.org/D8294
Kyle Lippincott <spectral@google.com> [Fri, 13 Mar 2020 19:25:37 -0700] rev 44573
tests: make test-doctest.t module list match reality
Differential Revision: https://phab.mercurial-scm.org/D8280
Kyle Lippincott <spectral@google.com> [Thu, 12 Mar 2020 20:08:05 -0700] rev 44572
tests: remove doctest in narrowspec, it is broken
I think every item here is considered incorrect (if we fix doctest to run it),
so let's just delete it.
Differential Revision: https://phab.mercurial-scm.org/D8279
Raphaël Gomès <rgomes@octobus.net> [Fri, 13 Mar 2020 00:41:22 +0100] rev 44571
rust-core: add missing `Debug` traits
Turns out you need them when trying to use `hg-core` as a library. Who knew.
Differential Revision: https://phab.mercurial-scm.org/D8278
Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Dec 2019 16:24:43 -0800] rev 44570
fix: refactor getrevstofix() to define revisions first, then validate them
This refactoring makes it easier to add a new way of specifying
revisions (I'm about to add a `--source`, which adds the specified
revisions and their descendants).
Differential Revision: https://phab.mercurial-scm.org/D8285
Martin von Zweigbergk <martinvonz@google.com> [Fri, 13 Dec 2019 15:14:57 -0800] rev 44569
fix: disallow `hg fix --all --working-dir`
`--all` implies `--working-dir`, so it's probably a mistake if the
user uses both.
Differential Revision: https://phab.mercurial-scm.org/D8284
Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Mar 2020 16:25:22 -0700] rev 44568
tests: simplify test-fix-topology.t slightly by using a `(case !)`
Differential Revision: https://phab.mercurial-scm.org/D8283
Martin von Zweigbergk <martinvonz@google.com> [Thu, 12 Mar 2020 14:50:00 -0700] rev 44567
tests: fix rebase test broken by earlier cleanup
It turns out I broke one of the rebase tests in dd2833e4d660 (tests:
use drawdag in test-rebase-collapse.t, 2018-03-18) and didn't notice
until now.
Differential Revision: https://phab.mercurial-scm.org/D8277
Martin von Zweigbergk <martinvonz@google.com> [Fri, 13 Mar 2020 16:57:38 -0700] rev 44566
rebase: accept multiple --base arguments (BC)
Same reasoning as for the previous patch. Rebase has worked well with
`--base 'A + B'` since 51e7c83e05ee (rebase: calculate ancestors for
--base separately (issue5420), 2016-11-28).
Differential Revision: https://phab.mercurial-scm.org/D8293
Martin von Zweigbergk <martinvonz@google.com> [Fri, 13 Mar 2020 16:39:32 -0700] rev 44565
rebase: accept multiple --source arguments (BC)
I think it's a little surprising that `hg rebase -s A -s B` rebases
only `B::` and ignores `A`. That's because the `-s` flag is not a
repeated flag. This patch makes it a repeated flag.
Differential Revision: https://phab.mercurial-scm.org/D8292
Martin von Zweigbergk <martinvonz@google.com> [Fri, 13 Mar 2020 19:29:02 -0700] rev 44564
rebase: mention -r argument in synopsis
I'm guessing that we simply forgot to mention it there. I was
wondering if maybe `-r` was experimental as long as evolution is, but
that doesn't seem to be the case (`-r` is not marked experimental).
Differential Revision: https://phab.mercurial-scm.org/D8295
Martin von Zweigbergk <martinvonz@google.com> [Fri, 13 Mar 2020 16:36:31 -0700] rev 44563
rebase: remove unused defaults argument values from _definedestmap()
The caller always provides values for these arguments.
Differential Revision: https://phab.mercurial-scm.org/D8291
Matt Harbison <matt_harbison@yahoo.com> [Sun, 16 Feb 2020 17:47:20 -0500] rev 44562
phabricator: add a config knob to create obsolete markers when importing
This too can get a tristate switch if desired. But if so, that needs to happen
by having evolve add the option.
Differential Revision: https://phab.mercurial-scm.org/D8138
Matt Harbison <matt_harbison@yahoo.com> [Sun, 16 Feb 2020 17:17:41 -0500] rev 44561
phabricator: add a config knob to import in the secret phase
For my use anyway, it's better to have a config knob that's always set than to
try to remember a switch. But we can add a tristate switch if desired.
Differential Revision: https://phab.mercurial-scm.org/D8137
Matt Harbison <matt_harbison@yahoo.com> [Sun, 16 Feb 2020 16:13:36 -0500] rev 44560
phabricator: add a `phabimport` command
I've had `alias.phabimport = $hg phabread --stack $1 | $hg import --bypass -`
for a while now, and I suspect others do too. That's limited though, in that it
can't use the information on Phabricator to restore it in the original location,
so I'm making it a first class command.
This doesn't do anything ambitious like that- this is mostly a simplification of
`hg import` to get the equivalent of the alias mentioned above. The `--bypass`
option is hardcoded to be enabled and the message about amending rejects
dropped (rejects aren't created with `--bypass`), because editing patches on
Phabricator seems like an unusual workflow.
This will need other options, like `--obsolete` and `--secret`. I think these
would be more useful as config settings, as I imagine the workflows are pretty
fixed depending on roles. Reviewers who don't queue patches probably never want
`--obsolete`, but may need `--secret`. Reviewers who do will want the former,
but not the latter. I left `--stack` as an option, but that should probably be
a config knob too (or at least default to on)- if the point of this is to avoid
rejects, it doesn't make sense to skip dependencies in most cases.
Evolve is going to need a fix to its wrapping of `cmdutil.tryimportone()`, as it
currently assumes `opts` has an `obsolete` key. It's worked around for now.
Differential Revision: https://phab.mercurial-scm.org/D8136
Raphaël Gomès <rgomes@octobus.net> [Thu, 12 Mar 2020 10:14:40 +0100] rev 44559
rust: update the README with more up-to-date and thorough information
Differential Revision: https://phab.mercurial-scm.org/D8274
Joerg Sonnenberger <joerg@bec.de> [Fri, 08 Dec 2017 02:29:02 +0100] rev 44558
transactions: convert changes['phases'] to list of ranges
Consecutive revisions are often in the same phase, especially public
revisions. This means that a dictionary keyed by the revision for the
phase transitions is highly redundant. Build a list of (range, (old,
new)) entries instead and aggressively merge ranges with the same
transition. For the test case in issue5691, this reduces memory use by
~20MB.
Differential Revision: https://phab.mercurial-scm.org/D8125
Raphaël Gomès <rgomes@octobus.net> [Wed, 11 Mar 2020 17:42:56 +0100] rev 44557
test-install: don't print Rust re2 bindings information if Rust is not in use
Differential Revision: https://phab.mercurial-scm.org/D8273
Matt Harbison <matt_harbison@yahoo.com> [Mon, 09 Mar 2020 21:35:36 -0400] rev 44556
tests: drop an extraneous (glob) from test-debugbackupbundle.t
Since this was not needed, it ends up causing the test to end with an error
saying that the output changed, but with no diff and a message at the end saying
"no result code from test".
Differential Revision: https://phab.mercurial-scm.org/D8269
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 29 Feb 2020 12:58:38 +0530] rev 44555
pull: add `--confirm` flag to confirm before writing changes
This introduces a new flag to pull command `--confirm` and also a config option
named `pull.confirm` which if used will prompt user describing changes which are
pulled and asking whether to accept them or not.
Differential Revision: https://phab.mercurial-scm.org/D8200
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 29 Feb 2020 12:58:13 +0530] rev 44554
scmutil: add option to register summary callbacks as transaction validators
We have a list of summary callbacks which are run after the transaction is
closed to show what has changed and what not. This patch makes it possible to
register those callbacks as transaction validators so that we can show summary
before committing the transaction and prompt user to accept the changes.
The goal of this is to implement `pull --confirm`.
Differential Revision: https://phab.mercurial-scm.org/D8199
Pulkit Goyal <7895pulkit@gmail.com> [Sat, 29 Feb 2020 12:56:37 +0530] rev 44553
transaction: add functionality to have multiple validators
This will help us in adding more validators which can aggregate data from
transaction and prompt user whether to commit the transaction or not.
The current target is to use this to implement `pull --confirm`.
Differential Revision: https://phab.mercurial-scm.org/D8198
Pulkit Goyal <7895pulkit@gmail.com> [Wed, 04 Mar 2020 22:13:15 +0530] rev 44552
hgit: make sure repository is local before checking for store type
httppeer (and maybe others too) does not have a store attribute. This was
causing `hg pull` being broken on a hg repository when the extension is enabled.
localpeer.local() does returns a non-None value but I am not sure if it matters.
Differential Revision: https://phab.mercurial-scm.org/D8217
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Mar 2020 18:08:23 +0100] rev 44551
hg-core: add function timing information
This change makes use of the newly added logging infrastructure to trace the
execution time of some important calls.
This approach is very much complementary to using a profiler and will not
guard against out-of-order execution or other kinds of compiler optimizations.
That said, it is useful to get a rough high-level idea of where time is spent.
Differential Revision: https://phab.mercurial-scm.org/D8253
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Mar 2020 18:08:13 +0100] rev 44550
rust: add logging utils
This change adds the `log` crate, the community-approved logging facade backed
by Rust core developers as well as the logging-consumer crate `simple_logger`
to build a foundation for logging from Rust.
Using this setup allows us to choose how to log depending on the way `hg-core`
is used: if it's within the context of `hg-cpython`, we might not want to use
it the same way as with a direct cli for example.
Differential Revision: https://phab.mercurial-scm.org/D8252
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Mar 2020 17:51:24 +0100] rev 44549
rust-status: traverse working directory in parallel
Using `rayon` for this task ensures that we are using the same work-stealing
threadpool for everything.
This change introduces `crossbeam` as an explicit dependency, although it is
already a dependency of `rayon`. It provides better structures for
multi-threaded tasks than the stdlib.
Differential Revision: https://phab.mercurial-scm.org/D8251
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Mar 2020 17:51:03 +0100] rev 44548
rust-status: wrap `stat_dmap_entries` to ease profiling
Differential Revision: https://phab.mercurial-scm.org/D8250
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Mar 2020 17:48:30 +0100] rev 44547
rust-status: refactor handling of unknown files
Differential Revision: https://phab.mercurial-scm.org/D8249
Raphaël Gomès <rgomes@octobus.net> [Wed, 19 Feb 2020 11:14:30 +0100] rev 44546
rust-status: move to recursive traversal to prepare for parallel traversal
I have looked into traversing the working directory in parallel either
by a recursive or an iterative algorithm. The recursive approach won quite
decisively both in terms of performance and code readability.
You can look at my experiment here:
https://heptapod.octobus.net/Alphare/rayon-recursive-traversal
The chance of a stack overflow happening because the directories get too nested
seems slim.
This change does not yet do anything in parallel.
Differential Revision: https://phab.mercurial-scm.org/D8215
Raphaël Gomès <rgomes@octobus.net> [Wed, 04 Mar 2020 15:10:11 +0100] rev 44545
rust-pathauditor: use interior mutability for use in multi-threaded contexts
The usual recommendation for using `RwLock` or `Mutex` is that if there are
about as many write as there are reads, use `Mutex`, and if there are more
reads than writes, use `RwLock`.
If after the main bottleneck (i.e. parallel traversal) is removed this shows
up on profiles, we should investigate using the `parking_lot` since we don't
need a poisoning API, or maybe move to different types of caches entirely.
Differential Revision: https://phab.mercurial-scm.org/D8213
Raphaël Gomès <rgomes@octobus.net> [Wed, 04 Mar 2020 15:12:08 +0100] rev 44544
rust-pathauditor: actually populate the `audited_dirs` cache
I forgot this when rewriting this logic during the review process.
Differential Revision: https://phab.mercurial-scm.org/D8212
Raphaël Gomès <rgomes@octobus.net> [Wed, 04 Mar 2020 15:10:03 +0100] rev 44543
rust-pathauditor: actually split Windows shortname aliases at `~`
Right now, splitting with a max of 1 parts is useless.
Differential Revision: https://phab.mercurial-scm.org/D8211
Raphaël Gomès <rgomes@octobus.net> [Thu, 05 Mar 2020 10:24:45 +0100] rev 44542
debuginstall: add entry about re2 Rust bindings when applicable
Differential Revision: https://phab.mercurial-scm.org/D8226
Raphaël Gomès <rgomes@octobus.net> [Thu, 05 Mar 2020 10:24:10 +0100] rev 44541
rust-cpython: add `debug` module to expose debug information to Python
This will be mostly used in `debuginstall`.
Differential Revision: https://phab.mercurial-scm.org/D8225
Raphaël Gomès <rgomes@octobus.net> [Fri, 24 Jan 2020 11:06:01 +0100] rev 44540
rust-status: use bare hg status fastpath from Python
This change also adds a test case for subrepos.
Repeating the benchmark information from the `hg-core` commit:
On the Netbeans repository:
C: 840ms
Rust+C: 556ms
Mozilla Central with the one pattern that causes a fallback removed:
C: 2.315s
Rust+C: 1.700s
Differential Revision: https://phab.mercurial-scm.org/D7931
Raphaël Gomès <rgomes@octobus.net> [Fri, 17 Jan 2020 15:09:02 +0100] rev 44539
rust-status: update rust-cpython bridge to account for the changes in core
Differential Revision: https://phab.mercurial-scm.org/D7930
Raphaël Gomès <rgomes@octobus.net> [Fri, 17 Jan 2020 15:43:46 +0100] rev 44538
rust-status: add bare `hg status` support in hg-core
A lot of performance remains to be gained, most notably by doing more things
in parallel, but also by caching, not falling back to Python but switching
to another regex engine, etc..
I have measured on multiple repositories that this change, when in combination
with the next two patches, improve bare `hg status` performance, and has no
observable impact when falling back (because it does so early).
On the Netbeans repository:
C: 840ms
Rust+C: 556ms
Mozilla Central with the one pattern that causes a fallback removed:
C: 2.315s
Rust+C: 1.700 s
Differential Revision: https://phab.mercurial-scm.org/D7929
Raphaël Gomès <rgomes@octobus.net> [Thu, 06 Feb 2020 14:32:16 +0100] rev 44537
rust-status: add function for sequential traversal of the working directory
This change also introduces helper structs to make things clearer.
Differential Revision: https://phab.mercurial-scm.org/D7928
Raphaël Gomès <rgomes@octobus.net> [Thu, 06 Feb 2020 14:34:54 +0100] rev 44536
rust-status: add missing variants to `Dispatch` enum
Differential Revision: https://phab.mercurial-scm.org/D8088
Raphaël Gomès <rgomes@octobus.net> [Thu, 06 Feb 2020 14:28:35 +0100] rev 44535
rust-status: rename `StatusResult` to `DirstateStatus`
"Result" has a special meaning in the Rust world, this should be clearer.
Differential Revision: https://phab.mercurial-scm.org/D8087
Raphaël Gomès <rgomes@octobus.net> [Thu, 06 Feb 2020 14:25:59 +0100] rev 44534
rust-status: refactor options into a `StatusOptions` struct
Differential Revision: https://phab.mercurial-scm.org/D8086
Raphaël Gomès <rgomes@octobus.net> [Fri, 17 Jan 2020 15:37:24 +0100] rev 44533
rust-status: add util for listing a directory
I debated moving it to utils, but it is not used anywhere else for now, and
its skip behavior is pretty specific to status.
Differential Revision: https://phab.mercurial-scm.org/D7927
Raphaël Gomès <rgomes@octobus.net> [Fri, 17 Jan 2020 11:53:31 +0100] rev 44532
rust-matchers: add `IgnoreMatcher`
This is a big change but all of the pieces call each other, so it makes sense
to have this all in one patch.
Differential Revision: https://phab.mercurial-scm.org/D7925
Raphaël Gomès <rgomes@octobus.net> [Fri, 17 Jan 2020 11:32:02 +0100] rev 44531
rust-matchers: add `build_regex_match` function
This function will be used to help build the upcoming `IncludeMatcher`.
Differential Revision: https://phab.mercurial-scm.org/D7924
Raphaël Gomès <rgomes@octobus.net> [Fri, 17 Jan 2020 11:31:12 +0100] rev 44530
rust-matchers: add functions to get roots, dirs and parents from patterns
These functions will be used to help build the upcoming `IncludeMatcher`.
Differential Revision: https://phab.mercurial-scm.org/D7923
Raphaël Gomès <rgomes@octobus.net> [Fri, 17 Jan 2020 11:29:33 +0100] rev 44529
rust-matchers: add function to generate a regex matcher function
This function will be used to help build the upcoming `IncludeMatcher`. While
Re2 is still used and behind a feature flag, this function returns an error
meant for fallback in the default case.
Differential Revision: https://phab.mercurial-scm.org/D7922
Raphaël Gomès <rgomes@octobus.net> [Tue, 10 Mar 2020 16:04:30 +0100] rev 44528
run-tests: restrict Rust thread pool to 3 threads during tests
Differential Revision: https://phab.mercurial-scm.org/D8270
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Feb 2020 00:31:14 +0100] rev 44527
nodemap: make sure the nodemap docket is updated after the changelog
It is better to have a lagging nodemap than a nodemap pointing to node that does
not exists yet.
(strictly speaking, the order was already right, however we make it more
explicit).
Differential Revision: https://phab.mercurial-scm.org/D8188
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Feb 2020 00:29:18 +0100] rev 44526
nodemap: make sure hooks have access to an up-to-date version
We make sure hooks can read persistent nodemap data and that they access
something up-to-date with the pending transaction.
Differential Revision: https://phab.mercurial-scm.org/D8187
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 27 Feb 2020 16:32:43 +0100] rev 44525
nodemap: track the tip_node for validation
Differential Revision: https://phab.mercurial-scm.org/D8184
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 27 Feb 2020 15:42:04 +0100] rev 44524
nodemap: add a todo list for getting out of experimental
This is all the requirement I can think off. More might be added as they emerge.
The first ones are mostly simple technical matters that will be taken care of
soon. The question about the "status" of the persistent nodemap and the revlogs
that will use it requires more discussion and thinking.
Differential Revision: https://phab.mercurial-scm.org/D8181
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 18 Feb 2020 15:19:11 +0100] rev 44523
rust-nodemap: automatically use the rust index for persistent nodemap
The persistent nodemap requires the rust index to be used to provides any gains.
So we automatically enable it for revlog using the persistent nodemap. We keep
it off for other revset because now that the rust revlog fully initialise the
nodemap using it everywhere introduce a fairly significant regression (eg: hg
diff moving from 0.8s to 2.3s on mozilla-try)
Differential Revision: https://phab.mercurial-scm.org/D8164
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 18 Feb 2020 18:32:55 +0100] rev 44522
nodemap: use data from the index in debugnodemap --dump-new
It is better to run the actual code when generating a new nodemap cache from
scratch. So we do.
Differential Revision: https://phab.mercurial-scm.org/D8163
Georges Racinet <georges.racinet@octobus.net> [Wed, 12 Feb 2020 10:53:24 +0100] rev 44521
rust-nodemap: also clear Rust data in `clearcaches`
Differential Revision: https://phab.mercurial-scm.org/D8161
Georges Racinet <georges.racinet@octobus.net> [Wed, 12 Feb 2020 10:53:19 +0100] rev 44520
rust-nodemap: add binding to `nodemap_update_data`
Differential Revision: https://phab.mercurial-scm.org/D8160
Georges Racinet <georges.racinet@octobus.net> [Wed, 12 Feb 2020 10:52:30 +0100] rev 44519
rust-nodemap: add binding for `nodemap_data_incremental`
Differential Revision: https://phab.mercurial-scm.org/D8159
Georges Racinet <georges.racinet@octobus.net> [Wed, 12 Feb 2020 10:51:17 +0100] rev 44518
rust-nodemap: add binding for `nodemap_data_all`
Differential Revision: https://phab.mercurial-scm.org/D8158
Raphaël Gomès <rgomes@octobus.net> [Wed, 12 Feb 2020 10:33:55 +0100] rev 44517
rust-nodemap: use proper Index API instead of using the C API
Differential Revision: https://phab.mercurial-scm.org/D8157
Georges Racinet <georges.racinet@octobus.net> [Tue, 11 Feb 2020 16:30:28 +0100] rev 44516
rust-nodemap: add utils for propagating errors
This also updates the copyright notice
Differential Revision: https://phab.mercurial-scm.org/D8156
Georges Racinet <georges.racinet@octobus.net> [Tue, 11 Feb 2020 16:25:45 +0100] rev 44515
rust-nodemap: add utils to create `Node`s from Python objects
Differential Revision: https://phab.mercurial-scm.org/D8155
Georges Racinet <georges.racinet@octobus.net> [Tue, 11 Feb 2020 16:23:06 +0100] rev 44514
rust-index: add `append` method to cindex/Index
This will be used by `MixedIndex` in a later patch.
Differential Revision: https://phab.mercurial-scm.org/D8154
Georges Racinet <georges.racinet@octobus.net> [Mon, 13 Jan 2020 19:56:16 +0100] rev 44513
rust-index: moved constructor in separate impl block
with the upcoming addition of the nodemap logic, it's going to become
more complicated.
Being in the separate impl block has the advantage to be subject to rustfmt,
whereas code inside macro calls isn't.
Differential Revision: https://phab.mercurial-scm.org/D8153
Georges Racinet <georges.racinet@octobus.net> [Mon, 13 Jan 2020 19:31:33 +0100] rev 44512
revlog: using two new functions in C capsule from Rust code
We expose `index_length` and `index_node` in the C capsule, so that
the Rust representation of the C index can implement the `RevlogIndex`
trait.
Because our `Node` is actually a one-field struct, we have
to decorate it for direct FFI exchange with the C `char*`
It would be a good thing to get a length from the C layer, but doing
so right now would probably interfere with the upcoming changes that
will happen there for the hash length.
Differential Revision: https://phab.mercurial-scm.org/D8152
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 18 Feb 2020 19:11:14 +0100] rev 44511
nodemap: refresh the persistent data on nodemap creation
The logic to read the data and validate the docket are still in python, so we
need to "help" whatever compiled code live in the index to refresh it.
Otherwise clearing the cache could lead to an expensive full recomputation and
disk update even when the persisted data are still valid.
Differential Revision: https://phab.mercurial-scm.org/D8174
Manuel Jacob <me@manueljacob.de> [Wed, 11 Mar 2020 05:41:02 +0100] rev 44510
tests: check availability of pyflakes by trying to import pyflakes module
Since e397c6d74652, we use the pyflakes module instead of the pyflakes
executable. As was pointed out during the review, the hghave check can be
rewritten to try to import the pyflakes module instead of spawning a new
subprocess.
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 27 Feb 2020 22:34:45 +0100] rev 44509
nodemap: deal with the "debugupdatecache" case using a "fake" transaction
We are going to need more and more methods of the transaction. So lets change
approach. The `hg debugupdatecache` case do not need a transaction, because has
the repositories locked, but is not adding any "store" data to it.
Differential Revision: https://phab.mercurial-scm.org/D8186
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 28 Feb 2020 01:45:03 +0100] rev 44508
changelog: change the implementation of `_divertopener`
During a transaction, new data to the changelog index are "diverted". The
previous implementat ways pretty basic, we need something better to be able to
use the changelog vfs fully during transaction. (eg: accessing the vfs options).
Differential Revision: https://phab.mercurial-scm.org/D8185
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 27 Feb 2020 17:08:59 +0100] rev 44507
nodemap: test that an outdated nodemap can catch up
If the persistent nodemap does not contains all revision that the index
contains, this is should be detected and dealt with. We add a test for this
case.
Differential Revision: https://phab.mercurial-scm.org/D8183
Pierre-Yves David <pierre-yves.david@octobus.net> [Thu, 27 Feb 2020 16:09:17 +0100] rev 44506
nodemap: document the docket attributes
More documentation rarely hurts.
Differential Revision: https://phab.mercurial-scm.org/D8182
Augie Fackler <raf@durin42.com> [Tue, 10 Mar 2020 13:10:53 -0400] rev 44505
git: key off `git` in .hg/requires rather than separate file
Differential Revision: https://phab.mercurial-scm.org/D8265
Augie Fackler <raf@durin42.com> [Tue, 10 Mar 2020 13:10:45 -0400] rev 44504
git: correctly handle p1() on dirstate when underlying git repo is empty
This shows up in my next change, which ends up making an empty git
repo and then running hg.
Differential Revision: https://phab.mercurial-scm.org/D8271
Pierre-Yves David <pierre-yves.david@octobus.net> [Tue, 10 Mar 2020 14:24:08 +0100] rev 44503
rust: clean remains of direct-ffi code
Since b55bec1ea972, the cext entry poitn have been removed, so we drop the code
for consistency.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 06 Mar 2020 17:02:50 +0100] rev 44502
heptapod-ci: use the new `--rust/--no-rust` flag to run the tests
Raphaël Gomès <rgomes@octobus.net> [Fri, 06 Mar 2020 11:16:15 +0100] rev 44501
run-tests: add option for running with and without Rust extensions
This provide a simple and clear way to run the test with or without rust.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 06 Mar 2020 16:24:50 +0100] rev 44500
run-tests: rename "pure" variable to setup_opts
There are more useful flag than just `--pure`. We clarify the variable name
before adding more options.
Pierre-Yves David <pierre-yves.david@octobus.net> [Fri, 06 Mar 2020 16:06:30 +0100] rev 44499
setup-rust: add a --no-rust flag
This new flag will make sure the rust extension will not be build. If neither
`--rust` nor `--no-rust` is specified the `HGWITHRUSTEXT` is used.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 09 Mar 2020 17:26:30 +0100] rev 44498
cext: drop the WITH_RUST block
These were used by the `direct-ffi` mode that just got dropped.
Pierre-Yves David <pierre-yves.david@octobus.net> [Mon, 09 Mar 2020 17:16:44 +0100] rev 44497
setup: use printf instead of print
Yuya Nishihara pointed `printf` to me, so I will respect the cargo cult.
Martin von Zweigbergk <martinvonz@google.com> [Mon, 09 Mar 2020 11:18:33 -0700] rev 44496
git: don't fail import when pygit2 is not install
`test-duplicateoptions.py` was failing on py2 for be because I didn't
have pygit2 installed. It failed because we depend on pygit2 at import
time. This patch makes it so we successfully load the git extension
even if pygit2 doesn't exist -- we just won't be able to use it in
that case.
Differential Revision: https://phab.mercurial-scm.org/D8268
Martin von Zweigbergk <martinvonz@google.com> [Mon, 09 Mar 2020 12:53:21 -0700] rev 44495
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 44494
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 44493
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 44492
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 44491
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 44490
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 44489
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
Martin von Zweigbergk <martinvonz@google.com> [Mon, 09 Mar 2020 10:18:40 -0700] rev 44488
merge with stable
Manuel Jacob <me@manueljacob.de> [Mon, 09 Mar 2020 05:19:02 +0100] rev 44487
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 44486
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 44485
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 44484
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 44483
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 44482
nodemap: check that a simple lookup works fine
I realised the code was not exercised much.
Differential Revision: https://phab.mercurial-scm.org/D8180