Commit Graph

3187 Commits

Author SHA1 Message Date
Chad Austin
f7491f7741 add independent cache size limits per object type
Summary:
Instead of clearing every single cached object when the total size
exceeds the ephemeral storage limit, keep a limit per object type and
only clear those that exceed their quota.

Reviewed By: simpkins

Differential Revision: D19358312

fbshipit-source-id: 6918d6f4cc2931aed79a9025d0e0f357ede515e0
2020-01-21 19:41:47 -08:00
Chad Austin
e5e9d8cf69 clear the deprecated blobsize keyspace at startup
Summary:
EdenFS no longer uses the blobsize keyspace. To avoid wasting space,
clear and campact it on startup, along with any keyspaces we
deprecated in the future.

Reviewed By: fanzeyi

Differential Revision: D19354881

fbshipit-source-id: 5285757a0e44ab1080c5f940283e06b17bec811d
2020-01-21 10:33:11 -08:00
Chad Austin
46259647e2 deprecate getManifestEntry
Summary:
Indicate getManifestEntry is deprecated so we remember to delete it
down the line.

Reviewed By: genevievehelsel

Differential Revision: D19459793

fbshipit-source-id: 86dd173cfb12c36cf6ba19eaf4be96dfe624c05f
2020-01-21 10:33:10 -08:00
Chad Austin
36954d229d stop calling getManifestEntry and instead look directly in the manifest
Summary:
getManifestEntry has an inefficient implementation. It can result in
multiple round trips to the Mercurial importer process and under heavy
usage it can clog the Thrift worker thread pool. Moreover, it only
provides data that Mercurial already knows. Instead of calling
getManifestEntry, look in the manifest to see if the entry exists.

Reviewed By: quark-zju

Differential Revision: D19426507

fbshipit-source-id: 67bcd7e0ae62f84b313aa6a7203832fb9a10f315
2020-01-21 10:33:10 -08:00
Chad Austin
d23773e9b0 restructure KeySpace and move it into KeySpace.h
Summary: Simplify the definition and use of KeySpace and move it into its own header.

Reviewed By: simpkins

Differential Revision: D19353441

fbshipit-source-id: ef07677d927a48839b709711388abeb3c1ed9679
2020-01-21 10:33:10 -08:00
Xavier Deguillard
524c85d711 revisionstore: limit delta chain to 1000 entries
Summary:
We've seen a case where a datapack contains a circular delta chain, causing
Mercurial to fall into a infinite loop when trying to read it. Let's fail when
the chain is over 1000 entries.

Reviewed By: quark-zju

Differential Revision: D19458453

fbshipit-source-id: bfa503f7807122eca72cf94418abda161dafa41c
2020-01-21 08:50:59 -08:00
Jun Wu
b863b99cd2 pullcreatemarkers: print how many commits are marked as landed
Summary:
wez silenced the messages in D18796291. I think it's still useful to show why
commits get disappeared after pull. Let's just print a summary by default, and
print less or more things depending on flags:

- `-v`: print what commits are marked as landed, similar to pre-D18796291.
- `-q`: print nothing, hide the summary line.

Reviewed By: DurhamG

Differential Revision: D19437916

fbshipit-source-id: 130c5a24f0978674d363227f44089d307f7aff72
2020-01-21 07:36:34 -08:00
Jun Wu
0d15eb6227 graphql: translate globalrev to hg node in getlandednodes
Summary:
In www, Phabricator used to return both landed global rev and hg commit hashes.
Now it only returns global revs. The "mark landed" logic ignores global revs
and does not mark them as landed.

This diff changes it so the graphql client translates global revs automatically
so the "mark landed" logic can still work.

Reviewed By: DurhamG

Differential Revision: D19437915

fbshipit-source-id: 0e074bda9a0ee53c594750b2b1fd214f31dec843
2020-01-21 07:36:34 -08:00
Jun Wu
3da70a5d46 graphql: support translating GLOBAL_REVs in getmirroredrevmap
Summary: The function assumes binary nodes. Make it aware of GLOBAL_REVs.

Reviewed By: DurhamG

Differential Revision: D19437914

fbshipit-source-id: aa36b81be2f8e4c38c51667b4cf7048eeb7250da
2020-01-21 07:36:34 -08:00
Mark Thomas
4958c4e342 tests: update tests-fb-*.t to use new tinit features
Reviewed By: quark-zju

Differential Revision: D19457679

fbshipit-source-id: d1010f0d2eee69ecdee5c3feba772bd3684d4cec
2020-01-20 02:45:17 -08:00
Mark Thomas
d2730c3ba0 tests: update tests-[r-x]*.t to use new tinit features
Reviewed By: quark-zju

Differential Revision: D19457676

fbshipit-source-id: 5bbab22ff0d98b725b63b906864037fae5fa5171
2020-01-20 02:45:16 -08:00
Mark Thomas
633382de11 tests: update tests-[i-p]*.t to use new tinit features
Reviewed By: quark-zju

Differential Revision: D19457680

fbshipit-source-id: 2be941f22525ed2d9f5a1aa3c92af38fb612eb46
2020-01-20 02:45:16 -08:00
Mark Thomas
b361a8d1bd tests: update tests-[a-h]*.t to use new tinit features
Reviewed By: quark-zju

Differential Revision: D19457677

fbshipit-source-id: 9f121837dfc6bf98ff4525c6535496b292409844
2020-01-20 02:45:15 -08:00
Mark Thomas
b654a9aae5 tests: use disable treemanifest in place of setconfig
Summary: Use `disable treemanifest` in place of `setconfig extensions.treemanifest=!`

Reviewed By: quark-zju

Differential Revision: D19457678

fbshipit-source-id: 47c8b3c4f4ed5cfc97275ca67afab4a86ffe7f0d
2020-01-20 02:45:15 -08:00
Mark Thomas
212cec117b tinit.sh: add configure for setting up standard configurations
Summary:
Add a new `tinit.sh` function: `configure`, which takes over from the
feature-enabling aspect of `enable`.

This provides a few features that are configurable:

  * `dummyssh` sets `ui.ssh` to `dummyssh`.
  * `mutation` and `mutation-norecord` enable mutation and visibility tracking
  * `evolution` enables evolution and disables mutation and visibility.
  * `noevolution` disables evolution, as well as mutation and visibility.

Since `enable` now only refers to extensions, it is joined by a corresponding `disable` to
disable an extension.

Some tests are updated to take advantage of these new functions.

Reviewed By: quark-zju

Differential Revision: D19427595

fbshipit-source-id: 03cc639918b4e667927330d3f3abf16121ebf161
2020-01-20 02:45:14 -08:00
Jun Wu
124e275377 dag: make NameDag use MultiLog for data consistency
Summary: This ensures IdMap and IdDag are guaranteed consistent in the storage layer.

Reviewed By: DurhamG

Differential Revision: D19432658

fbshipit-source-id: 00f1a9b4c747baa1f14d78c31d925682317463b4
2020-01-17 21:49:57 -08:00
Jun Wu
907aadcdd7 indexedlog: add MultiLog
Summary: The MultiLog holds multiple Logs and can atomically sync them.

Reviewed By: DurhamG

Differential Revision: D19432659

fbshipit-source-id: 6ac7dc6f74468f985c6a6b0c419e888722a80037
2020-01-17 21:49:57 -08:00
Jun Wu
5aa872599c indexedlog: make ScopedDirLock remember which directory gets locked
Summary: This makes it possible to do extra sanity checks.

Reviewed By: DurhamG

Differential Revision: D19443783

fbshipit-source-id: 254c2537a6aadd25a67c5e48a768187ce65aa686
2020-01-17 21:49:56 -08:00
Jun Wu
2c9a3b9c61 indexedlog: use a method to create LogMetadata
Summary: This makes the code overall shorter.

Reviewed By: DurhamG

Differential Revision: D19443552

fbshipit-source-id: abd1db227830a88549c7eca1cfd08b67c4914518
2020-01-17 21:49:56 -08:00
Jun Wu
a78597c92d gitlookup: use nodemap index to speed up lookups
Summary:
Scanning through the plain git mapfile is slow. Use the nodemap to speed it up.
To avoid unnecessary risks, this only replace the "lookup" feature of the mapfile,
other features used by the hggit extension or wire-protocols are unaffected.

Reviewed By: singhsrb

Differential Revision: D19458406

fbshipit-source-id: 665184637d3e62590cc5d12ea3aa2563af4351d1
2020-01-17 19:21:40 -08:00
Wez Furlong
8d85b68d6b hg: fsmonitor: fix sockpath propagation from WATCHMAN_SOCK env
Summary:
This unbreaks the watchman/hg integration tests in a more
sustainable and holistic way than the workaround in D19415053.

The issue is that the explicit fsmonitor sockpath configuration option didn't
take into account that the environment needs to take precedence in order for
the appropriate watchman instance to be used by the set of processes in a given
process tree.  It is not feasible to have them all pass `--config` options to
mercurial because that would require teaching several layers about the
fsmonitor extension, and then later to update them as we evolve how mercurial
works.

Reviewed By: quark-zju

Differential Revision: D19415252

fbshipit-source-id: 5872d0462e466bfb5d70f809c3c433d92fb78567
2020-01-17 17:36:03 -08:00
Zeyi (Rice) Fan
1dcd227ccd eden: refresh union datapack store as well
Summary: This diff addresses the unreleased mapped pack files in the old datapack code.

Reviewed By: chadaustin

Differential Revision: D19399737

fbshipit-source-id: 86a6254a2939fd69e1ce2b25b8bfcb36b0deb16b
2020-01-17 15:00:01 -08:00
Zeyi (Rice) Fan
a431e64e4e eden: periodically refresh content store to give it chances to release mapped files
Summary:
As reported by JT, EdenFS may hold the file descriptor of mapped pack files too long even when it is deleted by external processes, thus taking more disk spaces.

This diff fixes this problem by making EdenFS periodically rescan the pack files.

Reviewed By: chadaustin

Differential Revision: D19395439

fbshipit-source-id: 4bfd6a7ac13dceb3099d2704d62b3825433aff4b
2020-01-17 15:00:01 -08:00
Wez Furlong
3eb293e32d hg: fixit quick! pywatchman client construction
Summary:
There was a typo in the name of the parameter; this commit
makes this code consistent with the upstream pywatchman code.

Reviewed By: fanzeyi

Differential Revision: D19453811

fbshipit-source-id: 033cf30c47ff327913a07e177457a4ac23505bbd
2020-01-17 14:11:48 -08:00
Genevieve Helsel
0d5145389d documentation for paths
Summary: this is largely just markdownified comments from `eden/fs/utils/PathFuncs.h`. I've been a bit confused on the differences lately and how they interact, so I read through that file and thought a markdown file would be helpful for future reference, since the file is reaching 2000 lines.

Reviewed By: fanzeyi

Differential Revision: D19434132

fbshipit-source-id: 0ec5551e9da0a3202fcc3efff52f9f6f48f99db4
2020-01-17 12:08:42 -08:00
Jun Wu
8f694e04a1 pull: update remote/master unconditionally
Summary:
This is inteneded to solve multiple problems:

- Mitigate issues where our CI system does not enable remotenames in some
  random code paths, which leads to missing or stale `remote/master`.
  This further mitigates bad cases with narrow-heads' phase calculation
  where a stale `remote/master` can cause many commits to become draft
  incorrectly.
- Mitigate issues in `remotenames` where race condition can happen for
  pushrebase (remotenames does a "listnames" after the push operation).
  See D18601035 for a hacky workaround.

Reviewed By: DurhamG

Differential Revision: D19380940

fbshipit-source-id: 4481ff114d35be37c331c72ac561c2a0894206cb
2020-01-17 10:13:40 -08:00
Jun Wu
755a238a5d osutil: remove usage of ApplicationServices
Summary:
We recently saw a high rate of build failures on MacOS.
They all fail with compiler errors like:

    In file included from edenscm/mercurial/cext/osutil.c:1326:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:23:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:39:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LaunchServices.h:23:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/IconsCore.h:23:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/OSServices.h:29:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/CoreServices.framework/Frameworks/OSServices.framework/Headers/CSIdentity.h:43:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/Security.framework/Headers/Security.h:38:
    In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/Security.framework/Headers/SecProtocolOptions.h:28:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/Security.framework/Headers/SecProtocolTypes.h:158:19: error: missing ',' between enumerators
        kTLSProtocol12 CF_ENUM_DEPRECATED(10_2, 10_15, 5_0, 13_0) = 8,
                      ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/Security.framework/Headers/SecProtocolTypes.h:158:20: error: redefinition of enumerator '__AVAILABILITY_INTERNAL__MAC_10_2_DEP__MAC_10_15'
        kTLSProtocol12 CF_ENUM_DEPRECATED(10_2, 10_15, 5_0, 13_0) = 8,
                   ^

It's unclear whether this is a compiler configuration issue, or the Apple SDK
being buggy.

The only user of ApplicationServices is `isgui()` when `$SSH_CONNECTION` is not
set on MacOS.

It seems to me that if we just replace `isgui()` to `True`, very few if nobody
will notice the difference. Therefore let's remove the problematic
ApplicationServices as an attempt to stabilize the build.

FWIW Git does not seem to have any sort of GUI detection. It seems to solely
rely on (static) user configuration.

This reverts part of https://www.mercurial-scm.org/repo/hg/rev/16118b4859a1.

Reviewed By: singhsrb

Differential Revision: D19441351

fbshipit-source-id: f1bfbaf0d015e8d577a83112b5ea0a4be6367156
2020-01-17 07:25:37 -08:00
Pádraig Brady
c8df1542f4 platform009: EdenMount.cpp: fix -Wreturn-std-move with clang-9
Summary:
stderr: eden/fs/inodes/EdenMount.cpp:1122:37:
  error: local variable 'unmountError' will be copied despite being thrown by name [-Werror,-Wreturn-std-move]
  eden/fs/inodes/EdenMount.cpp:1122:37: note: call 'std::move' explicitly to avoid copying

Reviewed By: simpkins

Differential Revision: D19408659

fbshipit-source-id: 1575104414daaeb06892586492cdb74e2df604c5
2020-01-17 04:58:15 -08:00
Jun Wu
4a98b00205 changelog: still migrate non-public commits to zstore
Summary:
This makes it safer to do revlog-fallback -> server-fallback switch in the
future, because the server might not know all the draft commits.

Reviewed By: DurhamG

Differential Revision: D19416287

fbshipit-source-id: 8d69c1c5465b50710110370d84d5fb7c8ba6a6c4
2020-01-17 04:01:05 -08:00
Jun Wu
733961456f indexedlog: fix try_clone external key buffer handling
Summary:
In both cases (clone with or without dirty content), the external key buffers
used by indexes should be re-created, since mem_buf location has changed.

Reviewed By: DurhamG

Differential Revision: D19432657

fbshipit-source-id: fe6f76e7ccfd16ccd2f5c1d89866687a3503603e
2020-01-17 03:58:00 -08:00
Jun Wu
85d7253edd indexedlog: add "shared metadata" abstraction
Summary: This allows us to build the multi-log structure.

Reviewed By: DurhamG

Differential Revision: D19431786

fbshipit-source-id: e0e09b0d5a73d293a80626924b74ddf2ce6d6fa3
2020-01-17 03:57:59 -08:00
Jun Wu
36e70264b6 indexedlog: avoid log::OpenOptions::create_in_memory
Summary: Migrate to the new API. This is more compatible with the next change.

Reviewed By: DurhamG

Differential Revision: D19431788

fbshipit-source-id: dba1a88fd003d17fc1774b0cec9157d32c5acdb0
2020-01-17 03:57:59 -08:00
Jun Wu
de5772cb30 indexedlog: replace Log's dir with a new GenericPath type
Summary:
This allows us to incrementally abstract away parts related to filesystem from
Log. For example, instead of using std::fs to access filesystem directly, use
methods on the GenericPath instead.

Right now the main motivation is to add support for "multi-logs" sharing a single meta
file. To do that, methods reading and writing metas are moved to the
GenericPath type.

This also unifies the open functions. Now OpenOptions::create_in_memory can be
private. Empty in-memory Logs can be opened via `open(())`.

Reviewed By: DurhamG

Differential Revision: D19431784

fbshipit-source-id: dbdf94f60261e09f131c6fdd9fe3b99242a28af5
2020-01-17 03:57:59 -08:00
Jun Wu
bf133b797e indexedlog: expose io::ErrorKind in the wrapped error type
Summary: This makes an upcoming change easier.

Reviewed By: DurhamG

Differential Revision: D19432656

fbshipit-source-id: 65adc883c3c3937aa7022196b83c75715b820721
2020-01-17 03:57:58 -08:00
Jun Wu
24393faaeb indexedlog: move log::tests to a separate file
Summary: The goal is to split log.rs to smaller modules so it's easier to reason about.

Reviewed By: DurhamG

Differential Revision: D19431787

fbshipit-source-id: 23b8346c461da322e7a2240b8224e6194867aaee
2020-01-17 03:57:58 -08:00
Jun Wu
38db4b5cdc indexedlog: move log::OpenOptions to standalone modules
Summary:
The goal is to split log.rs to smaller modules so it's easier to reason about.

OpenOptions has many dependencies. Move the most complicated one (repair) to
another standalone module.

Reviewed By: DurhamG

Differential Revision: D19431783

fbshipit-source-id: 28c3af7cd6e19588bfe9c395e2648244faf3179d
2020-01-17 03:57:58 -08:00
Jun Wu
f6d3fd3d39 indexedlog: move log::LogMetaData to a standalone module
Summary: The goal is to split log.rs to smaller modules so it's easier to reason about.

Reviewed By: DurhamG

Differential Revision: D19431785

fbshipit-source-id: b9a598b3018267ff6e43ef57dc807cb4e880467c
2020-01-17 03:57:57 -08:00
Genevieve Helsel
53fcbd2d64 edge case on gitignore processing with directory replaced with file
Summary: based on comment on D18647089, changes the behavior when a directory is replaced with a file, and then the directory is ignored. The behavior should be that the file is reported as `ADDED`, previously the file would have been reported as `IGNORED`

Reviewed By: simpkins

Differential Revision: D19318796

fbshipit-source-id: 8da1b7c6df182ca591e4aea21f6573ca81790cb4
2020-01-17 00:05:26 -08:00
Zeyi (Rice) Fan
59c2cb7aff eden: make HgImporter safer
Summary:
We want to have a shared pool of `HgImporter` across different threads, but that would require `HgImporter` is safe to be *passed* between threads. (This is not making `HgImporter` entirely thread safe.)

However, `HgImporter` currently holds a pointer to the thread local fb303 counter. This diff pushes down `EdenStats` so we only access the thread local stats variable when we need to add counters. This might be a little slower but it does make it safer.

Reviewed By: chadaustin

Differential Revision: D19053250

fbshipit-source-id: 44a897acc90c6042ae22a0417eece39e099ee13f
2020-01-16 12:45:37 -08:00
Zeyi (Rice) Fan
bd7b3a38c8 eden: decouple LocalStore from HgImporter
Summary: The only reason `HgImporter` still holds a pointer to LocalStore is for looking up proxy hashes. We can directly pass in the Mercurial hash and path instead.

Reviewed By: chadaustin

Differential Revision: D19049039

fbshipit-source-id: 45d1e1f363ed73dca447b22e5891495cf9ad202b
2020-01-16 12:45:36 -08:00
Genevieve Helsel
283c6de0df log mismatched parents during staus
Summary: scuba logging for mismatched parent commits, it would be nice to have a count on how often this is encountered so we can pinpoint spikes of this case. I am not sure how helpful having the parent commits would be in the event, my thought there was that it could help see how far away the commits are and if one of the commtis doesn't exist (like in the case of stripping commtis with a cancelled hg split), but I am open to having an empty event as well if storing these strings is too expensive.

Reviewed By: fanzeyi

Differential Revision: D19432378

fbshipit-source-id: fa3e7cd6aef832c4f918f339b781590b7484cfdc
2020-01-16 12:01:11 -08:00
Thomas Orozco
341e695ac5 hggit: don't crash in updatemeta if a commit does not have extras at all
Summary:
Right now, we check if extras contain `convert_revision` (and tolerate it not
being there), but if we don't have extras at all, we crash. Let's instead treat
"no extras" and "convert_revision not in extras" as the same thing.

Reviewed By: DurhamG, farnz

Differential Revision: D19428698

fbshipit-source-id: 74268dd3bde0f9cdb1b8164d2c2d322837803eaa
2020-01-16 10:13:12 -08:00
Xavier Deguillard
d88b2fed9b remotefilelog: properly support force prefetch
Summary:
There are few cases where we need to prefetch data that is already present in
the local store, but the server holds more up-to-date data. For instance, after
pushing a change to a pushrebase server, the linkrev for the just pushed commit
is no longer valid, and the history data is re-fetched from the server to fix
it.

For now, let's keep the fix for this contained in Python as we will move away
from linkrev altogether in the future, by then, this change will be unecessary
and can be reverted.

I'm overall not a big fan of the hacks needed here, suggestions are welcomed for
a cleaner way to achieve this :)

Reviewed By: DurhamG

Differential Revision: D19412620

fbshipit-source-id: 331f3e4dbb51bcd687149370a62c60c325534f60
2020-01-16 09:41:41 -08:00
Xavier Deguillard
1e809fc681 revisionstore: allow building a {Content,Metadata}Store without local stores
Summary:
In order to avoid pathological linkrevfixup after pushing a change to a
pushrebase repo, we need to be able to fetch history data that is already
present locally from the server. Since the Rust stores will always check
whether the data is present locally before fetching it, we would not be
fetching anything, causing the pathological linkrevfixup to kick in.

By allowing the stores to be built without a local component, the prefetch
function will not find the local history, and will thus be able to fetch it
properly.

Reviewed By: DurhamG

Differential Revision: D19412619

fbshipit-source-id: 421c59c63634ead7f98e6ba89da0532067f7b412
2020-01-16 09:41:40 -08:00
Xavier Deguillard
d89eab8078 pyconfigparser: use String as arguments instead of PyBytes
Summary:
In the cpython bindings, the Rust String can take both PyBytes and PyUnicode
strings, which is perfect for Python3 compatibility as string literals are
PyBytes in Python2 and PyUnicode in Python3. The return values are kept as
Bytes for now as changing this is a much larger change in itself.

Other approaches tried:
 - Using PyUnicode as input/output: an extremely large codemod had to be done,
   with very little benefits
 - Using String as output: since we do have some configs that are unicode, on
   the Python side, the output might either be bytestrings or unicode, leading
   to weird bugs.

Reviewed By: DurhamG

Differential Revision: D18650466

fbshipit-source-id: aebdf30590dcae40b7df2787e5ece88e2ec9395c
2020-01-16 09:31:45 -08:00
Mark Thomas
2815d67f41 mutation: update amend tests to use mutation and visibility
Summary:
Update all amend tests to use mutation and visibility.  For these tests, `mutation.record`
is disabled so that hashes do not change.

Most tests pass as-is.  A few tests have changes which are the results of slight behavioural
changes or bug-fixes compared with obsmarkers.

Reviewed By: quark-zju

Differential Revision: D19413580

fbshipit-source-id: 18696a08db69130b08f829366659783df4c9bcc1
2020-01-16 01:03:23 -08:00
Mark Thomas
05f1ef73b2 obsolete: add option for disabling evolution
Summary:
Allow disabling of evolution and obsolescence markers by setting
`experiemental.evolution=obsolete`.

Reviewed By: quark-zju

Differential Revision: D19411232

fbshipit-source-id: 89601a93cff1f87d04b7230fcb6c1e91cf074e92
2020-01-16 01:03:23 -08:00
Mark Thomas
eef0c650e7 mutation: make the mutationstore the source of truth for mutation entries
Summary:
Previously the mutation commit extras were the source of truth for mutation
information, and the mutation store served as a kind of cache.  This turned out
to be less useful than expected, as oftentimes commits are missing, and the
store is better indexed, so in practice using the store as the source of truth
is better.

This change makes the mutationstore the (sole) source of truth for mutation
data.  The extras are kept, but they are now only useful as human-readable
debug information, and to ensure the commit hash is unique.

Collecting the mutation information during commit creation is now done through
a new `mutinfo` object.  This is a dict with the same keys as the mutation
extras, for simplicity, but it is now passed through the `committablectx` and
used to generate the mutation store entry directly.

The `mutation.enabled` config option is now used to control all aspects of
enabling mutation.

The `mutation.record` config option is now only used to indicate whether the
mutation extras should also added to the commit.  Generally this should be set
to `true`, however the option is retained so that mutation extras can be
stripped by running `hg amend --config mutation.record=false`, which no longer
has the side-effect of not recording mutation information to the store.

The "remote commit" mutation record origin is now obsolete, and won't be
generated anymore.

Pushrebase now relies on the obsmarker information coming back from the server
in order to correctly generate mutation information.  We will need to change
this so that the server returns mutation records before we can fully deprecate
obsmarkers.

Reviewed By: DurhamG

Differential Revision: D19410650

fbshipit-source-id: 8d7094e4bfd8d8e97916898d899a8debd339485f
2020-01-16 01:03:22 -08:00
Josh Rosenbaum
6bf2ce6f9b log common directory path of all files in the changeset
Summary: Begin logging the common directory path for the commit's updated files.

Reviewed By: DurhamG

Differential Revision: D19399717

fbshipit-source-id: d47994f573eac6e7cd1596b0b102cb9577e1eea1
2020-01-15 19:06:17 -08:00
Michael Devine
8e61b4445d Repo converter: Remove "[MERGED]" prefix from commit messages
Summary: When I was first prototyping the converter, I used a prefix to make it clear which commits represented merged commit history. This commit removes that prefix so the commit messages are an exact match.

Reviewed By: tchebb

Differential Revision: D19404075

fbshipit-source-id: 73b4aab39b30ce1dcff917e40d459f9615896fca
2020-01-15 16:01:19 -08:00
Xavier Deguillard
03b6607779 remotefilelog: only prefetch history in linkrevfixup
Summary:
The linknode is part of the history, not the data, no need to force prefetch
the blobs.

Reviewed By: quark-zju

Differential Revision: D19394351

fbshipit-source-id: 2e63d82928ebd5cf8e3a0d1b87d115b45d1428a7
2020-01-15 15:55:11 -08:00
Xavier Deguillard
c92c9d5a03 revisionstore: add some comment explaining the order of local/shared store
Summary:
Mercurial assumes some specific ordering, let's comment about this to make sure
we don't re-order and introduce subtle bugs.

Reviewed By: quark-zju

Differential Revision: D19394352

fbshipit-source-id: 0f9e02d2c6addf040311a54b8161b06bbeaa6be9
2020-01-15 15:55:11 -08:00
Xavier Deguillard
3030ad82b0 remotefilelog: fix remotefilelog.cachepath difference for Rust ContentStore
Summary:
The error message and the exception type are slightly different between the
Rust and Python ContentStore. For now, let's just fix this up manually.

Reviewed By: quark-zju

Differential Revision: D19394350

fbshipit-source-id: e432094a9dfcf605568a1890c0303b733e98d203
2020-01-15 15:55:10 -08:00
Genevieve Helsel
a7d3210d2e normalize hg status error between python and rust
Summary: The rust telemetry wrapper and the python code were not in sync in how they presented errors to the user on failure. This makes them identical in message and error code (however the "abort" from python is red in color).

Reviewed By: quark-zju

Differential Revision: D19313848

fbshipit-source-id: d5b95e8d5130f20fc85c6664933ee18702f7cc5e
2020-01-15 15:30:52 -08:00
Xavier Deguillard
d784f6890c test-ssh.t: make it less flaky
Summary: This eliminates the broken pipes that have been more prevalent recently.

Reviewed By: DurhamG

Differential Revision: D19412153

fbshipit-source-id: 0062eb57ec07dfcbfee3ed9b77cf82cdcda09fb3
2020-01-15 14:05:06 -08:00
Jun Wu
94c383327a dag: make NameDag support buffered changes
Summary:
Previously, NameDag only supports writing directly to disk. That is not easy
for hg to use, since hg knows commits before bookmark names during pull, while
the API requires both commits and bookmarks (to decide which commits belong to
the "master" group) at the same time.

The old API also does not match other storage layers like indexedlog and
metalog, where writes are buffered until explicitly flushed.

This diff adds the "write-in-memory" (named "add_heads"), and "flush" APIs to
make NameDag easier to use. Under the hood, it just copies the "added" portion
of the DAG, and re-use the old API ("build", renamed to "add_heads_and_flush")
to do the job.

Note: The buffered changes pattern cannot be used in IdDag, since Ids might
have to be re-assigned on flush. But NameDag does not expose the raw Ids in its
"normal" interface, so it's fine to reassign Ids on flush.

Reviewed By: markbt

Differential Revision: D19405474

fbshipit-source-id: 75e5e5815c78c3577a0138f48185f6c4b5a80891
2020-01-15 14:02:07 -08:00
Jun Wu
3a74b82a39 dag: rename NamedDag to NameDag
Summary:
This is more consistent with the name "IdDag", because both "Name" and "Id" are
noun.

Reviewed By: singhsrb

Differential Revision: D19405473

fbshipit-source-id: a3b7546dd0ddcae5d9ed562838bd6be10a47063c
2020-01-15 14:02:06 -08:00
Jun Wu
3c5766d59e dag: rename Dag to IdDag
Summary: This is more consistent with the name "NamedDag".

Reviewed By: singhsrb

Differential Revision: D19405472

fbshipit-source-id: f7023307acaf96bf77c9fa9704dcaf6fc59b56f2
2020-01-15 14:02:06 -08:00
Joseph Friesen
1b504b8c93 add TCP support to fsmonitor
Summary:
This is part of proof-of-concept to test Watchman over TCP, a means
to accelerate hg workflows for the ASIC teams within Facebook.

For more context, refer to master task T55191832

Reviewed By: xavierd

Differential Revision: D18482107

fbshipit-source-id: 08ba3641854d81fe2a1cd8739bb4e9abcbc700ed
2020-01-15 13:43:36 -08:00
Joseph Friesen
aebbe4937f Propagate SockPath + TcpSocketTransport changes to hg
Summary: Copied changes from watchman dev area to hg

Reviewed By: wez

Differential Revision: D18574426

fbshipit-source-id: 6c360e42621cef373c5c1d4af34011d80eafc7bf
2020-01-15 13:43:36 -08:00
Wez Furlong
f6a9a6f7e8 eden: du: revise instructions for cleaning up LFS
Summary: `hg gc` can now clean things up there, so suggest that.

Reviewed By: quark-zju, fugalh

Differential Revision: D19413816

fbshipit-source-id: 1c6c08ed9fb4757390883d908531d9b3a7da302d
2020-01-15 12:31:56 -08:00
Jun Wu
85a89c6f96 dag: add git commit graph as test fixture
Summary:
The git repo has a lot of merges. So it's interesting as a testing graph.
The file was generated by:

    git clone https://github.com/git/git --bare
    hg --config extensions.hggit= clone git.git git-hg
    hg --cwd git-hg debugbindag -r 'all()' -o git.bindag

Reviewed By: DurhamG

Differential Revision: D19411825

fbshipit-source-id: 0fec8a16786dc8e6790986bca5c62a76276aa942
2020-01-15 11:03:52 -08:00
Mark Thomas
56cd3eadb5 renderdag: connect vertical lines for non-merge commits
Summary:
This changes the pattern commonly seen in smartlog:

    ╷ o  e7f5f529  ...
    ╭─╯
    │ o  a1b2773d ...
    ╭─╯
    o  ecbb4eaa
    ╷

to:

    ╷ o  e7f5f529  ...
    ├─╯
    │ o  a1b2773da ...
    ├─╯
    o  ecbb4eaa
    ╷

The change only applies to commits with a single parent. Vertical lines from
merge commits stay disconnected intentionally. For example:

    │ │ o  I
    │ │ │
    │ o │      H
    ╭─┼─┬─┬─╮
    │ │ │ │ o  G
    │ │ │ │ │

This makes it more obvious that `H` has 5 parents while `I` only has 1 parent -
`I` does not "borrow" `H`'s parents.  This problem does not exist if `H` only
has 1 parent.

Reviewed By: quark-zju

Differential Revision: D19407687

fbshipit-source-id: 1046c8e2309f50e3f1620ed21f1b10573759a5f8
2020-01-15 06:57:51 -08:00
Jun Wu
dd1b9cc98d pull: use transaction
Summary:
Without this change, the next diff will fail tests with metalog programming
errors (write outside transaction).

Some test changes are caused by the being deprecated `rollback` command.

Reviewed By: DurhamG

Differential Revision: D19380939

fbshipit-source-id: 7c893d3025bb697102835670b8a38f8fb9a624c8
2020-01-14 21:02:27 -08:00
Jun Wu
ba2d83b3f8 pull: remove "new changesets" message
Summary:
Reverts https://www.mercurial-scm.org/repo/hg/rev/eb586ed5d8ce.

The colon syntax (x:y) is deprecated and is unsupported by segmented changelog.

Reviewed By: DurhamG

Differential Revision: D19394101

fbshipit-source-id: 8c66756f1035ab7660180716a2afa052879f384e
2020-01-14 21:02:27 -08:00
Durham Goode
4c5aa36827 gpg: wrap dirstate in transaction
Summary:
As part of requiring transactions for the dirstate, let's wrap its use
in gpg.

Reviewed By: quark-zju

Differential Revision: D18213029

fbshipit-source-id: b05afa6d465e8d2a7b1637fa1c1903e1625a7104
2020-01-14 17:49:05 -08:00
Durham Goode
b52d325ebc histedit: add dirstate transactions
Summary:
As part of making the dirstate require transactions, let's wrap
histedits dirstate changes in transactions.

Reviewed By: quark-zju

Differential Revision: D18213045

fbshipit-source-id: 49baf87e8f8abfe500409f0f79a52eeae09f8ada
2020-01-14 17:49:05 -08:00
Durham Goode
419368da12 eol: wrap dirstate in transaction
Summary:
As part of requiring transactions for the dirstate, let's wrap eol's
manipulation of it.

Reviewed By: quark-zju

Differential Revision: D18213039

fbshipit-source-id: 28b52057e61fe9d88ce9f26be2cbf7482837ba84
2020-01-14 17:49:04 -08:00
Durham Goode
cd3d20e4e3 commitcloud: wrap update in transaction
Summary:
As part of moving the dirstate to require a transaction, let's wrap the
update in commitcloud.

Reviewed By: quark-zju

Differential Revision: D18213046

fbshipit-source-id: e59c880ea5e8d8808499f94c983c26e7466204e2
2020-01-14 17:49:04 -08:00
Durham Goode
b3d7defa23 automv: wrap dirstate in transaction
Summary:
As part of requiring the dirstate to be part of a transaction, let's
wrap its usage in automv.

Reviewed By: quark-zju

Differential Revision: D18213034

fbshipit-source-id: f8557453351e665ac59da9614c84ab6312cff4ef
2020-01-14 17:49:04 -08:00
Durham Goode
61b0ca78e8 fbamend: wrap dirstate in transaction
Summary:
As part of moving the dirstate to always be part of a transaction,
let's wrap its usage in our amend extension.

Reviewed By: quark-zju

Differential Revision: D18213028

fbshipit-source-id: 3562bb589265dceb3d89c997710738f44eb49f33
2020-01-14 17:49:03 -08:00
Durham Goode
b2cc1a40f3 contrib: update perf.py to wrap dirstate in a transaction
Summary:
As part of making the dirstate always participate in the transaction,
let's wrap it's use in perf.py.

Reviewed By: quark-zju

Differential Revision: D18213036

fbshipit-source-id: cd4a7d942556f032d32cbe0630d16414b819ea34
2020-01-14 17:49:03 -08:00
Durham Goode
b2d16b60c1 dirstate: move transaction write code to its own function
Summary:
A future diff will move all dirstate writes to be in a transaction.
Let's start by moving the transaction write logic to it's own function. A future
diff will delete the non-transaction "write" function.

Reviewed By: markbt

Differential Revision: D18213554

fbshipit-source-id: 7fa414314583a64ccada0f8be287d6064024e020
2020-01-14 17:49:03 -08:00
Durham Goode
d663a9dbdf fsmonitor: move warnings into filesystem layer
Summary:
Now that the post dirstate handlers are largely unused, let's move the
fsmonitor state warning into the fsmonitor filesystem. This also allows us to
remove the temporary _newid variable that was used to allow post-transaction
detection of if the transaction happened.

Reviewed By: quark-zju

Differential Revision: D18259479

fbshipit-source-id: da88638d34a80480bbeba8b1531d523785d72c30
2020-01-14 17:49:02 -08:00
Durham Goode
bca361cd3c dirstate: remove most of post dirstate handlers
Summary:
Previously the localrepo object contained a list of handlers to invoke
after status finished executing. This was used for 1) updating the fsmonitor
state with the new clock, ignore hash, and list of notable files, and 2)
updating the list of ignored files in treestate.

As part of moving all fsmonitor subtlities behind the filesystem abstraction,
this diff moves the fsmonitorstate file updating to be in the filesystem layer.
This also moves it inside the same transaction as the lookup file cleanup, which
removes the need for the hacky self._newid logic to detect if the dirstate was
changed by an external process.

(self._newid was previously added so that our second dirstate transaction, which
updates the fsmonitorstate, could determine if the dirstate had either been
changed by this process earlier in the lookup cleanup transaction, or if it had
been changed by an external process).

Reviewed By: quark-zju

Differential Revision: D18076655

fbshipit-source-id: c5175f61432f8e121b6baacd9587fcd288f67098
2020-01-14 17:49:02 -08:00
Durham Goode
af3292ea85 filesystem: refactor lookup marking to be more extensible
Summary:
A future diff is going to move the fsmonitor post-status fixups into
the same transaction as the lookup-marking logic. To prepare for this, let's
refactor the lookup marking logic to separate out the transaciton management
from the actual marking logic.

Reviewed By: quark-zju

Differential Revision: D18076656

fbshipit-source-id: 7711d5b086be7baaff0d9736cf51c6b0a46f237e
2020-01-14 17:49:01 -08:00
Durham Goode
a064e12d93 dirstate: move lookup resolution into the filesystem
Summary:
In an earlier diff we moved the lookup-state resolution from the repo
object to the dirstate object. Now that a filesystem layer exists, let's move
lookup resolution into the filesystem layer so that filesystem.pendingchanges
can now return perfect information.

Reviewed By: quark-zju

Differential Revision: D17749373

fbshipit-source-id: d03177e5e5374bd38c6c9adaa0fe8959052de19e
2020-01-14 17:49:01 -08:00
Xavier Deguillard
b1f3e37e43 tests: the Rust ContentStore always creates .hg/store/packs
Summary:
The Python one only does it when needed, let's fix the 2 tests that were
relying on this.

Reviewed By: quark-zju

Differential Revision: D19393501

fbshipit-source-id: 94e004999045264adce2ffa17b4697583ee0fcbd
2020-01-14 13:46:26 -08:00
Xavier Deguillard
f1c8af3297 remotefilelog: test for phase instead of localcontentstore
Summary:
The phases of a commit is a more precise metric for whether a change is public
or not, let's use this instead of testing for data to be present in the local
contentstore.

Reviewed By: quark-zju

Differential Revision: D19393502

fbshipit-source-id: b1c735c8400e8d5a1a7f7013d9a4a1ad423c5023
2020-01-14 13:46:26 -08:00
Stefan Filip
eca4fbc75d tests: increase timeout for mononoke starting
Summary:
We started to see a lot of tests failing with mononoke timing out at startup.
Increasing the timeout to mitigate the issue.

Reviewed By: krallin

Differential Revision: D19397440

fbshipit-source-id: a8037102b3c8389b98a7c49824fa013fd3e6a080
2020-01-14 12:52:05 -08:00
Stefan Filip
a2ca6bb7dd manifest-tree: move private test function to lib.rs
Summary:
Moving `store_element` and `get_hgid` from testutil.rs to lib.rs in order to
get rid of some buck build warnings. They are only used in lib.rs.

Reviewed By: markbt

Differential Revision: D19350343

fbshipit-source-id: 081783d753425daaae6fadc38589da5e4e8b745d
2020-01-14 11:49:53 -08:00
Stefan Filip
2c9fa6054d manifest: update make_tree to be public
Summary:
It makes sense for manifest-tree to expose a testutil version for building a
TreeManifest. No reason for the testutil function to be limited to the crate.
The only issue is that `make_tree` is to generic so we rename the function to
`make_tree_manifest`.

Reviewed By: markbt

Differential Revision: D19350351

fbshipit-source-id: 06fe04d99bf820d3e81417f5a5514aa4b0d282e6
2020-01-14 11:49:53 -08:00
Stefan Filip
887b776fe1 manifest: add testutil in core package
Summary:
Types that are defined by the manifest core crate should have test utilities
defined in the same crate.

This is motivated by various warning in the buck build.

Reviewed By: markbt

Differential Revision: D19350350

fbshipit-source-id: a6a7c3fb54b465aa09a28ff8b70b49a355b328fc
2020-01-14 11:49:52 -08:00
Jun Wu
1be7e2ea4c hgmain: explicitly flush IO on exit
Summary: Without this, `hg status --print0` can output nothing and break tests.

Reviewed By: xavierd

Differential Revision: D19387317

fbshipit-source-id: 4feb82889df9bd1705526027f491db90a2a5f946
2020-01-14 09:42:48 -08:00
Jun Wu
684351a6a9 edenfs-client: fix warnings
Summary:
Fix warnings about unused imports, and fix Cargo.toml to use well-defined
versions.

Reviewed By: singhsrb

Differential Revision: D19386232

fbshipit-source-id: 4eb7478dfb4f34e8338d5090b3ba7225bfcb008f
2020-01-13 18:14:46 -08:00
Jun Wu
2ade5663b1 mq: remove references about mq
Summary: `mq` was removed. Remove remaining references to it.

Reviewed By: singhsrb

Differential Revision: D19382027

fbshipit-source-id: d194556b63dd6b9a44b949bd24b7e1a7356d5c04
2020-01-13 17:39:43 -08:00
Puneet Kaushik
b01d4a721d Implemented check file name functionality to workaround a Projected FS issue.
Summary:
There is a bug in Projected FS on Windows 1903 and 1909, which BSODs the system on SetInformation call. Projected FS seems to be dereferencing a nullptr while attempting to check if the file is in the backing store. Providing a separate callback to check if the file exists in the backing store will avoid the buggy code (suggested by Microsoft).

This will enable Eden FS on Windows 1903 and 1909.

Reviewed By: simpkins

Differential Revision: D19377522

fbshipit-source-id: ab5e9bc8e2472f3e689d71d05a560bac86211295
2020-01-13 16:15:09 -08:00
Puneet Kaushik
8899c53892 Update Windows EdenMount::getRootTree return a future
Summary: This is a followup on D18666585.

Reviewed By: chadaustin

Differential Revision: D19377523

fbshipit-source-id: f9ab4011d0978a6934de77d1837a37082603cf52
2020-01-13 16:15:09 -08:00
Puneet Kaushik
1350e4f8ce Fixing ObjectStore::create signature in Windows TestMount
Summary: We missed updating this in D18669664.

Reviewed By: simpkins

Differential Revision: D19377524

fbshipit-source-id: e23fb039047855454b4f12353bc375b1a2c8d962
2020-01-13 16:15:08 -08:00
Xavier Deguillard
0be67e6b08 osutil: export O_CLOEXEC
Summary: This is needed in Python3, export it.

Reviewed By: quark-zju

Differential Revision: D19379402

fbshipit-source-id: e5d095005f20c8a940b31e0296293aa8a85c4e98
2020-01-13 16:15:08 -08:00
Durham Goode
1c573e7569 workingcopy: add error handling and reporting to rust walker
Summary:
Previously, if the rust walker encountered any issues with individual
files it would stop and throw an exception or in some cases panic. To replace
the python walker we need to handle errors more gracefully, so let's add logic
for reporting which files had issues and what those issues were.

This also contains a minor one-line fix to prevent the walker from traversing
directories that contain a '.hg' directory.

Reviewed By: quark-zju

Differential Revision: D19376540

fbshipit-source-id: ede40f2b31aa1e856c564dd9956b9f593f21cf27
2020-01-13 15:26:30 -08:00
Jun Wu
aa64745a35 debugmetalog: add a command to show repo history
Summary:
The command shows how visibility, bookmarks, remotenames change in the repo
over time, using metalog data.

Also add this command to hg rage report.

Reviewed By: markbt

Differential Revision: D19358668

fbshipit-source-id: 9bddc039143b45c29c0c937ee60906ab93a2defe
2020-01-13 14:29:07 -08:00
Jun Wu
cfcf538578 color: define changeset.{public,draft} colors
Summary: The colors are from the our smartlog template. They're used in the next change.

Reviewed By: markbt

Differential Revision: D19358670

fbshipit-source-id: 7476f95767c5fcf1cccdce2119a2ab7ce45d270e
2020-01-13 14:29:06 -08:00
Jun Wu
3895af590a edenfs-client: use clidispatch IO and Error types
Summary:
This simplifies the error handling and makes it more compatible with things that
might capture the output, including the Python testing framework.

Reviewed By: DurhamG

Differential Revision: D19325642

fbshipit-source-id: 53de8b9a8294219e2b8e62831dce236841bd4cbb
2020-01-13 14:23:34 -08:00
Jun Wu
12eaf82291 hgcommands: add edenfs status fast path
Summary: Make `hg status` use the EdenFS Thrift path, similar to the telemetry wrapper.

Reviewed By: DurhamG

Differential Revision: D19325641

fbshipit-source-id: 14777a252d7cb433316511a2a1f1a6649e9cb020
2020-01-13 14:23:34 -08:00
Jun Wu
b9e7f6a995 cliparser: support shared flag definition
Summary:
Make it possible to define reusable flags like walkopts, templateopts that can
be shared among commands.

Reviewed By: DurhamG

Differential Revision: D19325640

fbshipit-source-id: 89a9ad0e59672b1f8cfa22daaacd3c75d8cff61a
2020-01-13 14:23:33 -08:00
Jun Wu
7e9aaf9da5 lib: add edenfs-client
Summary:
Add a crate aiming for talking to EdenFS via Thrift.

This is mostly ported from telemetry. There are lots of things that can be
cleaned up like moving the command portion to hgcommands, or using a better
abstracted rendering layer for outputting, etc. But for now, I just ported
the code as-is.

Reviewed By: DurhamG

Differential Revision: D19325639

fbshipit-source-id: ac70315ed166024857a90aab070e4d521f3e3b58
2020-01-13 14:23:33 -08:00
Jun Wu
b907d121db thrift-types: add a crate exposing EdenFS thrift interface
Summary:
The main motivation is to replace (super slow) Python Thrift serialization.
It also makes it possible to port the native "status" command from telemetry
wrapper to the main executable.

The crate is made to be built with either buck or cargo in fbcode environment:
- Cargo build uses `build.rs` to re-generate (checked-in) Thrift code.
- Buck build uses TARGETS to build Thrift code on the fly.

Reviewed By: DurhamG

Differential Revision: D19325638

fbshipit-source-id: 1d3287d8d6c674065500929827fa13ba9d448708
2020-01-13 14:23:32 -08:00
Durham Goode
e959466b51 automigrate: don't call automigrate if lock is held
Summary:
We don't want automigration to block normal execution of the command,
so let's take the lock with a short timeout, then skip automigration if we don't
get it.

This should solve an issue where debugedenimporthelpers were hanging because
they tried to take a lock that a hg process that was accessing eden held.

Reviewed By: quark-zju

Differential Revision: D19375544

fbshipit-source-id: 6c107aac87b5b839cc2d347a3b40ce67da627b71
2020-01-13 13:52:18 -08:00
Xavier Deguillard
8c1ef64565 sshpeer: read stderr in a background thread
Summary:
On Windows, select cannot be used for pipes, and thus the doublepipe class
would end up busy spinning trying to read from it. Since stderr is almost
always empty let's move it to a background thread so the main code path
doesn't have to deal with it.

This proves to be a significant win for `hg pull`. For an empty manifest
cache, `hg pull` used to take ~5 minutes, it's now around 1 minute, with
Mononoke taking 40 seconds out of that.

Reviewed By: DurhamG

Differential Revision: D19352144

fbshipit-source-id: 77112c1c18d7dab15f6946a645f73e89908802f2
2020-01-13 12:55:18 -08:00
Mark Thomas
d06144e957 renderdag: test width correctly matches rendered width
Summary:
Enhance the tests to test whether the width of the graph matches the width that
was given by the `width` method before `next_row` was called.

The width we are interested in is the number of cells the string would occupy,
not the string length, so use the `unicode-width` crate to determine this.

Reviewed By: quark-zju

Differential Revision: D19282571

fbshipit-source-id: d9852c4c9e0f76c78db047f0da5dd34723a62a2a
2020-01-13 10:22:43 -08:00
Mark Thomas
aae60162eb renderdag: switch to . for ancestor lines
Summary: Switch from `:` to `.` for the ancestor lines.  I think they look better.

Reviewed By: quark-zju

Differential Revision: D19371721

fbshipit-source-id: e18f1a62e23620a82007e2c377607a0a61623830
2020-01-13 10:22:43 -08:00
Mark Thomas
4683a72a77 cmdutil: convert to local encoding when drawing rust graph
Summary:
Use `encoding.unitolocal` to convert the Rust-generated unicode strings to the
local encoding.

Reviewed By: quark-zju

Differential Revision: D19371723

fbshipit-source-id: 6b37ef51f37f2212ca2d9ab20f9ed4da29b3d63c
2020-01-13 10:22:42 -08:00
Mark Thomas
f395961e33 renderdag: add additional glyph sets for box-drawing
Summary:
Box-drawing characters with curves aren't reliably renderable on Windows.  Add
a "square" glyph set that uses right-angle characters.  These characters are
available in cp437 and cp850, so should be available on most Windows systems.

For completeness, add a "dec" glyph set that uses DEC line drawing characters,
for use in old terminals like xterm.

Reviewed By: quark-zju

Differential Revision: D19371722

fbshipit-source-id: 35887243cceab66c702e2b5278b572f77946805f
2020-01-13 10:22:42 -08:00
Jun Wu
9f02e24674 run-tests: turn on format.use-zstore-commit-data
Summary:
This applies the new feature to all tests.

The tests do not use revlog fallback but we plan to use revlog fallback
in production for faster migration.

Reviewed By: DurhamG

Differential Revision: D18737259

fbshipit-source-id: 69633c7b2026fb3d19ca16d40368bded972efd86
2020-01-13 10:06:10 -08:00
Jun Wu
138ad4961f setup: include pdb and py files on Windows package
Summary: Add hg.pdb and pure Python source code on Windows for easier debugging.

Reviewed By: markbt

Differential Revision: D19351559

fbshipit-source-id: 8515a84dc58df7c44fd324cc69b7b142fd063b8f
2020-01-13 09:43:57 -08:00
Thomas Orozco
6e266973a1 chg: don't preload "rust" extension
Summary:
D19340538 deleted `eden/scm/edenscm/mercurial/rust/__init__.py`, but
chg's `_preimportmodules` still tries to import it, which breaks Mononoke

```
   $ hg init repo-hg
+  Traceback (most recent call last):
+    File "/data/users/torozco/fbsource/fbcode/buck-out/dev/gen/eden/scm/__hg__/runtime_resources/__default__/eden/scm/hglib/edenscm/__init__.py", line 61, in run
+      dispatch.runchgserver()
+    File "/data/users/torozco/fbsource/fbcode/buck-out/dev/gen/eden/scm/__hg__/runtime_resources/__default__/eden/scm/hglib/edenscm/mercurial/dispatch.py", line 336, in runchgserver
+      _preimportmodules()
+    File "/data/users/torozco/fbsource/fbcode/buck-out/dev/gen/eden/scm/__hg__/runtime_resources/__default__/eden/scm/hglib/edenscm/mercurial/dispatch.py", line 319, in _preimportmodules
+      __import__(name)
+  ImportError: No module named rust
+  [1]
```

NOTE: I had a `__init__.pyc` left in the directory removed in D19340538, which
I'm guessing is why was still working on a `make local` build. After removing
that directory, a `make local`-built hg crashes consistently with the same
error for me.

Reviewed By: farnz

Differential Revision: D19371748

fbshipit-source-id: 4f57b5e1f75b2bd6e857303111fc01446124417b
2020-01-13 09:41:00 -08:00
Jun Wu
674b592596 clindex: fix error type in partialmatch
Summary:
The expected error type is RevlogError. Previously that RevlogError
was converted from RuntimeError. However, D19169527 stack changed
RuntimeError to RustError, causing clindex partialmatch to raise
RustError instead, which is not handled by the Python layer.

Convert RustError to RevlogError to solve the issue.

Context:
https://fb.workplace.com/groups/scm/permalink/2591821277534143/

Reviewed By: DurhamG

Differential Revision: D19359074

fbshipit-source-id: 7b7b500cdf01272791a73ea0d94397e1397ff80b
2020-01-10 20:36:59 -08:00
Jun Wu
ffc85f7222 changelog: add a way to migrate up and down with zstore-commit-data format
Summary:
This makes it possible to use zstore instead of 00changelog.d to store commit
data. Right now it double writes to zstore and 00changelog.d if turned on.
In the future we can switch to only writing to zstore if 00changelog.i
alternative is available.

Some related configs were added for fallback strategy: revlog or server.
The revlog fallback allows us to do fast migration. The server fallback
(not implemented in this diff) allows us to stop depending on revlog.d.

Reviewed By: DurhamG

Differential Revision: D18737260

fbshipit-source-id: 3c9605f0babd8a215ee74bdf1275cc4e9dbd766c
2020-01-10 19:01:43 -08:00
Jun Wu
cbb65388aa changelog: add a way to write revlog.d to zstore
Summary:
The `00changelog.d` file contains commit data (user, date, message, but no
ordered parents).

By setting the `zstore` attribute on `changelog`, reads from `00changelog.d`
(aka. the `revision` method) are going to use `zstore` instead. Writes will
go to both `00changelog.d` and `zstore`.

Reviewed By: DurhamG, xavierd

Differential Revision: D18737258

fbshipit-source-id: fd1cf52a77fe396df66b77c4df77089326f5d4c2
2020-01-10 19:01:43 -08:00
Jun Wu
6266e2cad6 tests: improve test reliability for parsing dates
Summary:
We have seen issues parsing '0' as date somehow passes on OSX, and parsing
'Apr 2018' fails on Windows with GitBash. Let's workaround the tests while
I'm going to find better fixes.

Reviewed By: xavierd

Differential Revision: D19353054

fbshipit-source-id: c0302071964191b97eea6572ffd985f831db6791
2020-01-10 15:46:17 -08:00
Stefan Filip
98fc586755 types: add helper method for generating repo paths in testutil
Summary:
Using RepoPath::arbitrary() has a high chance or producing a lot of different
top level directories. The helper method added by this change,
`generate_repo_paths` simulates directories having various files and several
directories.

Reviewed By: quark-zju

Differential Revision: D19321366

fbshipit-source-id: 5c1aec78b6157f3cbea3d0673b29b3a676de88c0
2020-01-10 11:12:41 -08:00
Stefan Filip
403e4ae594 manifest-tree: add basic benchmark
Summary: Basic benchmark that covers insert, remove, finalize and iterations.

Reviewed By: quark-zju

Differential Revision: D19204893

fbshipit-source-id: 3aafbf6d94a558d2fd4ae59190f6046dc7c5885e
2020-01-10 11:12:41 -08:00
Stefan Filip
526b029faf manifest: move TestStore to the testutil module
Summary:
The TestStore can be leveraged by methods outside the manifest-tree crate.
Anything that wants to instantiate a manifest for test purposes could
leverage it.

Reviewed By: quark-zju

Differential Revision: D19204894

fbshipit-source-id: 4ac42d09855c70f829feefc6c71dcdbf7211cae3
2020-01-10 11:12:41 -08:00
Jun Wu
56b1f098dd bindings: move indexes and threading to bindings
Summary:
For some reason, our linker flag `-uinitthreading` no longer works in buck opt
build. This affects the `indexes` and `threading` Python extensions. Move them
to `bindings` to solve the problem.

Reviewed By: fanzeyi

Differential Revision: D19340538

fbshipit-source-id: 0c82b472f2916229d3c5e481954b69415b5b0dc2
2020-01-09 20:02:00 -08:00
Josh Rosenbaum
6239a21832 Add "Diff Number" column to "perfpipe_hg_commit_info"
Summary: I would like to link the Phabricator Diff Number to specific mercurial revisions.  After talking to Durham, the least invasive and best method for accomplishing this is to log the Phabricator Diff Number at runtime. Hence, whenever someone modifies the current commit, log the Phabricator Diff Number (when possible). The resulting table will theoretically have a map from "revision" -> "Phabricator diff number".

Reviewed By: DurhamG

Differential Revision: D19334379

fbshipit-source-id: eb04a8af4dbeb9a7e130a268fce8a6c5d26ebfa9
2020-01-09 17:15:13 -08:00
Durham Goode
3f40eff4b1 tracing: fix threshold check for long commands
Summary:
In the refactor to the new tracing framework, the threshold comparison
got changed and became a seconds-vs-milliseconds check, which therefore almost
never passes. Let's change it back to seconds-vs-seconds.

Reviewed By: quark-zju

Differential Revision: D19322203

fbshipit-source-id: d9cfb3854d3ee6b8c7ab5309544abd64af51027f
2020-01-09 16:04:17 -08:00
Durham Goode
376f5e4be9 split: fix updating back to original commit on exit
Summary:
D19114546 introduced a new rollback mechanism where it updates to the
original commit if the user quits. Unfortunatley it only did the update if the
user had made a commit, so if they exitted immediately before making a commit,
it left them on the wrong commit and all their changes are pending.

Reviewed By: quark-zju

Differential Revision: D19334201

fbshipit-source-id: c959096adfa3563894578436e8252c037b50e32c
2020-01-09 13:55:27 -08:00
Eric Niebler
a338113719 Remove folly's ColdClass, which was of dubious utility
Summary: `folly::cold_detail::ColdClass` was marking things (like `folly::Unexpected`) cold, but at the cost of inhibiting the inliner from doing its job. This is leading to bad codegen, which offsets any small wins we mind get for the `cold` attribute.

Reviewed By: yfeldblum

Differential Revision: D19324159

fbshipit-source-id: 7ed431b6c9d6e963c3bf438c707fa6cf6a38bf9d
2020-01-09 13:09:56 -08:00
Jun Wu
5da0c6903d util: switch to Rust time parsing
Summary:
The Rust bindings now provide a subset of time parsing features.  Replace the
old Python implementation. This has multiple benefits:
- Strong gurarnatee that Rust and Python behave the same.
- Parse relative time (ex. `5 minutes ago`)
- Parse date beyound i32 range (ex. >= year 2038)

Reviewed By: DurhamG

Differential Revision: D18946332

fbshipit-source-id: 721f47bc5b2835d7ca0a05ab34ea4faa1a411a4e
2020-01-09 11:51:31 -08:00
Jun Wu
6249b1713d hgtime: fix timezone handling converting local date
Summary:
If the user specifies a timezone-less date, ex. `2000-7-1`, it's incorrect
to use the same offset of `Local::now()`, because of daylight savings.

Fix it by going through proper type conversion.

Reviewed By: DurhamG

Differential Revision: D19179800

fbshipit-source-id: 6fd433757e7f6e4baf4625944d4061548a436f11
2020-01-09 11:51:30 -08:00
Durham Goode
1a3fe83b62 edenfs: remove automigrate on debugedenimporthelper
Summary:
This is causing a deadlock when an hg process takes the lock, accesses
an edenfs file, then eden launches debugedenimporthelper which also tries to
take the lock. Let's back it out for now.

Reviewed By: krallin

Differential Revision: D19331038

fbshipit-source-id: b8480c2e07079c3babeae8de48c02affa43188fc
2020-01-09 09:44:29 -08:00
Jun Wu
459ae48cef indexedlog: stabilize log::tests::test_repair_and_delete_content
Summary:
Previously, between 100 to 500 runs, the test is likely to fail:

  ---- log::tests::test_repair_and_delete_content stdout ----
  thread 'log::tests::test_repair_and_delete_content' panicked at 'assertion failed: `(left == right)`
    left: `"Verified first 141 entries, 999 of 1400012 bytes in log\nReset log size to 999\nIndex \"c\" is incompatible with (truncated) log\nRebuilt index \"c\""`,
   right: `"Rebuilt metadata\nVerified first 141 entries, 999 of 1400012 bytes in log\nReset log size to 999\nRebuilt index \"c\""`', src/log.rs:3414:9

The "Rebuilt metadata" part is missing.

This is because after D17742003, the end of `meta` is the `epoch`, which is a
random number. The test is rewriting the end of `meta` to corrupt it. That
has a chance to not corrupt the file. Change the test to corrupt the fixed
header of meta so it can always corrupt the file and therefore stabilize
the test.

Reviewed By: xavierd

Differential Revision: D19325087

fbshipit-source-id: 53d46c8a6cb9771582f8f37e27f185d303fde0ce
2020-01-09 08:48:47 -08:00
Xavier Deguillard
4322befcb0 remotefilelog: deduplicate prefetched filenodes
Summary:
The Rust Contentstore code assumes that the prefetch request doesn't contain duplicated
filenodes so let's do it on the Python side.

Reviewed By: quark-zju

Differential Revision: D19318847

fbshipit-source-id: 73375de60f4fb81021eba16506037984eebdf048
2020-01-09 07:47:00 -08:00
Xavier Deguillard
38139a9785 tests: make file fetching messages optional
Summary:
The Rust ContentStore will not print these, and in order to better understand
what tests are broken with it enabled, let's make them optional.

Reviewed By: quark-zju

Differential Revision: D19318848

fbshipit-source-id: 87a1da510b51adc40a0d08157925a990456d3e9c
2020-01-09 07:46:59 -08:00
Jun Wu
064068169b dag: rename slice to VertexName
Summary:
Per discussion, we decided to use "VertexName" as the struct name for things
like commit hashes, or the string names in tests (or the Mozilla DAG in tests).
Therefore, introduce a dedicated VertexName type and repalce all callsites to
use it.

`bytes::Bytes` is used so copying the `VertexName` is somewhat considered cheap.

This adds some overhead copying slices (and `Bytes` has some overhead). It
regresses the "building segments" benchmark from 673ms to 773ms, which seems
okay given the cleaner interface.

Reviewed By: markbt

Differential Revision: D19154905

fbshipit-source-id: 4c6d4eca67c11c10ed5f21999ccdc3f1b01695e8
2020-01-08 21:35:28 -08:00
Jun Wu
24f403368b patch: fix applying hunks to renamed files
Summary: Previously the patch logic cannot apply hunks to renamed files. Fix it.

Reviewed By: DurhamG

Differential Revision: D19271024

fbshipit-source-id: 8ba82587dd2f4b84a1d5c7e51c4c86a5e11f0ca0
2020-01-08 19:26:23 -08:00
Jun Wu
6ec68995a3 test-record: add test case for selecting chunks in a renamed file
Reviewed By: DurhamG

Differential Revision: D19271025

fbshipit-source-id: c7d39dc6ecb3bafc304e983366b2b2965e26c472
2020-01-08 19:26:23 -08:00
Jun Wu
94c7fc65d8 run-tests: share chg server for all tests
Summary:
Previously, each test uses a separate chg server, because there are different
states in different tests. So chg servers cannot be reused across tests.

Nowdays chg servers are more stateless, and can be shared for all tests.
Do that to reduce chg server startup overhead.

With this change, `./run-tests.py --time $(rg -l chg-compatible)` went down
from 4:57 to 4:04 on my devserver.

A configuration `--chg-sock-path` is added for advanced use-cases.

Reviewed By: DurhamG

Differential Revision: D18924911

fbshipit-source-id: c2f7d84ee4cbfb5d599cfdc0ab47f922fae4a67e
2020-01-08 19:24:05 -08:00
Jun Wu
232d5047cc dag: fix incorrect gca calculation
Summary: `gca(X) = gca(roots(X))`, not `gca(heads(X))`.

Reviewed By: sfilipco

Differential Revision: D19154907

fbshipit-source-id: 8d54992fbf5b03ce7ab2fbcc689c79351bf75947
2020-01-08 18:46:08 -08:00
Jun Wu
c6c4baa07e dag: redefine Id::{MIN, MAX} using Group
Summary:
Redefine Id::{MIN, MAX} using Group so Id::MAX.group() is a valid group.
Previously Id::MAX has an invalid group.

Reviewed By: sfilipco

Differential Revision: D19154908

fbshipit-source-id: 6108f02da786eb228a7d1b772ca5134c1ebb6f6b
2020-01-08 18:46:07 -08:00
Jun Wu
c4cd7df3b2 dag: extract logic calculating universal commits to a method
Summary:
Address review feedback on D18670160.

This also fixes the definition of "universal" a bit - the new code no longer
assumes there are only one head in the master group.

Reviewed By: sfilipco

Differential Revision: D19154906

fbshipit-source-id: 4fbf080354318300ce09dc7fba2dcc5f942b6308
2020-01-08 18:46:07 -08:00
Jun Wu
bcaff9062c dag: rebuild non-master id and segments if needed
Summary:
Add utilities to rebuild non-master ids and segments if necessary.

The `NamedDag` structure ensures indexes have 1:1 mapping.

Reviewed By: sfilipco

Differential Revision: D18838995

fbshipit-source-id: 4a48b183c182bd5e6336a2ca4973c36091fbbfd8
2020-01-08 18:46:07 -08:00
Jun Wu
28380e0272 dag: fix logic about avoiding unnecessary high level segments
Summary:
The check of "is this high level segment necessary or not" should be done
before dropping the last segment. This fixes an issue discovered in D18838992.

Reviewed By: sfilipco

Differential Revision: D19154904

fbshipit-source-id: fb4c83c39d66215bae168ad98e5cf78de91cc5a3
2020-01-08 18:46:06 -08:00
Jun Wu
d4eddd6b11 dag: use NamedDag in tests
Summary:
NamedDag is the high-level interface that is more interesting to test.

High-level segments are changed subtly because NamedDag syncs them to disk
first.

Reviewed By: sfilipco

Differential Revision: D18838992

fbshipit-source-id: c6a557e0a44a1d24320ea4a9e4283262f6f30f67
2020-01-08 18:46:06 -08:00
Jun Wu
2b4095e3fb indexedlog: fix warnings on Windows
Summary: Those warnings are not seen on POSIX build.

Reviewed By: sfilipco

Differential Revision: D19320441

fbshipit-source-id: feddf728eb9627834559b87d83e20f0afd9080c8
2020-01-08 18:11:38 -08:00
Jun Wu
dd79207c32 indexedlog: fix benchmarks
Summary: The `rand` APIs had changed. Update the benchmark code accordingly.

Reviewed By: sfilipco

Differential Revision: D19320122

fbshipit-source-id: 44c376b17afea52ecc548d79b44cbb50f7e9e567
2020-01-08 18:11:37 -08:00
Jun Wu
cfe135737b indexedlog: fix clippy issues
Summary: Fix issues reported by clippy.

Reviewed By: sfilipco

Differential Revision: D19320121

fbshipit-source-id: 58f6402eb2a4f52914a760299bdfa72e5a63b2e6
2020-01-08 18:11:37 -08:00
Durham Goode
2ad1e0ad7e eden: automigrate during debugedenimporthelper
Summary:
We had eden-backing repos that were using formats from years ago
because they never ran pull to trigger the automigrate. Let's automigrate as
part of debugedenimporthelper to keep these repos up-to-date.

Reviewed By: quark-zju

Differential Revision: D19320510

fbshipit-source-id: 475a6acf8748677de3183dfb5d4c6df7caca606d
2020-01-08 17:31:59 -08:00
Durham Goode
42e6ae2b55 tests: update case collision test for tag deprecation
Summary: The case collision test broke when I disabled tags.

Reviewed By: singhsrb

Differential Revision: D19321272

fbshipit-source-id: d59a0ad38b80f35931bbb4fb52e400d714ebbf37
2020-01-08 17:00:42 -08:00
Chad Austin
bf4441ee86 use unicode micro symbol when logging thrift call durations
Summary: µ

Reviewed By: wez

Differential Revision: D19191188

fbshipit-source-id: 287d208808d782179ce9e70c323f8dd45e5168c3
2020-01-08 14:43:25 -08:00
Chad Austin
91eda6e3e3 fix cmake build
Summary:
D19135344 broke EdenFS's cmake builds, and our macOS releases haven't
been going out. Rather than pass the same streaming options to the
Thrift compiler in the CMake build, remove deprecated_server_streams
from both builds.

Reviewed By: simpkins

Differential Revision: D19204397

fbshipit-source-id: c22e634ded82a683daff5c92182c8a1eb1ed4d21
2020-01-08 14:08:34 -08:00
Durham Goode
27e9ca5317 telemetry: truncate fullcommand to 256 bytes
Summary:
If users or automation invoke a bunch of really long commands, it can
occupy a lot of space in our logs. The full command for really long commands is
unlikely to be useful, so let's truncate them to 256 bytes.

Reviewed By: ikostia

Differential Revision: D19317932

fbshipit-source-id: 428479a18dd7e5a7ae4d8f862cf26c02c15b1fcb
2020-01-08 12:58:44 -08:00
Xavier Deguillard
83d46c7c3b pyrevisionstore: remove to_pyerr
Summary:
Python errors wrapped in a Rust Error would be incorrectly changed into a
RuntimeError instead of the original one. The map_pyerr method does the right
thing, and is also shorter, let's use it.

Reviewed By: quark-zju

Differential Revision: D19313883

fbshipit-source-id: 1ecb41a8eef9d41618905d6d00f199252d373f96
2020-01-08 12:52:43 -08:00
Durham Goode
d8663cb534 treestate: backout making it a hard requirement
Summary:
It turns out some old repos are still using the legacy treedirstate
format, which broke when I made this a hard requirement. Let's roll this back
for now.

Reviewed By: singhsrb

Differential Revision: D19313773

fbshipit-source-id: ded78be033cb04323a2e1d237059947dee509df9
2020-01-08 11:33:28 -08:00
Mark Thomas
43550ca5bb commitcloud: fix ordering and workspace handling for cloud sl history
Summary:
Interactive smartlog history relies on the order from the server, which has
changed, and so is now incorrect.  Sort the versions from the server so
we can be sure they're always in the right order.

Interactive smartlog history also ignores the workspace parameters to specify
the workspace.  Fix that.

Reviewed By: farnz

Differential Revision: D19309253

fbshipit-source-id: 9fc1b443e72557331e22d0987c73286f5c64e16d
2020-01-08 05:30:17 -08:00
Durham Goode
9778811573 tags: remove tags feature
Summary:
We no longer user tags in any of our repositories, so let's delete all
the code and remove some tech debt.

Previously drawdag was our last remaining use of tags, but in a previous diff I
switched that to use bookmarks.

Reviewed By: quark-zju

Differential Revision: D19042226

fbshipit-source-id: d7871c71c1026599aa70fdd806418347ea214a8a
2020-01-07 12:31:10 -08:00
Durham Goode
898149fa37 treestate: make treestate a hard requirement
Summary:
We want to delete all the non-treestate dirstate implementations. Let's
start throwing an exception if treestate is not enabled. We temporarily have a
bypass in case we break an important usecase in the process.

This also sets the standard new repo to be created in treestate mode, but adding
treestate to newreporequirements.

Reviewed By: quark-zju

Differential Revision: D19204621

fbshipit-source-id: 61c0c69ce6e559615ef570d2343bea78c1b5d5ee
2020-01-06 21:37:05 -08:00
Durham Goode
7286630863 rebase: prevent fast-foward rebases with conflicting changes
Summary:
Tweakdefaults adds the ability for `hg rebase -d` to simply fastforward
the user if the destination is a descendant of the current working copy parent.
If the working copy is dirty, it merged the files, potentially leaving the
working copy with merge conflicts that are hard to recover from.

A normal hg update disallows merges that would result in potential conflicts.
Let's update the rebase code to use the same merge logic, so fast forward
rebases simply abort if there are potential conflicts.

Reviewed By: quark-zju

Differential Revision: D19204198

fbshipit-source-id: 1b0c2c0fdab909eebe74d1a211dbfb2d780058cd
2020-01-06 15:06:50 -08:00
Mark Thomas
2158e4c531 commitcloud: add Rust rendering of cloud smartlog
Summary:
Allow rendering of cloud smartlogs using renderdag.  Use the ability of renderdag
to reserve columns to provide the smartlog-like indentation of draft stacks.

Reviewed By: quark-zju

Differential Revision: D19272577

fbshipit-source-id: 3311d83511b0d5347b45f33c282ce26b8133d047
2020-01-06 15:00:08 -08:00
Mark Thomas
8e28741a8b smartlog: add Rust rendering of graphs
Summary: Allow rendering of smartlog graphs using renderdag.

Reviewed By: quark-zju

Differential Revision: D19272578

fbshipit-source-id: 1cd19753781c58e49038d72f12c8f5ebf3bad6f9
2020-01-06 15:00:08 -08:00
Mark Thomas
da3d898cd4 cmdutil: add Rust rendering of graphs
Summary:
Allow rendering of graphs using renderdag by setting `experimental.graph.renderer` to `ascii`, `ascii-large` or `lines`.

The minimum height of each row can be set using `experimental.graph.min-row-height`.

Reviewed By: quark-zju

Differential Revision: D19272580

fbshipit-source-id: ac5eff8446bd3c09d07624a193195b4224055ffc
2020-01-06 15:00:07 -08:00
Mark Thomas
0822231d79 pyrenderdag: add python bindings for renderdag
Reviewed By: quark-zju

Differential Revision: D19272576

fbshipit-source-id: f79019d3506efe03675f49b9ad728582b22bd205
2020-01-06 15:00:06 -08:00
Mark Thomas
e91c6ffa7c renderdag: make test fixtures common
Summary:
Move the test fixtures into a common module, so that they don't need to be
repeated in each test.  Since each fixtures is now a struct, this also makes it
clearer what each of the items are.

Reviewed By: quark-zju

Differential Revision: D19288290

fbshipit-source-id: 394805c652592177f11ccb096b8e5e95361456e4
2020-01-06 15:00:06 -08:00
Mark Thomas
cdd0f39805 renderdag: add test case for long messages
Reviewed By: quark-zju

Differential Revision: D19288289

fbshipit-source-id: d7d7023900d4f7c8d1ed14d15217548875a349c6
2020-01-06 15:00:05 -08:00
Mark Thomas
693ca3ff6a renderdag: Use builder pattern for output renderers
Summary:
Generalize construction of output renderers (renderers that render to `String`)
to avoid duplication of options.  At the moment there is only one, but later we
may add new options.

This also allows us to construct output renderers from any renderer that
renders to `GraphRow`, which means we can create adapters that modify or
re-order the rows of the graph.

Reviewed By: quark-zju

Differential Revision: D19286350

fbshipit-source-id: a5649ca2f48e263ee24584339179655fb612d3d1
2020-01-06 15:00:05 -08:00
Mark Thomas
213b3f086c renderdag: add a DAG rendering crate
Summary:
A new implementation for rendering DAGs.

This new crate implements a generic DAG renderer, that can convert a
topologically sorted sequence of DAG nodes into a sequence of strings suitable
for rendering to a terminal.

The new renderer differs from the old renderer in a few important ways:

* It prioritizes keeping commits linear, and will allow gaps to form if
  that will allow the history of the commits to be kept in a straight
  line.  This makes it easier to track long parallel histories.

* It supports octopus merges (nodes with more than two parents).  Even
  though Mercurial doesn't support octopus merge commits, summary DAGs
  with omitted nodes can still end up with logical octopus merges.

* It supports reservation of columns for specific nodes.  This can be
  used to support smartlog-style indentation of draft stacks without
  needing to hack around it by creating fake nodes.

* It separates out forming the graph from generating the lines.  This
  allows multiple back-ends for generating different styles of graph.

There are three back-ends implemented:

`AsciiRenderer` renders similar to the old graph renderer, using ASCII
characters.  For example:

```
  o  F
  |
  | o  E
  | |
  | | o  D
.-----'
o | |  C
+---'
o |  B
:/
o  A
```

`AsciiLargeRenderer` uses larger ASCII blocks to give a clearer picture of
complex graphs.  For example:

```
   o   F
   |
   |
   |  o   E
   |  |
   |  |
   |  |  o   D
  ______/
 / |  |
o  |  |   C
| ___/
|/ |
o  |      B
: /
:/
o   A
```

`BoxDrawingRenderer` uses Unicode box drawing characters to give a more
continuous rendering of the graph, however requires support for these
characters in the terminal font.  For example:

```
  o  F
  │
  │ o  E
  │ │
  │ │ o  D
╭─────╯
o │ │  C
├───╯
o │  B
├─╯
o  A
│
~
```

Reviewed By: quark-zju

Differential Revision: D19272579

fbshipit-source-id: bb6fa4685c965544cc3b6b9261df3a3ec161b41f
2020-01-06 15:00:04 -08:00
Jun Wu
8e3a606106 graphql: do not error out if signal_summary is None
Summary:
This can happen for "Reserved" diffs.

Reported By: hyr

Differential Revision: D19270860

fbshipit-source-id: 24e9b8c08fc16e3089e0dc3f8064a5e9671d9ace
2020-01-06 14:27:43 -08:00
Genevieve Helsel
a03dac0a83 reactivate test_abort_split_with_pending_add
Reviewed By: chadaustin

Differential Revision: D19167578

fbshipit-source-id: fa2c848a4e157bcf9c466b4b65132168201e4d97
2020-01-06 08:52:27 -08:00
Genevieve Helsel
26f4427200 add eden debug parents
Summary: adds a cli debug command to inspect the working copy parent. by default just returns eden's snapshot contents, but adds optional --hg flag to print Mercurial's dirstate information

Reviewed By: chadaustin

Differential Revision: D19167518

fbshipit-source-id: b65e112df6abe4e0e7a8a528a90b2e3d17297e66
2020-01-06 08:52:27 -08:00
Jon Maltiel Swenson
cc1a7ddcde Kill rsocket server stack
Summary: This stack is deprecated in favor of the rocket stack.

Reviewed By: rhodo

Differential Revision: D18123600

fbshipit-source-id: db6e3bf4add9c49cf8f1d2f12f97b207e87c7302
2020-01-03 15:53:10 -08:00
Jun Wu
a97842c8c2 fbscmquery: fix globalrev graphql query
Summary: `"globalrev"` is invalid. Use `GLOBAL_REV` instead.

Reviewed By: singhsrb

Differential Revision: D19271059

fbshipit-source-id: c26347b92b1b92a5f958f2f71dbdfdf3635a0876
2020-01-03 12:40:04 -08:00
Jun Wu
3db941beb4 phabstatus: handle JSON decode error
Summary:
Sometimes GraphQL does not return JSON result. Do not crash on the client-side.

Context:
https://fb.workplace.com/groups/scm/permalink/2565497036833234/

Reviewed By: farnz

Differential Revision: D19254348

fbshipit-source-id: 75ca93b1dc8648d5c59915ecf450b9366df13c01
2019-12-30 16:45:11 -08:00
Simon Farnsworth
deacaed311 Don't delete bookmarks in drawdag if there are none
Summary: In Mononoke tests, we have failures because `hg book -fd` aborts if it's not given any bookmark names. Fix up this function to not run `hg book -fd` if there are no bookmarks

Reviewed By: quark-zju

Differential Revision: D19251930

fbshipit-source-id: 2f1696d9207ad64a94c28941e72806d9b0e686fe
2019-12-30 15:41:14 -08:00
Adam Simpkins
e45e2c6f9a unbreak dirstate.status() in EdenFS repositories
Summary:
D19190259 broke `dirstate.status()` in EdenFS checkouts.  Fix the code to
properly check if the dirstatemap supports `nonnormalsetfiltered`

Reviewed By: quark-zju

Differential Revision: D19221147

fbshipit-source-id: 17f69f5b461467bfb67858fb21dc0230b928a740
2019-12-23 16:44:12 -08:00
Jun Wu
c214a2de9e test-profile: fix the test
Summary: Use `debugpython` to replave `python`

Reviewed By: akushner

Differential Revision: D19221125

fbshipit-source-id: 68f5d83f9abe38174492fdaaf7496875696c4302
2019-12-23 16:37:10 -08:00
Jun Wu
3170aa7cbc test-parse-index2: remove the test
Summary:
The test is broken by D19190496 because the test uses some weird test cases
about legacy Pythons.

The "parseindex2" test is revlog-related. The revlog is kind of stable, tested
indirectly in countless tests, and is also going away. We don't run the code
on legacy versions of Pythons.The "parseindex2" test does not provide much
value. Therefore just remove it.

Reviewed By: akushner

Differential Revision: D19221126

fbshipit-source-id: 5b904d97caa47f92098435ee85c1bb8b725c9f84
2019-12-23 16:37:10 -08:00
Jun Wu
9d36855838 bindings: add hgtime
Summary:
This makes it possible to use the hgtime parsing utilities in Python.
Namely, patterns like `since 6 days ago to now` can now be parsed.

Reviewed By: sfilipco

Differential Revision: D18946335

fbshipit-source-id: c12ea3437301f20a8c457525c0798f471b8f174a
2019-12-22 11:27:33 -08:00
Jun Wu
624e47ac1c hgtime: add a way to change "now" for testing
Summary:
The existing tests rely on this feature.
This requires replacing all `Local::` usage with `HgTime::now()`.

Reviewed By: sfilipco

Differential Revision: D18946336

fbshipit-source-id: 1a92183cc96f2fcb013b68a32e78f09f28a49452
2019-12-22 11:27:33 -08:00
Jun Wu
8812c8c97d hgtime: fix bounds of "a to b" range
Summary:
For example, `2018 to 2019` should be parsed as `2018-1-1 to 2019-12-31 23:59:59`,
not `2018-1-1 to 2019-1-1`.

Fix it to match the desired behavior.

Reviewed By: sfilipco

Differential Revision: D18946331

fbshipit-source-id: 640bbe49352d1f01855183ea9927bb0009646243
2019-12-22 11:27:33 -08:00
Jun Wu
c624847c84 hgtime: limit year in 1900 to 9999
Summary:
The Python `datatime` stdlib has limitations:

- `datetime.datetime` can only express year 1 to 9999.
- `strptime` requires year >= 1900.

Limit the `HgTime` to 1900 ..= 9999 range to be consistent.

Note: Mercurial has an `i32` range limit, which seems to problematic
since `i32::MAX` is Jan 19, 2038. So I kept using `i64`.

This addressed some XXX comments about not returning errors.

The code change is mostly because added error handling.

Reviewed By: sfilipco

Differential Revision: D18946333

fbshipit-source-id: 0e4756457b0f13451dc5008ef19d4670a7aaa7fb
2019-12-22 11:27:32 -08:00
Jun Wu
5c7acfc1ca dag: add a NamedDag that keeps Dag and IdMap consistent
Summary:
It turns out the interaction between dag and idmap can be complex, especially
when a non-master id gets re-assigned a master id.

A high-level structure is helpful here to handle the corner cases correctly.

This diff adds basic definitions, and one of the most complex function - build.
The build function is ported from pydag.

Reviewed By: sfilipco

Differential Revision: D18838994

fbshipit-source-id: a2f6db3b188d5fd04d8e1d6df40ba985e33281f6
2019-12-22 11:27:32 -08:00
Jun Wu
61e0f06417 dag: add ways to remove non-master ids in Dag and IdMap
Summary: First step to implement segment and idmap rewrites for non-master ids.

Reviewed By: sfilipco

Differential Revision: D18838996

fbshipit-source-id: 0380c0193d9078a2a2d7fde9c5f565e8dbc8e713
2019-12-22 11:27:32 -08:00
Jun Wu
784da69352 indexedlog: support efficient index deletion by prefix
Summary:
The index can delete all keys matching a prefix more efficiently than deleting
them one by one. Expose this feature.

The `dag` crate will use this feature to delete all "non-master" segments and
ids efficiently.

Reviewed By: sfilipco

Differential Revision: D18825296

fbshipit-source-id: b8531695609238a16913254af61004170f12954e
2019-12-22 11:27:31 -08:00
Jun Wu
e51daf1fb1 indexedlog: expose Index::remove in log::IndexOutput
Summary: This makes it possible to define an index function that can delete data.

Reviewed By: sfilipco

Differential Revision: D18825299

fbshipit-source-id: 4eb03a001683092d99b439c8efb8e7909f543c70
2019-12-22 11:27:31 -08:00
Jun Wu
177360c0b5 indexedlog: implement Index::remove
Summary:
This makes it possible to actually delete keys from the index, which can be
handy for certain use-cases. For example, `dag` wants to rewrite non-master
ids and segments in certain cases.

Reviewed By: sfilipco

Differential Revision: D18825298

fbshipit-source-id: 3b69ca5fc763ba0c57bd16a28a349f2f829a0759
2019-12-22 11:27:31 -08:00
Jun Wu
343f79cf37 indexedlog: move parameters of index.insert_advanced to a structure
Summary:
This just moves parameters to a structure without changing the actual logic.
This is to make it possible to add a "remove" API to index.

Some variables are prefixed with `old_` or `new_` to make the code more
consistent.

Reviewed By: sfilipco

Differential Revision: D18825297

fbshipit-source-id: 27bd8438e66125c906ebf2044d6ff978b99c5986
2019-12-22 11:27:30 -08:00
Jun Wu
fbdecc96bb cpython-ext: move foreign error handling to pyerror
Summary:
Make cpython-ext free from business logic. This adds a bit overhead.
But it should be fine given the error cases are considered rare.

Reviewed By: markbt

Differential Revision: D19186692

fbshipit-source-id: daaffc1369a36c781d1badea822bf62a144eb54e
2019-12-22 11:27:29 -08:00
Jun Wu
d4a19306ed cpython-ext: rename fallible to anyhow_result
Summary: We no longer use the `failure` crate. Rename related methods and traits.

Reviewed By: markbt

Differential Revision: D19186694

fbshipit-source-id: 1c83a90ee12db431b7d8e09a9c2cf1d43a4c0f93
2019-12-22 11:27:29 -08:00
Jun Wu
ef3f9b932d cpython-ext: rename mod failure to error
Summary:
We no longer use the `failure` crate. Rename the module.

`cpython-failure` is dropped since it was merged into `cpython-ext`.

Reviewed By: markbt

Differential Revision: D19186693

fbshipit-source-id: 410d1491bcadd8d3272c7e2df08ecbe66fc0fef2
2019-12-22 11:27:29 -08:00
Jun Wu
2824ac99f7 cpython-ext: drop PE type parameter from map_pyerr<PE>
Summary:
The `map_pyerr<PE>` API is kind of hard to use correctly since the
code that calls `map_pyerr` does not really know the best suitable error type.

The existing code also "encourage"s the use of stdlib error types like
RuntimeError, ValueError, etc since the code is shorter, which is not great.
Error types from `mercurial.error` are better choices.

With previous diffs in this stack, we now decide the Python error type based
on the Rust error type. It's no longer necessary to specify an error type
with `map_pyerr<PE>`. So let's just drop the type parameter.

A `RustError` was added for error types that `cpython-ext` does not know how
to convert. We should avoid leaking it to the Python land by just implementing
how to convert `anyhow::Error` to `PyErr` in `cpython-ext`.

Reviewed By: markbt

Differential Revision: D19169527

fbshipit-source-id: f4563c36174cd51201b526bbc92a3f1c8a3da864
2019-12-22 11:27:28 -08:00
Jun Wu
241fc4086c doctor: avoid constructing the repo object
Summary:
Constructing the repo object might read some broken storages (ex. reading
"allheads"). Avoid constructing the repo object for fixing mutationstore,
metalog and allheads.

Reviewed By: markbt

Differential Revision: D19169209

fbshipit-source-id: d792c09db20e25cce406bc8c1adb66a28410bd4d
2019-12-22 11:27:28 -08:00
Jun Wu
be20ec511c scmutil: prompt hg doctor for indexedlog errors
Summary:
Since we now have the indexedlog error type. Match it and print helpful
messages.

Reviewed By: markbt

Differential Revision: D19169207

fbshipit-source-id: cd874f651b681d2dbbb5aea613c56721c4ab6181
2019-12-22 11:27:28 -08:00
Jun Wu
4dd04bf02f hgpython: replace hgpython interpreter with native Rust implementation
Summary:
The hgpython interpreter was used to run Python scripts in tests that might
rely on Mercurial modules.

The previous hgpython implementation is Python PAR based, which does not have
access to native Rust modules like bindings. Change it to use the native
"hg debugpython" implementation that is more compatible.

Reviewed By: markbt

Differential Revision: D19190496

fbshipit-source-id: 9791dbf9ba0ed92de702291faa9145f01b05ec40
2019-12-22 11:27:27 -08:00
Jun Wu
4a4aeff284 bindings: expose IndexedLogError to Python
Summary:
Expose the indexedlog error type to Python so it can be used in `except`
clause.

Reviewed By: markbt

Differential Revision: D19169208

fbshipit-source-id: c41f08ec11f78f7714b435dbfc6a28c36b34617d
2019-12-22 11:27:27 -08:00
Jun Wu
d6b2eb80a7 cpython-ext: convert known error types to dedicated errors directly
Summary:
Convert indexedlog error and IOError to dedicated Python types so the Python
world can match them meaningfully by type and handle them accordingly.

Reviewed By: markbt

Differential Revision: D19169210

fbshipit-source-id: 1e7bfdf7cbaf917098efdcd63d600483a9427d33
2019-12-22 11:27:27 -08:00
Jun Wu
0c41aa6235 extensions: change error message to look non-fatal
Summary:
The current error message looks like fatal while it is not. Make it clear that
extension failures are not fatal.

Reviewed By: markbt

Differential Revision: D19166545

fbshipit-source-id: 7ce0231c90b0c5f50add15a12cb69b60b76dfcb1
2019-12-22 11:27:26 -08:00
Jun Wu
e5de1683e4 gitnode: try using commit extra first
Summary:
There are 3 extensions that can provide the `{gitnode}` template: "gitrevset",
"fbscmquery", "hggit". The last can read from commit extras. Fix the first two
to also read commit extras. At some point we need to unify the implementations.

Reviewed By: farnz

Differential Revision: D19198979

fbshipit-source-id: 24a0df0df4ceb7a9af9236a7f70babfd54e9802b
2019-12-20 16:14:25 -08:00
Jun Wu
e21a23cc17 blackbox: write less frequently to disk
Summary:
When there are many processes (ex. import helpers). Writing to blackbox can be
slow due to flock contention.

Change blackbox "flush" decision from timestamp based to buffer-size based to
mitigate the issue.

Reviewed By: DurhamG

Differential Revision: D19198470

fbshipit-source-id: 71f87e5e3b45ef4db8efda22ca89fd8ce1fae7fa
2019-12-20 16:14:25 -08:00
Durham Goode
e2bac56f2f dirstate: filter ignored files before looping over non-normal
Summary:
D17099990 changed the way status is computed and added a loop over the
nonnormal files to find any added, removed, or merged files. Unfortunately the
nonnormal file list can contain untracked ignored files in some cases, and if
that list is large (like if someone disabled a sparse profile) this loop can
take many seconds.

Let's updated the loop to filter out ignored files. This matches a similar loop
in fsmonitor, and we may want to think about removing nonnormal handling from
the fsmonitor code entirely now that it's handled in dirstate.py.

Reviewed By: quark-zju

Differential Revision: D19190259

fbshipit-source-id: 4ba4150507fdd72439bc4e5eb731a951c6100f5f
2019-12-20 16:14:24 -08:00
Jun Wu
e41e214a01 remotenames: avoid updating "selectivepullaccessedbookmarks" if unnecessary
Summary:
I encountered a 19s `hg sl` run where 13s were spent on
`remotenames.updateaccessedbookmarks` (8 times).

{F225347899}

The filesystem is unusually slow since the it's nearly full. However, the
updates are not really necessary since I'm not accessing more remote names.
Accessing one bookmark via smartlog rewrites the entire accessed file, which is
O(N^2) and undesirable.

Improve it by skipping writing if nothing has changed. In the future we might
want to optimize it further by:
- Only update (and do ui.log) "accessedbookmarks" at most once per command.
- Potentially drop the "accessedbookmarks" tracking by using "remotenames"
  directly - everything in "remotenames" is accessed.

Reviewed By: markbt

Differential Revision: D19191528

fbshipit-source-id: 46635d4e5c9d0034ace9cdafc1f42a4512aa8774
2019-12-20 16:14:24 -08:00
Thomas Orozco
82df66ffe9 lfs: avoid accidentally quadratic performance in download path
Summary:
Currently, hg's lfs extension used bytes concatenation to download a response
from the server-side. However, concatenating bytes in Python can be
inefficient, since it'll re-allocate the whole thing and copy it every time you
concatenate.

This makes repeated concatenation O(N^2) on the number of things you
concatenate, which is undesirable. This diff updates hg's lfs extension to not
do that.

Reviewed By: farnz

Differential Revision: D19194388

fbshipit-source-id: f4a38afd8ba41bc1c2e64e9127035675ecda6651
2019-12-20 16:14:24 -08:00
Thomas Orozco
2a4a6fab4e lfs: check content length after downloading content
Summary:
HTTP makes no provision to tell your client that you failed halfway through
producing your response and won't have the answer they're looking for. So, if a
LFS server fails while producing a response, then we'll report an OID mismatch.

We can do a little better and disambiguate between "the server sent us the
wrong blob" (very scary) and "the server crashed" (merely annoying) by looking
at the content length of the response we got back. If it's not what was
advertised, we can reasonably safely assume the server crashed.

Reviewed By: farnz

Differential Revision: D19194389

fbshipit-source-id: 569bd20cffe2901e2801261ce783e99bcf8358e2
2019-12-20 16:14:24 -08:00
Jun Wu
2038472340 test-fb-hgext-sshaskpass: require linux to run
Summary:
The test is flaky in recent OSX builds.

The test is about a chg feature. Right now we only use chg on Linux. So limit
the test to Linux only.

Reviewed By: singhsrb

Differential Revision: D19191582

fbshipit-source-id: ce506f3f50c4368253caea0d73a647539c649735
2019-12-20 16:14:24 -08:00
Jun Wu
df5dce4138 test-convert-hg-source: require execbit to fix it on Windows
Summary:
After D19043330, the test is failing on Windows (no execbit).

When converting a repo, we almost always want to preserve the execbit. So let's
just skip the test if execbit is not available.

Reviewed By: singhsrb

Differential Revision: D19191556

fbshipit-source-id: 8e65d0b4b03833216ac8f28e2ae25f87de72304f
2019-12-20 16:14:23 -08:00
Adam Simpkins
80b8e1bfd2 drop the log level for some debug messages
Summary:
Reduce the log level for a few messages to help reduce some less important
clutter when running with an elevated debug log level.

Reviewed By: chadaustin

Differential Revision: D19188773

fbshipit-source-id: 396bb15e119fc12765ecbc707e7a1dadbdd02422
2019-12-20 16:14:23 -08:00
Chad Austin
3d3c2a9f32 stop storing sizes in their own local store column
Summary:
Remove some half-baked, unnecessary logic for caching sizes separately
from SHA-1. Eden's backing stores do not support chunking large files
yet, so there's no value in caching content SHA-1 and size
separately. This fixes a scenario where fetching blob size and then
SHA-1 would result in two backing store imports.

Reviewed By: fanzeyi

Differential Revision: D19169096

fbshipit-source-id: dc32f3313e5f4230c06a5bbaa67da7bf0febaba8
2019-12-20 16:14:23 -08:00
Chad Austin
873fd0de43 enable tree caching in non-hg backends
Summary:
Troditionally, ObjectStore relied on HgBackingStore writing directly
to LocalStore in order to cache trees. This had the unfortunate side
effect that other backing store implementations did not benefit from
tree caching.

Move tree caching into ObjectStore so all backing stores benefit from
tree caching.

Reviewed By: simpkins, fanzeyi

Differential Revision: D19168211

fbshipit-source-id: b1019591ebb4760cc8b933b9adb82174b8e5fa1f
2019-12-20 16:14:23 -08:00
Chad Austin
f0ace30454 fix doctor tests when host has low disk space
Summary:
The doctor tests for available disk space checked the host's actual
disk, causing them to fail when run on machines with full disks. Add a
fake and use it by default.

Reviewed By: simpkins

Differential Revision: D19145853

fbshipit-source-id: b4202a4eabffd8b7a968de9fb4370c0a0ca99d4d
2019-12-20 16:14:23 -08:00
Chad Austin
0d67cc3833 fix tree import when local store loses its cache
Summary:
If a GC ran at the same time as HgBackingStore imported a commit, the
import would fail. Rather than round-tripping the tree through the
LocalStore, just return it.

Reviewed By: genevievehelsel

Differential Revision: D19167798

fbshipit-source-id: eddb280def349483289d2e300a58eff3ad7416e1
2019-12-20 16:14:22 -08:00
Genevieve Helsel
f6cfa5f229 remove use of getScmStatusBetweenRevisions in eden doctor
Summary: There is one instace of `getScmStatusBetweenRevisions` in use - it is used in the eden cli in a hacky way to check if a commit hash is valid. Since this is not used anywhere else in a meaningful way, this replaces that use case with a hg call and depreciates `getScmStatusBetweenRevisions`

Reviewed By: simpkins

Differential Revision: D18690026

fbshipit-source-id: 02bd2c20a0f631ec41116f9fd4e18d14369298ef
2019-12-20 16:14:22 -08:00
Durham Goode
b4f44d39a5 convert: delete support for gnuarchs, darcs, and bzr
Summary:
We don't support any of these VCS's, and we're not running any of the
tests. The code is just bit rotting. Let's delete them.

Reviewed By: quark-zju

Differential Revision: D19043710

fbshipit-source-id: 6e0d625c755cbc875755dc09b394bc730186db1d
2019-12-20 16:14:22 -08:00
Zeyi (Rice) Fan
071a3682fd eden: semi-futurify BackingStore::getTree
Summary: D18669664

Reviewed By: chadaustin

Differential Revision: D18670157

fbshipit-source-id: 74c8c3e2fae16973079e5d3d3bc2fe18adf088a7
2019-12-20 16:14:22 -08:00
Zeyi (Rice) Fan
99c2a6ca2e eden: semi-futurify BackingStore::getTreeForCommit
Summary: Same as D18669664.

Reviewed By: chadaustin

Differential Revision: D18669966

fbshipit-source-id: 54974528259a91f8f222bd60e897d28f41675351
2019-12-20 16:14:22 -08:00
Zeyi (Rice) Fan
aeaa26c274 eden: semi-futurify BackingStore::getTreeForManifest
Summary: see D19107687

Reviewed By: genevievehelsel

Differential Revision: D19107687

fbshipit-source-id: 652084ad0e64884d6273a4206d26d572915e3a51
2019-12-20 16:14:22 -08:00
Zeyi (Rice) Fan
068ff196bd eden: SemiFuture-ify BackingStore::getBlob
Summary:
This diff turns the return type of `BackingStore::getBlob` from `folly::Future` into `folly::SemiFuture` to prevent executor leaks.

This also enable us to remove the need of holding `serverThreadPool` from backing stores.

----

**Changes**

* `ObjectStore` now needs to hold a `folly::Executor::KeepAlive` that is used to turn `SemiFuture`s it gets from backing stores into `Future`.
* Signature changes of the implementations of `BackingStore` class.
* For tests, I chose to use `QueuedImmediateExecutor` in place of `UnboundedQueueExecutor` as it will basically execute tasks inline. I'm concerned introducing thread pool executor in tests may turn tests flaky.

Reviewed By: wez

Differential Revision: D18669664

fbshipit-source-id: 0cae89f365dcf8b345b49d64469a530cf25d4ac5
2019-12-20 16:14:21 -08:00
Chad Austin
0d7944a39c prevent eden top from increasing scrollback
Summary:
This fixes a regression in `eden top` introduced this summer where it
would gradually add to the terminal's scrollback. The cause was
accidentally using `window.clear` instead of `window.erase`.

Reviewed By: genevievehelsel

Differential Revision: D19061316

fbshipit-source-id: 4ef4c7bcd00e30ff5d3b80406ea01a476346faf9
2019-12-20 16:14:21 -08:00
Jia Chen
a731c7518d Update pyre version for eden
Summary: Automatic upgrade to remove `version` override and silence errors.

Differential Revision: D19143864

fbshipit-source-id: 0d2d4ed32423b740a67aae670b7f10691e4f4800
2019-12-20 16:14:21 -08:00
Jun Wu
05ba5a56d4 dag: rewrite Debug for Dag
Summary:
The current implementation iterates through all entries, which will include
deleted entries. Rewrite it to use index lookups so it does not print
deleted entries.

Reviewed By: sfilipco

Differential Revision: D18838993

fbshipit-source-id: 58d3f2da27cd3e91bc10cbb04bcdca3b7ff07dbb
2019-12-20 16:14:21 -08:00
Jun Wu
859b79de3b dag: replace Group::MAX with Group::COUNT
Summary:
Address review comment in D18640899. I went a bit further that makes COUNT,
ALL, and BITS consistent.

Reviewed By: sfilipco

Differential Revision: D18820721

fbshipit-source-id: e354a3aecf0d8cbe66c43d56198933cdc6420241
2019-12-20 16:14:21 -08:00
Jun Wu
710e2c9ae8 dag: replace Id(0) and Id::max_value() with Id::{MIN,MAX}
Summary:
Address review comment in D18640898.

Id::min_value and Id::max_value become unused and are removed.

Reviewed By: sfilipco

Differential Revision: D18820722

fbshipit-source-id: d9682bf5918307166571fa35aa15cc9eee1a7140
2019-12-20 16:14:21 -08:00
Jun Wu
a1d710fa58 dag: rename GroupId to Group
Summary:
Address review comment in D18640899. This makes the word `id` universally
refer to a same concept within the crate.

Reviewed By: sfilipco

Differential Revision: D18820723

fbshipit-source-id: 6803192db7e1304a72100568f8f29b90f25c7779
2019-12-20 16:14:21 -08:00
Jun Wu
d3543665eb dag: de-dup IdMap at insertion time
Summary: There is no need to insert duplicated entries to IdMap.

Reviewed By: sfilipco

Differential Revision: D18670158

fbshipit-source-id: 812ea421c9f36cd12b4aa2be5b2560abec627a52
2019-12-20 16:14:20 -08:00
Jun Wu
d60355d1ba dag: add a way to generate sparse IdMap
Summary: This emulates what IdMap the server will send to the client at initial clone.

Reviewed By: sfilipco

Differential Revision: D18670160

fbshipit-source-id: 496142c1e149df9accf816e3d0a1b8316ff64c67
2019-12-20 16:14:20 -08:00
Jun Wu
3125f6bbd5 dag: implement Debug for IdMap
Summary: This makes it easier to check what's stored in IdMap.

Reviewed By: sfilipco

Differential Revision: D18670159

fbshipit-source-id: 91387d01da7d52a0d349e87ffa0aa8983bbe2213
2019-12-20 16:14:20 -08:00
Jun Wu
0d8ae15299 dag: implement more protocols
Summary:
This diff implements the following part in a local-only environment:

  Id -> Slice: Id -> Request --> Response -> Slice
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  Slice -> Id: Slice -> Request --> Response -> Id
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^

Reviewed By: sfilipco

Differential Revision: D18664210

fbshipit-source-id: 740b9cdfe533e7bcc9bbbf2a53c8bcc5bc3648bf
2019-12-20 16:14:20 -08:00
Jun Wu
7a35f20e72 dag: implement some protocols
Summary:
This diff implements the following part in a local-only environment:

  Id -> Slice: Id -> Request --> Response -> Slice
               ^^^^^^^^^^^^^
  Slice -> Id: Slice -> Request --> Response -> Id
               ^^^^^^^^^^^^^^^^

Reviewed By: sfilipco

Differential Revision: D18664205

fbshipit-source-id: 47a35c6f95a58ab29c014ac3c6799f16e6114da3
2019-12-20 16:14:20 -08:00
Jun Wu
2467448518 dag: abstractions around remote protocols
Summary:
In the future the client will have a sparse IdMap, and needs the server (who
has a complete IdMap)'s help to convert between Id and Slice (commit hash)
for commits in the MASTER group.

This diff defines basic abstractions for communications between a sparse IdMap
and a complete IdMap. The basic flows are:

  To convert Id to Slice: Id -> Request --> Response -> Slice
  To convert Slice to Id: Slice -> Request --> Response -> Id

(`->`: client-side; `-->`: server-side)

Reviewed By: sfilipco

Differential Revision: D18664206

fbshipit-source-id: 93a6b671be30ab1247c71d814817a2ea06b6bc66
2019-12-20 16:14:20 -08:00
Adam Simpkins
983f454135 limit the number of tree prefetch operations that can run in parallel
Summary:
Add a config option to restrict the number of tree prefetches that can run in
parallel.  Without this applications that recursively walk a checkout tree can
end up spawning a huge number of asynchronous prefetch operations.  These
prefetch operations are quite expensive today, as we currently have to fetch
the full file contents in order to retrieve the file sizes.  A recursive
directory walk can end up building up a huge backlog of in-progress tree
prefetches.  This will slow down the directory walk, and it can take tens of
minutes to finish processing the prefetch backlog even after the directory
walk is aborted.

Reviewed By: chadaustin

Differential Revision: D19136685

fbshipit-source-id: cdc7a570d016fd7ca81a639cef83380b197acdfc
2019-12-20 16:14:19 -08:00
Durham Goode
6caa257684 commitcloud: use our background spawning utility
Summary:
On Windows, subprocess.Popen caused the current process to wait until
the background process was complete, which meant commit, amend, rebase, etc had extra long waits on the end. We have utility functions that correctly set up the background process, so let's use that instead.

Unfortunately we can't redirect stdin, stdout, stderr when using close_fds on
Windows, so we lose the ability to do logging.

Reviewed By: quark-zju

Differential Revision: D19149682

fbshipit-source-id: 6880ec7833e286b79b34c49c339aff3318f07295
2019-12-20 16:14:19 -08:00
Jun Wu
5d5c575139 exchange: add a config to stop writing local bookmarks
Summary:
This is part of the logic of remotenames. Unfortunately our production setup
has some really annoying legacy code in multiple places that disables
remotenames and do `rm .hg/bookmarks` manually. They should really enable
remotenames and get rid of `rm .hg/bookmarks`. However that has complications.

With recent changes, `.hg/bookmarks` is moved to `.hg/store/bookmarks` and
later moved to `metalog`. That caused 10k+ bookmarks left in local bookmarks
after clone (or pull).

Writing remote bookmarks as local bookmarks makes no sense in modern setup.
Therefore this diff adds a config option to disable such feature.

The ideal state is the bookmark logic in exchange writes remotenames directly,
instead of silently ignoring it. But that's a risky and larger change. My
expectation is, the remotenames extension will be enabled and take care of the
rest.

The idea of not writing local bookmarks come from markbt.

Reviewed By: DurhamG

Differential Revision: D19148278

fbshipit-source-id: a03eac68378908586d6e6848ed43532c0aab06c3
2019-12-20 16:14:19 -08:00
Durham Goode
ff41e331e0 convert: remove tags from convert
Summary:
A future diff will remove the tags feature. Convert uses tags heavily
and it breaks a number of tests, so let's remove tags from the convert extension
before we remove tags entirely.

Reviewed By: quark-zju

Differential Revision: D19043330

fbshipit-source-id: 628d27fea1601931da45d1280eff981c5d12f93c
2019-12-20 16:14:19 -08:00
Jun Wu
245f179697 scratch: drop dependency on telemetry
Summary:
The buck generated binary is 1.2GB in size. Drop dependency to reduce the size.
Dependent functions are re-invented.

New size is 31MB under `mode/opt` build, and 28MB under `mode/dev` build.

Reviewed By: wez

Differential Revision: D18900827

fbshipit-source-id: 536fa969d69f6261d812c2320795780d839b6ced
2019-12-20 16:14:19 -08:00
Durham Goode
218c83d574 tags: remove tip tag
Summary:
In a future diff we'll be removing tags. The most prevalent tag is
'tip', which shows up in a ton of test output. Let's drop that tag first, so we
can safely update the tests before we drop tags entirely.

Reviewed By: xavierd

Differential Revision: D18995058

fbshipit-source-id: 8c63710cd4ed567ea24e32724b8660f9006a61f1
2019-12-20 16:14:19 -08:00
Durham Goode
e1c73204f6 drawdag: use bookmarks instead of tags
Summary:
A future diff will remove tags entirely, so let's move drawdag to be
bookmark based.

Reviewed By: quark-zju

Differential Revision: D18995059

fbshipit-source-id: 70ef67259b37ef9821009d0145aa1e03c09b1309
2019-12-20 16:14:18 -08:00
Durham Goode
5feb7fd641 split: add more granular transactions
Summary:
Rolling back the entire transaction can causes Eden to get out of sync
with Mercurial and cause hangs. It can also causes users to lose the work
they've done splitting the commit.

Let's change split to commit the transaction after every commit. If a user exits
mid-split they will now be left in a state where the splits they've done so far
are still present, and we print a message telling them how to roll all the way
back if they want to.

Reviewed By: quark-zju

Differential Revision: D19114546

fbshipit-source-id: b67d5543f9c23a6299f4164c73662759661f59a9
2019-12-20 16:14:18 -08:00
Chad Austin
a5cbdfeb1d remove the dead getChildByName function
Summary: #deadcode

Reviewed By: genevievehelsel

Differential Revision: D18822498

fbshipit-source-id: fd2dc63139758121c27a877e37c8e1aaf7f9c9b5
2019-12-20 16:14:18 -08:00
Chad Austin
844b569d2a make EdenMount::getRootTree return a future
Summary:
EdenMount offered both getRootTree and getRootTreeFuture. Replace the
former with the latter and adjust remaining callers.

Reviewed By: genevievehelsel

Differential Revision: D18666585

fbshipit-source-id: 961361a1fb545e48db0ece970bb5e6ffbca8efef
2019-12-20 16:14:18 -08:00
Chad Austin
b75b10bc33 kill ObjectStore::getBlobMetadata
Summary:
The last remaining user of ObjectStore::getBlobMetadata was a debug
Thrift call. Remove it and update the Thrift call to use getBlobSize
and getBlobSha1.

Reviewed By: pkaush

Differential Revision: D18663376

fbshipit-source-id: 86baefc9004a07aac4ddf5849870431be04c75f2
2019-12-20 16:14:18 -08:00
Jun Wu
fd5cb6e225 bindings: allow Python threads during indexedlog repair
Summary: This should allow us to show a spinning progress bar when repair() is working.

Reviewed By: xavierd

Differential Revision: D19056949

fbshipit-source-id: 8e058bad002bb2de29dbf8457bead0ebd1e99372
2019-12-20 16:14:18 -08:00
Chad Austin
e092f4ef1a fix warnings in the macOS build
Summary: Fix some warnings that only show up in the macOS build.

Reviewed By: fanzeyi

Differential Revision: D19053236

fbshipit-source-id: 81f7187b263e0db6a57582677088519f9b97f1d7
2019-12-20 16:14:17 -08:00
Chad Austin
11589b3595 enable and fix more warnings
Summary: Enable a couple nice-to-have warnings.

Reviewed By: simpkins

Differential Revision: D18800030

fbshipit-source-id: 5bca073c6dd0b2d40ba8c2c9725fe152f20042a5
2019-12-20 16:14:17 -08:00
Jun Wu
79670ae429 phases: make listkey not crash with narrow-heads=true
Summary:
The current code crashes with `phaseroots` being an unknown attribute.

Reported By: DurhamG

Reviewed By: DurhamG

Differential Revision: D19048762

fbshipit-source-id: f59764ec04284cd643fbb5a3c319868df06c4912
2019-12-20 16:14:17 -08:00
Igor Sugak
e3af371ba6 move cram from xplat/third-party to third-party
Reviewed By: pixelb

Differential Revision: D16871214

fbshipit-source-id: 3c7a4d1bf936a55c926e0507ae52a41ebc547032
2019-12-20 16:14:17 -08:00
Jun Wu
5227c3c9a4 dispatch: preimport more modules for chg server
Summary: There are some modules missed in the preimport list. Add them.

Reviewed By: xavierd

Differential Revision: D18957117

fbshipit-source-id: 254384f0bcafd52421fb22dc696b3a6a1fb98537
2019-12-20 16:14:17 -08:00
Jun Wu
780faa2c10 tests: replace print in debugshell with ui.write
Summary:
Similar to D18926784.

Mercurial makes sure content written by `ui.write` is flushed, while there is
no such guarantee for `print`. When running using chg, it's more likely that
`print` content gets disappeared. Therefore let's use `ui.write` instead.

Reviewed By: ikostia

Differential Revision: D18926983

fbshipit-source-id: 960c189cc48bc3c89bb4f7993d2033dd45c52a67
2019-12-13 10:30:39 -08:00
Mateusz Kwapich
7e0e170db9 rename fbconduit extension to fbscmquery
Summary:
This is mostly result of:
```
  find . -type f -exec sed -i "s/fbconduit/fbscmquery/g" {} \;

```
`fbconduit` extension doesn't use conduit anymore so the name is just misleading.

Reviewed By: ikostia

Differential Revision: D18748843

fbshipit-source-id: 0d59e61ba7a96d86d9d1333d81255108cc3141bc
2019-12-13 03:23:25 -08:00
Xavier Deguillard
828f5b487d tests-flagprocessor.t: fix it
Summary: This looks like a fallout of D18666054

Reviewed By: quark-zju

Differential Revision: D18992910

fbshipit-source-id: c2392553a0489097f82b4073bbbca37b43f53bba
2019-12-12 20:36:43 -08:00
Xavier Deguillard
e7a3859828 convert: disable "getting files" progress bar
Summary:
This is showing in profile for about 10% of the time, let's just disable it as
getting files should be fairly quick.

Reviewed By: quark-zju

Differential Revision: D17841315

fbshipit-source-id: 08a61e19351fb5217431a3ca8993b8074f6d6c74
2019-12-12 14:15:05 -08:00
Xavier Deguillard
81365e9e9f localrepo: use repo.commitpending in repo.commitnotransaction
Summary:
There is no need to duplicate the code.

The test change are due to commitpending being called 3 times, vs 1 before. The
total amount of times {fileslog,manifestlog}.commitpending is called is unchanged.

Reviewed By: quark-zju

Differential Revision: D17841316

fbshipit-source-id: be33a126f913af8824a6d5ade17351707d39ed2f
2019-12-12 14:15:05 -08:00
Jun Wu
cf8efdb0d2 ui: use smarttraceback
Summary: The smart traceback is generally more useful.

Reviewed By: markbt

Differential Revision: D18666054

fbshipit-source-id: a96bb3e2919ed6692c4a7b965ad74cd2c8a66241
2019-12-12 13:47:49 -08:00
Adam Simpkins
1ec027f5bc add type annotations to mercurial/commands/eden.py
Summary: Add type annotations to all functions in this file.

Reviewed By: xavierd

Differential Revision: D18949804

fbshipit-source-id: 4ac1789aa086e9e5f2397bc005a33cfb2f6c0b56
2019-12-12 12:48:50 -08:00
Xavier Deguillard
f0bf034842 test-check-code: use glob for st_*time error
Summary: This keep failing due to single line changes. Let's make it more robust.

Reviewed By: kulshrax

Differential Revision: D18963816

fbshipit-source-id: c56748560b619c4c682e8cc9e5710c607aa363fb
2019-12-12 11:41:22 -08:00
Adam Simpkins
264f6565f6 make the EdenFS tree prefetch depth configurable
Summary:
D18263067 updated the `CMD_FETCH_TREE` handler to fetch tree with a depth
of 1, rather than using fetching the entire recursive tree structure.
I think this has contributed to some of the recent user-reported slowness for
fetch operations, as fetching a large directory structure now triggers many
more individual requests for each separate tree.

This diff adds a configuration parameter to control the tree fetch depth.  I
have set the default value at 3, which should hopefully provide a reasonable
level of tree prefetching without completely fetching all contents of deep
trees.

Reviewed By: wez

Differential Revision: D18942585

fbshipit-source-id: 6a8d749434520baee25a4277712c44b916adcb3f
2019-12-11 20:54:55 -08:00
Jun Wu
c745d644d9 doctor: fix incorrect repair on indexedloghistorystore
Summary:
I made a mistake when editing the last version of the code. It uses
indexedlogdatastore to repair indexedloghistorystore, which is incorrect.
Fix it.

Reviewed By: xavierd

Differential Revision: D18945952

fbshipit-source-id: addec020c761e6c11d2fe485eb408f5b200afb08
2019-12-11 17:34:44 -08:00
Genevieve Helsel
03a5d9664d takeover documentation
Summary: This is some documentation I've taken while studying the `Takeover.*` classes. It could be helpful to live in this folder for future reference. If I missed anything or misrepresented anything, please let me know! I plan to keep this updated as changes are made to files in this folder.

Reviewed By: simpkins

Differential Revision: D18868291

fbshipit-source-id: 8fc65dd3dd6f1b5bcc344b5f4c2b5b9ceb11ed17
2019-12-11 16:59:35 -08:00
Jun Wu
ab69de6a14 util: improve smarttraceback
Summary:
Make util.smarttraceback:
- Support `traceback` object.
- Look more similar to normal traceback (headers, and indentation).
- Hide boring content.
- Show binary hashes in hex form.

Reviewed By: markbt

Differential Revision: D18666055

fbshipit-source-id: d61446604c673ec5e1a96912fa29935d4238ecc9
2019-12-11 16:34:33 -08:00
Jun Wu
efa601b19e snapshot: make import side-effect free for chg compatibility
Summary:
See also D5271419. Decorators in `bundle2` and `exchange` are not side-effect
free. Move them to `uisetup` for better chg compatibility.

Reviewed By: StanislavGlebik

Differential Revision: D18926786

fbshipit-source-id: 2a3fa6ed4cef42c9bad4666ff75496d483991f88
2019-12-11 15:45:23 -08:00
Jun Wu
b72f3479fd infinitepush: make import side-effect free for chg compatibility
Summary:
See also D5271419. Decorators in `bundle2` and `exchange` are not side-effect
free. Move them to `uisetup` for better chg compatibility.

Reviewed By: StanislavGlebik

Differential Revision: D18926782

fbshipit-source-id: b99e2882cb6530a648a065c6d739ee9a7aebb851
2019-12-11 15:45:23 -08:00
Jun Wu
652cc9c160 gitlookup: make import side-effect free for chg compatibility
Summary:
See also D5271419. Decorators in `bundle2` and `exchange` are not side-effect
free. Move them to `uisetup` for better chg compatibility.

Reviewed By: StanislavGlebik

Differential Revision: D18926783

fbshipit-source-id: 9855b8debe3f809139a9fc3c6eea2775a1562cfd
2019-12-11 15:45:23 -08:00