Summary:
If the visibility state file is read after the changelog is opened, the visibleheads
may have been modified to point to a commit that had been added to the changelog
afterwards, which means the commit is not accessible to the current process.
We need to ensure that the visibleheads file is read just before the changelog is
opened. The safest way to handle this is to make the visibleheads tracking part
of the changelog object. Whenever we open the changelog, we get a correctly
up-to-date view of the visible heads.
Reviewed By: quark-zju
Differential Revision: D15468483
fbshipit-source-id: 94d6b3e6db5211d7346f4a244f182383970fcb74
Summary:
When reading and writing visibility information, log some of the heads that
have been read or written to the blackbox log to improve debugability.
Reviewed By: quark-zju
Differential Revision: D15468486
fbshipit-source-id: 0f3206bb8c0044c70cb793d67b4c49a9fd633613
Summary:
If a ui object is not available, then callers can't make blackbox logs. However,
the blackbox extension has `lastui()` which lets it find a ui object.
Add `util.log`, a hook point for blackbox that lets callers log to blackbox without
having a ui object to hand.
Reviewed By: quark-zju
Differential Revision: D15495215
fbshipit-source-id: b468647ccacc6992f71b9a8be2552db860d16ebe
Summary:
This is useful to be able to do both `util.timed` and `util.timed(smth=...)`
on functions we want to measure. In particular, I want to be able to override
the annotation from the `func.__name__` to the custom string.
Reviewed By: krallin
Differential Revision: D15494127
fbshipit-source-id: 817c4bb5cbd94c0e6a401ca72b2b375a3d04aa8f
Summary:
Recently, the merge tools configs were moved from a file to a Rust
string. The path to these configs being empty, this caused the
stripping of '\\?\' on Windows to crash. Let's simply use "<builtin>"
in the `hg config --debug` output to signify an embedded config.
Reviewed By: quark-zju
Differential Revision: D15499196
fbshipit-source-id: 1141cfafde5ceae9c814ed711e00d93a4665c5fb
Summary:
Reading filectx info tried to use an optimization to get the filenode
without uncompressing the whole manifest. In a tree world, this optimization
actually hurts performance because it requires downloading the parent tree and
performing a diff. Since everything is now treeonly, let's just drop this
optimization.
This helps in some Eden tests where they prefetch a specific commit then attempt
to access it offline.
Reviewed By: markbt
Differential Revision: D15344433
fbshipit-source-id: 3b6ebc27ce7e263abefaa962856a4c7bea0df793
Summary:
Previously readfast was an optimization that sometimes returned a delta
against p1, but other times returned the full manifest. This was weird and
caused certain algorithms to sometimes be O(changes) but other times O(repo).
In a tree world we no longer need this optimization, so let's drop it.
readdelta is similar in that it would read the difference between a manifest and
it's delta base. This has no relationship to the delta between a manifest and
it's parent, so it's weird and we should get rid of it.
There is a legitimate use case for wanting to know what entries are new in a
manifest, like when deciding what to send over the wire. So let's add a new
readnew() function that is explicitly for reading what entries were introduced
by this tree. The implementation is basically the same as readdelta, but
deltaing against p1 instead of the deltabase.
Reviewed By: markbt
Differential Revision: D15344434
fbshipit-source-id: dc8dca326f66b2fc55cc76f93c7ce48aa7efedf3
Summary:
Detecting the underlying store type allows for store writes to be done fully in
Rust, with no roundtrips in Python. This also allows us to reduce our
dependency on the mutabledatapack Python code.
Reviewed By: kulshrax
Differential Revision: D15474314
fbshipit-source-id: 926d828e350e5e1c59b2f29ed11dd71db17eae56
Summary: This will be used in the edenapi binding and therefore needs to be public.
Reviewed By: kulshrax
Differential Revision: D15474312
fbshipit-source-id: fcef80ba414ae63908d4a4191003fabe0f07c254
Summary:
This will allow the object to be used in native Rust code without roundtrips to
Python.
Reviewed By: kulshrax
Differential Revision: D15474310
fbshipit-source-id: f89033ac9e449125d4563e9d42b31cb6362c3235
Summary:
While the datapack read path is currently being done in Rust, the write path is
still being performed in Python. This class is the first step towards switching
the write path to Rust.
A nice bonus of this class is that it abstract packfile/indexedlog and besides
at construction time, the users of it won't be aware of which store is used.
Reviewed By: kulshrax
Differential Revision: D15474313
fbshipit-source-id: 49454d8f089089f164d858d590f254c78d3f5eb6
Summary:
Similarly to DataStorePyExt, this trait abstract parsing Python object and
transforming them into Rust objects.
Reviewed By: kulshrax
Differential Revision: D15474316
fbshipit-source-id: 3c72606dca52743824151bbad10f20a6ed6c1b2f
Summary:
The trait object `dyn DataStore` isn't sized and therefore doesn't implement
the DataStorePyExt as the later requires a sized type. There is no reason for
this restriction, so let's allow non-sized types to implement DataStorePyExt.
Reviewed By: kulshrax
Differential Revision: D15474317
fbshipit-source-id: 06ae62ef7f18808f316da03dc87ba9a6fa986690
Summary:
While conflicting method names are allowed in Rust, it usually leads to subpar
compiler warnings and code to be written in a non-traditional way. Let's rename
the methods on these 2 traits so there isn't any conflict to avoid this.
Reviewed By: kulshrax
Differential Revision: D15474311
fbshipit-source-id: 64e4f4cef2aa89c18f51b81260eff70f57183465
Summary:
In all cases, the mutable stores also support reading from them. Let's have the
compiler enforce this, and implement the missing traits.
Reviewed By: kulshrax
Differential Revision: D15474315
fbshipit-source-id: dfcd93f319582ff3cd54aeabaa66bc6df9ce63a8
Summary:
The phases command had some naive code that looped over every revision
in the repository. Twice. This was really slow on huge repos, so let's get rid
of the need for it.
I originally attempted to optimize it by only looking at commits greater than
the ones being passed in, but this is incorrect since changing a commit to
public may affect it's ancestors. Instead of trying to optimize it further,
let's just drop the output text entirely.
Reviewed By: quark-zju
Differential Revision: D15465942
fbshipit-source-id: ba63a1096a515032fe13a8699807fe69c73c80ed
Summary:
When writing to a revlog we need to check if the revlog already
contains the node. A normal `node in self.nodemap` is quite expensive in large
repositories because it's likely the node is not in the nodemap and therefore it
must scan the entire index.
This new function uses the knowledge about the parents to limit how many nodes
are inspected when adding a new revision. In the degenerate case this could end
up traversing a large chunk of the graph in a slow way, so we catch the case
where the parents are far from the tip and revert to the old native path.
Reviewed By: quark-zju
Differential Revision: D15444548
fbshipit-source-id: 5f19ccf85fb11f1c787ebda09df9c4bef17a2a31
Summary: Check that the user's configured TLS credentials exist during client setup and disable HTTP if they aren't present.
Reviewed By: quark-zju
Differential Revision: D15459917
fbshipit-source-id: f20664c6522e47f2960cec1f02ef1a5f4c7e2c8c
Summary:
In some cases the revlog actually computes the hash it uses. In that
situation we don't need to validate it. This is showing up as a performance
hotspot in profiles of the server receiving lots of commits. I'm not sure why
the creation of the hash is not showing up as a hotspot though, which is a bit
strange.
Reviewed By: kulshrax
Differential Revision: D15459193
fbshipit-source-id: 99823dd9e1709dbfecf2626b07f0e4c3ec43686c
Summary: Add several methods to the DownloadStats FFI wrapper to allow Python code to easily access various metrics.
Reviewed By: xavierd
Differential Revision: D15458802
fbshipit-source-id: 9e19d2a9b3fcb6e3a066f040fd110510a2f0d63e
Summary: Make all of the EdenAPI data fetching methods return an object containing metrics. These can then be logged by the Python code.
Reviewed By: xavierd
Differential Revision: D15440641
fbshipit-source-id: 4a5fd090066a9020ae32986ab45ee8fb70c8de53
Summary:
With treemanifest we no longer have manifest rev numbers, so let's drop
them from the templates. This let's us convert a few more tests to treeonly.
In theory automation may parse this, but I kinda doubt anyone parses the
manifest node from this.
Reviewed By: xavierd
Differential Revision: D15296141
fbshipit-source-id: a4d2194bd9604867cd9958509bcd2e6513a72494
Summary:
Now that flush is implemented everywhere, we can replace the use of close with
flush.
Reviewed By: kulshrax
Differential Revision: D15416717
fbshipit-source-id: 5aea730b435e3c2073619ba676e60134f59f87c9
Summary:
Now that MutableDeltaStore::flush is implemented everywhere, let's remove the
close method and replace it with flush where necessary.
Reviewed By: kulshrax
Differential Revision: D15416716
fbshipit-source-id: e66dad66a3aff25e80efb10dc2e22c9878336699
Summary: This is the last history store that didn't implement flush.
Reviewed By: kulshrax
Differential Revision: D15416712
fbshipit-source-id: f091fe697e5015afd5d6e6dc7ae6a1de27bb9b5b
Summary:
A new flush method is added to mutablebasepack that just close and re-init
self.
Reviewed By: kulshrax
Differential Revision: D15416708
fbshipit-source-id: 79cdcb20b51b9688a5e95402057c7da27883003c
Summary:
This hook fires for every commit that is introduced in a pull. When
doing pulls with hundreds of thousands of commits, this introduces a noticable
delay. We don't use this hook anywhere, and it's not particularly scalable, so
let's delete it.
Reviewed By: singhsrb
Differential Revision: D15424697
fbshipit-source-id: 98d76bca703e625adf5be8f6234436befd260fc4
Summary: The flush method is now in the MutableDeltaStore, so move it there.
Reviewed By: kulshrax
Differential Revision: D15416711
fbshipit-source-id: 55eb411e4e4cf98c51813ef29364dcba74dc7f66
Summary: This diff adds an `hg debuggettrees` command that downloads trees from the API server and stores them in a datapack.
Reviewed By: xavierd
Differential Revision: D15301607
fbshipit-source-id: 7820d82d7d021c420e911a6a2e9bfce62b69fa2e
Summary:
The postincoming checks prints out advice of the following forms:
* `(run 'hg heads' to see heads)`
* `(run 'hg heads' to see heads, 'hg merge' to merge)`
* `(run 'hg heads .' to see heads, 'hg merge' to merge)`
* `(run 'hg update' to get a working copy)`
This advice is no longer useful, so remove it.
Reviewed By: DurhamG, farnz
Differential Revision: D15317185
fbshipit-source-id: 50ba576406c96715fa058399da53462be9b7a3bf
Summary:
Merge the functionality of the infinitepushbackup extension (backing up commits
to commit cloud) into the commitcloud extension.
These two extensions are highly coupled, and the commitcloud extension
monkey-patches the infinitepushbackup extension for a lot of its functionality.
There is also a lot of code duplication between the two extensions which we can
remove if they are part of the same extension.
The infinitepushbackup commands (`hg pushbackup`, ...) are moved to subcommands
of the `hg cloud` command, e.g. `hg cloud backup`.
Each feature of the infinitepushbackup extension is moved to a new module
in the commit cloud extension:
The `background` module controls background execution of `hg cloud backup` and
`hg cloud sync`.
The `backupbookmarks` module tracks and updates scratch bookmarks for backups.
This will be deprecated in the future.
The `backupstate` module tracks whether or not a commit has been backed up.
This is now tracked separately from backup bookmarks in a new file:
`.hg/commitcloud/backedupheads.<remote-identifier>`. This also covers hidden
commits, preventing a re-backup of previously backed up commits when they are
unhidden.
Previously the commitcloud extension customized the smartlog annotations: `Backing up`
became `Syncing`, etc. This is now removed for consistency.
Previously the infinitepushbackup extension disabled background backup by
injecting an `infinitepushbackup.disableduntil` config entry into the user's
config. This is now replaced with a state file at `.hg/commitcloud/autobackup`.
Either option can be set to disable auto backup. Commit cloud will wait until
both have expired before starting to run background backups again.
Reviewed By: DurhamG
Differential Revision: D15276939
fbshipit-source-id: 1d28989a157286e47d3dd97ca9c70b27f692dda1
Summary:
Thin lto is much faster to compile, and doesn't make the resulting binaries
that much bigger.
Reviewed By: xavierd
Differential Revision: D15396282
fbshipit-source-id: 3e2bf059756d47218061d7e41f041e445d7f60c8
Summary:
D15381038 made the `pyrevisionstore` crate a strongly-coupled dependency of the
`bindings` crate. For simplicity, just move the code into the bindings crate.
Reviewed By: xavierd
Differential Revision: D15392547
fbshipit-source-id: 3dfa924b33722760ef7829fbb8659ce0262e6671
Summary:
This is a nice-to-have feature requested by nikz. He made an initial version
at D15029612, which changes `MatchResult` to include enough infomation to
explain a rule.
The diff reworked the feature so the runtime CPU and memory overhead stay
minimal if nothing needs to be explained. The change also makes it easier
to display more information - all rules matching a path, to make it easier
to detect and remove duplicated or conflicting rules.
Reviewed By: DurhamG
Differential Revision: D15095576
fbshipit-source-id: 5784aabd50d9b716dceead10bc593f9155228046
Summary:
After D15266191, the bindings crate directly depends on pyrevisionstore, and
since then we have seen really weird compilation errors that magically go away
when some files are touched.
From my observations, here is what I came up with. The pyrevisionstore crate is
both compiled as a dependency of the bindings crate, and as a library to be
used in python. Therefore, its Cargo.toml contains a '[lib]' section, the
presence of this section forces the crate to be compiled into a
"libpyrevisionstore.{rlib,so}", while all the regular crates have a hashed
suffix like "libedenapi-2b9975ec9b865e87.rlib".
None of this would usually matter, but our build system re-uses the build
directory to then compile the pyrevisionstore library. While doing so, it will
re-create the "libpyrevisionstore.{rlib,so}", but not in an identical fashion.
After this, the rest of the build succeeds.
Once a file in the bindings crate is touched, recompiling will only recompile
its file, and not the pyrevisionstore crate, but since
"libpyrevisionstore.{rlib,so}" is different, it now fails to compile...
A previous effort tried to compile each top level target into a separate
directory, but that directly affected some of our tests. Since the underlying
issue is that pyrevisionstore is compiled twice, let's simply not compile it as
a top-level target and simply fold it into the bindings lib. Ideally, we would
want to do the opposite, but let's do that at a later time.
Reviewed By: DurhamG
Differential Revision: D15381038
fbshipit-source-id: 047cfab794371464942f19084ffb9240e836cb40
Summary:
See the previous diff for motivation.
This diff moves the special builtin config to code so we no longer need
"data_path" for the "load_system" API.
Reviewed By: markbt
Differential Revision: D15307750
fbshipit-source-id: 15b729e6585ead5ead05ffd6ffe688387b8e0be9
Summary: When the `--shared` flag is passed to `hg root` i.e. `hg root --shared` - display the shared root of the current directory.
Reviewed By: quark-zju
Differential Revision: D15363157
fbshipit-source-id: 6e6c13f27c624502a83edc1046ae3d4de227b6b8
Summary:
See the previous diff (D15291676) for motivation. Basically, it's hard to keep
static resources work well with 3 different kinds of deployments (buck xar,
Windows zip, and python side-packages).
This diff just precomputes common styles and hardcoded them in Python code.
This should address a user complaint that `-T xml` does not work.
Reviewed By: markbt
Differential Revision: D15307457
fbshipit-source-id: de4edb0b6896b731301715abe612a31b1512b00a
Summary:
The `-` graphnode can be confusing as `-` is also used for horizontal graph lines.
There are no good ASCII characters to use for invisible commits, so revert to
just using `x` so that they match obsolete commits.
Reviewed By: quark-zju
Differential Revision: D15293717
fbshipit-source-id: 5d1f327ddd8c3f104a99f494309a79b10ad71401
Summary:
There are multiple reports that the work in the commit message editor gets lost
for various reasons. We have `.hg/last-message.txt` for commit hook failure,
but that one does not take care of all code paths (ex. metaedit).
This diff changes `ui.edit` directly to try to save messages in `.hg/edit-tmp`
for 2 weeks.
Reviewed By: kulshrax
Differential Revision: D15347831
fbshipit-source-id: 9207adf4315d94a4892685a03f323e89d9c4a7f1
Summary: We don't have the .eden/symlinks on Windows right now. Will enable this code when we have them or something equivalent working. This change would help make the hg commands that don't need to talk to Eden work. In the next diff, will teach the Thrift client how to talk to Eden and will start sending status and other requests to it.
Reviewed By: quark-zju
Differential Revision: D15341528
fbshipit-source-id: f0a6fb092f6873002f8db119f07ab884399c9bf6
Summary: Make `hg debugignore` show what gitignore rules match the files.
Reviewed By: quark-zju
Differential Revision: D15029612
fbshipit-source-id: e3621c198b9d6e3823de5587b0b859d2d0e36888
Summary:
It's a headache about how to deal with static files (help/, template/, default
config), since we have 3 different ways of packing the Python code: normal
(linux), embedded (Windows), and fbcode xar (linux). The latter two need
workarounds to make `help/` work, and for the "embedded" case, It is currently
broken.
This diff moves user-facing `help/` files to a Python module to remove the need
of special casing it in different ways.
`helptext.py` was created via:
import glob, os
for path in glob.glob('help/*.txt'):
if path.count('.') == 1:
name = path.split('.')[0]
name = os.path.basename(name)
if '-' in name:
name = 'globals()[%r]' % name
print("%s = r'''%s'''\n\n" % (name, open(path, "rb").read()))
os.unlink(path)
The help text about named branches are removed to make `test-check-help.t`
happy.
Reviewed By: mitrandir77
Differential Revision: D15291676
fbshipit-source-id: 2320bd59369ef092d8c06b8539e401799a0467ef
Summary:
Drop the "internals" help text from the UI. This is because the internal docs
are mostly outdated (ex. we're moving to new HTTP protocols and slowly removing
bundle2 formats, we're moving away from revlogs).
This diff just disabled access to them via the `hg help` command, the files are
still accessible in the repo.
Reviewed By: kulshrax
Differential Revision: D15291675
fbshipit-source-id: a6e55e0ed085bb54def3790aaaf1a92a4bfa787f
Summary:
Writes to stderr may be unbuffered. This means when `ui.write_err` is called
with multiple strings, they may end up being separated as different writes.
This causes flakiness in the test, particularly when receiving error messages
from a remote server, as depending on timings output may appear as either:
remote: abort: error message
or
remote: abort:
remote: error message
Write to the error stream in a single operation by joining all the messages together.
Differential Revision: D15316694
fbshipit-source-id: de5edf05e137d88006a0919f02f8b9cf7a17fa42
Summary:
The Hyper-based EdenAPI client proved to be problematic in practice due to various difficult to debug issues with Tokio, Hyper, TLS, and h2. We have kept it around for the time being while building out the Curl based client in case we wanted to revert back to a pure Rust solution.
Today, the Curl client works well, and future work on the EdenAPI will involve adding more functionality to it. Given that both the Hyper and Curl clients implement the EdenAPI trait, modifications to the trait involve updating both clients. So far this has been acceptable because the updates have been minor, but we would now like to add substantial new functionality to the trait (namely tree fetching), and adding this functionality to the Hyper client would take nontrivial effort.
Given that we aren't using this client at all, let's just delete it. We can always bring it back from the repo's history if we need it in the future.
Reviewed By: quark-zju
Differential Revision: D15289196
fbshipit-source-id: d9c0c3cfc5087c3e080a9919dd9e627b9657676c
Summary: The edenapi is now independant of the storage type for history data.
Reviewed By: kulshrax
Differential Revision: D15284355
fbshipit-source-id: 72a5db42bb0fb19ee03155b13914202581ab5966
Summary:
The type of store where data is stored is now fully abstracted to the python
bindings. For now, edenapi will write to the pending mutabledatapack, but we
can now switch it easily to any other store implementing MutableDeltaStore,
including an IndexedLogDataStore.
Reviewed By: kulshrax
Differential Revision: D15266191
fbshipit-source-id: 638cf90a567ef170e0302376312c4b82e6d6b6da