Summary:
This is just a trivial test case showing the overhead of xxhash.
log insertion 18.359 ms
log insertion (no checksum) 7.835 ms
Differential Revision: D14635329
fbshipit-source-id: adc2629c0c41aaab48d29d467849e4d96eb01c51
Summary: Change the code to work with newer `rand` crate.
Reviewed By: kulshrax
Differential Revision: D14635328
fbshipit-source-id: 007f6749f2eab781a7dcf7d49b19aff1c81089b4
Summary: Add a function that adds all of the entries from a given iterator into a HistoryPack.
Differential Revision: D14647767
fbshipit-source-id: 29a71b37da86125e14135c40c279bfc8a454b568
Summary:
Using cargo for development using mercurial will result in use of random target
directories depending on where cargo is invoked from.
This diff sets the target directory for cargo in the on disk config file so
that all invocations of cargo from our project reuse the previously built
artifacts.
This may make it more problematic to build for multiple targets because cargo
does not recompile when flags change.
Reviewed By: quark-zju
Differential Revision: D14606468
fbshipit-source-id: 56c0b3b192ee94e1ddafe0949cc2267bb995a696
Summary:
Add basic support for `undo` by updating visibility according to what the undo
extension would normally do with obsmarkers.
A future enhancement would be to use the `draftheads` directly as the new
visibleheads, however:
* `undo` currently uses `heads(draft())` which doesn't take into account
secret commits.
* In order to support the `--branch` flag, we would need to make significant
changes. The flag is marked as ADVANCED and isn't used very much, so we may
consider removing it.
Reviewed By: quark-zju
Differential Revision: D14603196
fbshipit-source-id: 5b8c91b4d8fa2b28cf9ad5726d88a3735aca50ad
Summary:
When changes are undone so that an earlier view of the repo is present, fate
should only be calculated for commits that are obsolete in the current view.
This makes smartlog look correct after `undo` commands have been used.
Reviewed By: quark-zju
Differential Revision: D14603198
fbshipit-source-id: 3adaad94b9fe80e8a622d469513c784b772ee235
Summary:
Record mutation entries inside transactions. This ensures that they only get
written when the transaction completes.
Indexedlog doesn't have support for pending writes, so mutation entries are not
visible to hook scripts.
Reviewed By: quark-zju
Differential Revision: D14566781
fbshipit-source-id: eb4c7bbd3878df82e8e7096a69509525f9fb93c0
Summary:
Remove the last parts of the mutationcache, relying directly on the indexedlog
indexes.
The set of obsolete commits is now computed on the fly - we will cache this
later.
Reviewed By: quark-zju
Differential Revision: D14566780
fbshipit-source-id: 770d0d9d507bed982e88518dcf63a4c2d6b46a69
Summary:
When visibility changes, the cache of filtered revs is no longer valid and must
be cleared.
Reviewed By: quark-zju
Differential Revision: D14566777
fbshipit-source-id: 681a73c126f3258baa7f61157aba557ea8aceeca
Summary:
To prepare for transaction support, we need to move the store out of the cache
object and into its own property on the localrepo.
Reviewed By: quark-zju
Differential Revision: D14566776
fbshipit-source-id: 8fff03a86953fb60ed06dbbdcdd0bffc379bd047
Summary:
Computing mutation entries for all local commits is expensive when there are
lots of local draft commits. Ideally we would have an indexed changelog that
would make these lookups fast, but until we have that, put entries in the
mutation store for these commits to take advantage of the fast lookup there.
Reviewed By: quark-zju
Differential Revision: D14566782
fbshipit-source-id: cc3a05715337a510a65d8ff436c59d16d0f0447e
Summary:
The computations for instabilities revsets (`orphan`, `contentdivergent` and
`phasedivergent`) are complex, and aren't really necessary for the way we use
mutation information.
The `orphan` revset can be implemented as an alias for `obsolete():: -
obsolete()`. The other conditions can be detected on a case-by-case basis
later if we need them.
Reviewed By: quark-zju
Differential Revision: D14566784
fbshipit-source-id: 60b8443ad4c0c82d8250d8e9a10e73fae770daa8
Summary:
To support future alternate hashing schemes, predecessor identities should be
prefixed with the hashing scheme in use.
Currently there is only one hashing scheme: `hg`, which is the Mercurial
hashing scheme.
Reviewed By: quark-zju
Differential Revision: D14566778
fbshipit-source-id: baaaf2f078886a1cc7ac20d12923a63b4da09db6
Summary: `std::fs` is only needed for Windows. Do not "use" it on *nix systems.
Reviewed By: sfilipco
Differential Revision: D14634779
fbshipit-source-id: 9fd9a29ae27e13f00b4adbc83a74bd92a1b1658c
Summary:
Change fields in IndexDef to private. Provide a public constructor method and
switch users to use that instead. This makes it possible to change the IndexDef
struct in the future (ex. having extra optional fields about whether the index
is backed by radix tree or something different).
Differential Revision: D14608955
fbshipit-source-id: 62a413268d97ba96b2c4efd2ce67cd4fa0ff4293
Summary: Update Rust toolchain to 1.33.0 with fixes to make our code compatible with 1.33.0.
Reviewed By: Imxset21, kulshrax
Differential Revision: D14608312
fbshipit-source-id: 2d9cf7d01692abaed32f9adffa0e5eb51cfacb4f
Summary:
The upstream has removed it in https://phab.mercurial-scm.org/D2393. Do the
same.
The deleted C++ code seems to leak `Py_False` if `usemanifestv2` is not set.
Reviewed By: singhsrb
Differential Revision: D14611525
fbshipit-source-id: d828526c31aaa861d100a846bba79d1f5898e245
Summary:
A user hit cryptic error message:
File "revset.py", line 423, in ancestor
ancestors = repo.changelog.index.ancestors
AttributeError: 'list' object has no attribute 'ancestors'
That was because they have run `rm -rf` and the `.hg` directory was mostly
removed. `hg` falls back to revlog v0, and the code in question obviously
dislikes revlog v0.
Change the error message to just say repo corruption.
Since there are code depending on revlog v1, and we don't use v0 or v2. Remove
both of them.
Reviewed By: singhsrb
Differential Revision: D14610769
fbshipit-source-id: 9015b74989d8fa4ad50bc36ec48bca26a1faa361
Summary:
Callers may call `remotenames.activepath` with the remote as a string URL. For
remotenames we must normalize these paths as we do for remotes that are passed
in as objects, for the same reason as in D14051479.
Differential Revision: D14621090
fbshipit-source-id: 8a02e9554039ad3daf3093001889cf1746ce395a
Summary:
The extdiff extension uses archive on the workingctx to make snapshots
of certain files. Prefetching fails on this because it sees placeholder file
nodes. Let's just not prefetch in this case at all.
Differential Revision: D14609691
fbshipit-source-id: 2d06bf015a8b10afa16b3b0bcb266afb102d63b9
Summary:
The configparser tests `hg::tests::test_basic_hgplain` and
`hg::tests::test_hgplainexcept` set different values for `HGPLAIN` and
`HGPLAINEXCEPT`. Since the tests run in parallel and use the same environment,
one of the tests may fail if they run at the same time.
For these tests, create a mutex for the environment and lock it for the
duration of the test, ensuring these tests do not interfere with each other.
Reviewed By: jsgf
Differential Revision: D14615394
fbshipit-source-id: 9f123668d93223655514db2ae34b05354a6b578c
Summary:
Now that we have perftracing infra, let's trace a bunch of likely
problem spots.
Reviewed By: sfilipco
Differential Revision: D14426367
fbshipit-source-id: 354a241aa9ac5d75d34062a9838d581b4f46746f
Summary:
Most of the repacks are background repacks, and most of the complaints are
coming from laptops users. Thanks to the rust repack, most of time during
repack is now spent in repacking loosefiles. While repacking them is expensive,
testing whether data is in a loosefile and obtaining it is actually pretty
fast. Packfiles have the opposite issue, repacking them is fast, but finding
data in them may be expensive if a lot of them are present.
Based on this, it makes sense to repack packfiles more frequently than
loosefiles. At first, the newly added option will be used to turn-off loosefile
repack for laptop users. A less frequent loosefile repack will be implemented
in a later patch.
Reviewed By: DurhamG
Differential Revision: D14586986
fbshipit-source-id: 5bc5c839cf8d2d78bcc4ffa016bbe3cf1b2ef3f7
Summary:
I'm not sure which change broke the test. It requires `lfs-test-server` to run,
which is not installed by default. So that's why people didn't realize it.
Differential Revision: D14607695
fbshipit-source-id: 3b0e6d4250f476abced414c00bddfe7d29d062d4
Summary:
See D14606986 for context. `repo.close` should be protected by not crashing on
stdout or stderr write errors (SIGPIPE or EPIPE). Move `deferred` to `atexit`
handler to get the protection.
Test changes are caused by ordering changes.
Differential Revision: D14607407
fbshipit-source-id: 5a42aefcec395f48b8ecb67426429ef2e41f5666
Summary:
This is the first diff of an alternative fix of D14528603. See also D14603974
for context.
We'd like atexit handlers to not crash with EPIPE or SIGPIPE when writing to
stderr or stdout. Therefore disable SIGPIPE signal handler and patch ui methods
to do so.
Differential Revision: D14607159
fbshipit-source-id: 274c5174813d402a7e0b8b5be7c8fcb0524fcdb3
Summary:
akushner and I both hit an issue where `hg log` hangs for a long time after
exiting the pager by pressing `q`. That was caused by D14528603. Revert it to
fix it.
The root cause is apparently a bug in Python 2 (or C stdlib?):
# a.py
import signal, os
signal.signal(signal.SIGPIPE, signal.SIG_IGN)
out = os.fdopen(1, 'wb', 1)
while True:
out.write(b"a\n")
# shell
python2 a.py | head -n 1
# hangs
Python 3 does not have the issue.
Reviewed By: singhsrb
Differential Revision: D14603974
fbshipit-source-id: 3b4d716133853632e56dfeb59b1858f926a2c146
Summary:
Now that we're recording perftraces, let's log their results to the
blackbox if the command exceeds a configurable threshold.
Reviewed By: sfilipco
Differential Revision: D14426366
fbshipit-source-id: 24f261aaa2b089dbc959d709e51de1c0359d976d
Summary:
Adds tracing for the command dispatch. All other traces will be a
child of this root level trace.
Reviewed By: sfilipco
Differential Revision: D14426369
fbshipit-source-id: 2b996e027a2d6b163162bdceba571a3ee2186f6b
Summary:
Adds the initial perftracing infra. It's just a collection of functions
for starting and ending tracing and associating data with the traces.
Reviewed By: quark-zju
Differential Revision: D14426368
fbshipit-source-id: 72a2fad901ff52877f3958db2b924d95f45eeac7
Summary:
```
building 'indexes' library extension
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: /data/users/sfilip/fbsource/fbcode/scm/hg/edenscm/hgext/extlib/indexes/Cargo.toml
workspace: /data/users/sfilip/fbsource/fbcode/scm/hg/edenscm/hgext/extlib/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: /data/users/sfilip/fbsource/fbcode/scm/hg/edenscm/hgext/extlib/pyrevisionstore/Cargo.toml
workspace: /data/users/sfilip/fbsource/fbcode/scm/hg/edenscm/hgext/extlib/Cargo.toml
```
`profile` settings are ignored for non root packages. I introduced this issue
when I added a workspace for extlib: D14543989.
Reviewed By: kulshrax
Differential Revision: D14606019
fbshipit-source-id: 7ec4743d0913e443c378ae83f392817f6e6d3aab
Summary:
The ChaCha RNG has moved from `rand` to `rand_chacha`. Use the new location to
prevent the deprecation warning.
Reviewed By: quark-zju
Differential Revision: D14596397
fbshipit-source-id: e082369d4cf2d4ab42eb37df83a2627b937dcf62
Summary:
Closing a repo is required to commit the pending transactions, or to run a
background repack when packfiles were downloaded. Usually, the close method is
called in dispatch after a command is run and a valid repository was passed via
-R. The debugedenimporthelper however may open the repository manually, and
since it doesn't close it, we may end up with a large number of packfiles.
Let's manually close it to avoid this issue.
Reviewed By: simpkins
Differential Revision: D14531514
fbshipit-source-id: 9b2d1648775e4a2c9eea4c232bf0ae4fee43297d
Summary:
Windows disallows rewriting or truncating mmaped files. Fix the tests by
either dropping the mmap, or skipping the test.
Reviewed By: sfilipco
Differential Revision: D14572119
fbshipit-source-id: dccafdc66db3830c2919232d899ba31365120066
Summary:
Windows has 2 kinds of paths - the UNC path (starting with `\\?\`), and paths
most people use (ex. `C:\foo\bar`). The former is more powerful (reserved names
like `nul` can be used), and is the "canonicalized" form as seen by Rust stdlib.
The UNC paths are stricter, though. `/` is not treated as `\` automatically,
`.` and `..` are considered illegal. That is, trying to canonicalize a UNC path
with `..` or `.` will result in an error.
It's possible to get `.`, or `..` into part of an UNC path, by using the
`PathBuf::join` API provided by the Rust stdlib. That is, a legal UNC path stored
in `PathBuf` can become illegal by `join`ing a non-UNC path.
I'm not sure what's the most "clean" fix. Perhaps using two different types to
represent UNC path and non-UNC path in stdlib? But that's definitely not a trivial
(or even practical) change.
For now, just teach the config parser to "friendly try again" by stripping the
UNC prefix and re-canonicalize paths. So it can handle `.` or `..` used by
`%include`.
Reviewed By: sfilipco
Differential Revision: D14568119
fbshipit-source-id: 2a55faa945c8d03574fd56e82d946c9ef7f0138f
Summary:
The `load_or_create_meta` function is subject to filesystem races. Solve it by
always taking a lock.
This hurts performance a little bit. But `open()` should not be in a hot loop.
So it should probably be fine.
Reviewed By: sfilipco
Differential Revision: D14568122
fbshipit-source-id: d9b28555ab94252da4717de709b780b361e1dda7
Summary:
On Windows it's impossible to open (2) a directory. Therefore add a utility
function that creates `lock` file automatically on Windows and open that file
instead.
Reviewed By: sfilipco
Differential Revision: D14568117
fbshipit-source-id: bc7ae7046be654560c38fbd98ec4dd58c071b1dc
Summary:
Previously, `load_or_create_meta` could return without actually creating the
meta file. That leads to problems when `load_or_create_meta` is called a
second time via `flush()`, it rewrites the primary file incorrectly. On Windows,
it will fail to rewrite the primary file.
Fix it by actually writing a meta file before returning.
Reviewed By: sfilipco
Differential Revision: D14568118
fbshipit-source-id: da3ad42bf48a923d732b1719839ca1953bd2b06c
Summary:
If the cloud sync or pushbackup commands start in background themselves, it will trigger a new background command to back up to the secondary afterwards.
Note that for cloud sync, for the secondary store we trigger pushbackup command, not cloud sync. If should be fine. We don't backup duplicates as we always check with the server first what is already backup. To call pushback looks simpler as it doesn't involve all the complexity of cloud sync, and basically we just need to backup to the secondary.
Reviewed By: markbt
Differential Revision: D14578770
fbshipit-source-id: f81a50fd76e64f2d77d8d7004b201fcfe8a090d2
Summary:
Change debugignore to test directories properly (which, only affects sparse
repos in practise) and stop printing out the source ignore rule location, as we
no longer have that information in the gitignore world.
Reviewed By: markbt
Differential Revision: D14547049
fbshipit-source-id: e7c307b1e1f4a8dcd30d00bec1f3e7a84a14b47b
Summary:
This particular situation happens in the wild when the amend doesn't rebase
because of conflicts and users work on their stack using `hg prev` and `hg next
--rebase`. In this case when there's non-obsolete child that's always the child
we want to choose.
We're verbose about what we're doing so it's not confusing to the users.
Reviewed By: quark-zju
Differential Revision: D14560584
fbshipit-source-id: a453c0301a5156eea0d19ceb40d9a64e80b7fca7
Summary: The next commit introduces a heurestic to resolve those.
Reviewed By: zertosh
Differential Revision: D14560585
fbshipit-source-id: b62b59e4b254e59e88cfc7859aa21feffc360b05
Summary: This diff adds serializable types representing batch requests for the Eden API. Just like the response types, these types must live the Mercurial's `types` crate so that they can be shared between the client and server.
Reviewed By: quark-zju
Differential Revision: D14573332
fbshipit-source-id: c31d718e6a97829ce1acfc25b8853dc3761323a7