Commit Graph

1501 Commits

Author SHA1 Message Date
Jun Wu
cb3b437fe5 phrevset: improve sucessor calculation
Summary:
Currently, phrevset picks the "successor" that has the maximum revision
number. That depends on the assumption that larger revision numbers
are modified last. Howevver, that's not always true with commit cloud sync. For example, in my repo I have D21179514 modified from 63768bf43
to 684612d5d. Phabricator has 63768bf43. Local successor is 684612d5d,
but the revision number of 684612d5d is smaller than 63768bf43:

    quark@devvm1939 ~/hg/edenscm/hgext % hg log -r 'D21179514'
    changeset:   63768bf436d01982a8d42ce97160ac6d9ae2cdad  D21179514
    user:        Jun Wu <quark@fb.com>
    date:        Wed, 22 Apr 2020 09:45:50 -0700
    summary:     [hg] commitcloud: log metalog root during update references

    quark@devvm1939 ~/hg/edenscm/hgext % lhg log -r 'D21179514'
    changeset:   684612d5d606b01c224889f2b3f87aff7b93db49  D21179514  (@)
    user:        Jun Wu <quark@fb.com>
    date:        Wed, 22 Apr 2020 10:10:37 -0700
    summary:     [hg] commitcloud: log metalog root during update references

    quark@devvm1939 ~/hg/edenscm/hgext % lhg log -r 'successors(63768bf436d0198
    2a8d42ce97160ac6d9ae2cdad)' -T '{node} {rev}\n'
    684612d5d606b01c224889f2b3f87aff7b93db49 76718
    63768bf436d01982a8d42ce97160ac6d9ae2cdad 95363

Improve it by actually prefer selecting a non-obsoleted successor.

Reviewed By: sfilipco

Differential Revision: D21267552

fbshipit-source-id: d43d72a7c273c55af70bb41ad967fff0c78a452a
2020-05-06 15:29:56 -07:00
Jun Wu
e1179f695e autopull: pull names in batch
Summary: This is more efficient (if pullattempts have high chance to succeed).

Reviewed By: sfilipco

Differential Revision: D21320627

fbshipit-source-id: a2166f5a59f98c7d705c806b9d152ceb9981f3be
2020-05-06 15:29:55 -07:00
Jun Wu
e89e16d35c autopull: make autopull function declarative
Summary:
Make it so that the autopull functions just describe what to do (using the
`pullattempt` struct) instead of having the side effect directly. This will be
useful in multiple cases:
- The actual autopull logic becomes easier to implement.
- The revset autopull layer can merge `pullattempt`s to fetch things in one go.
- The `pull -r` logic can reuse the `pullattempt`s to translate what to pull
  (ex. from `D1234` to a commit hash).

This has subtle changes that multiple "remote"s are no longer properly
supported.  That is probably fine in our production use-cases but we might
want to revisit if we want to support remotes "properly".  Currently, this
greatly simplifies things due to the fact that "infinitepush" or
"infinitepushbookmark" have to be used in certain cases.

Reviewed By: sfilipco

Differential Revision: D21320633

fbshipit-source-id: e38b68abf69a34a97431685aa7ab0d2fe022fda8
2020-05-06 15:29:55 -07:00
Jun Wu
1ee6f1f91a registrar: add autopullpredicate
Summary: Add a way for extensions to register how to auto pull unknown names.

Reviewed By: sfilipco

Differential Revision: D21320630

fbshipit-source-id: d20e11cff83b8a7e15a5085b0508a3e5bef305c3
2020-05-06 15:29:55 -07:00
Jun Wu
a5c1b003a3 autopull: move to a module
Summary:
We're going to make autopull more complicated. Move it to a separate module as
it is not directly related to revset.

Reviewed By: sfilipco

Differential Revision: D21320631

fbshipit-source-id: fe60bc53ebf1c75f8bf66156805cbe2801fe6532
2020-05-06 15:29:54 -07:00
Jun Wu
a71893676d autopull: analyze unknown names before revset optimization
Summary:
The revset optimization makes unknown names harder to extract.  For example,
`(or (list "a" "b" "c"))` will be optimized to `(_list "a\0b\0c")` and it
becomes harder to extract `"a"`, `"b"`, and `"c"`.

Move the unknown name extraction logic to before the optimization step to solve
it.

Reviewed By: sfilipco

Differential Revision: D21320632

fbshipit-source-id: 3a25f1cf4aab0449be6952113d622f29b1c0b631
2020-05-06 15:29:54 -07:00
Jun Wu
44c8c7a9e3 transaction: write hgrc to metalog
Summary:
This allows us to understand what config is used during a transaction.
For example, is `selectivepull` enabled during a `pull`?

Reviewed By: DurhamG

Differential Revision: D21222146

fbshipit-source-id: a8c82f2b02e9657885947a706f728e28b1bfc1e2
2020-05-06 12:15:36 -07:00
Durham Goode
1fdc23ddf6 progress: invalidate engine on process fork
Summary:
We're seeing deadlocks where if the process forks (like in a update
worker) while a background python thread is holding the progress lock, it can
cause a deadlock in the forked process if the thread ever tries to access the
progress bar.

To fix it, let's invalidate the engine if the process forks.

Reviewed By: xavierd

Differential Revision: D21415152

fbshipit-source-id: 75607dd2c1ed122b3a9df68d359ba9dcdde78a77
2020-05-06 12:01:39 -07:00
Durham Goode
aa99e36327 configs: convert (www|www-merge)_overrides.rc
Summary: Converts (www|www-merge)_overrides.rs to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21412128

fbshipit-source-id: d248d3b756e4f59038cb33335ba4a023fe335b2c
2020-05-06 09:03:18 -07:00
Durham Goode
939ff6c956 configs: move repo names to a enum
Summary:
A number of repo names are used quite frequently. Let's use an enum to
prevent typos and make things cleaner.

Reviewed By: quark-zju

Differential Revision: D21365036

fbshipit-source-id: 1d3d681443df181e9076f5ee87029ae61124a486
2020-05-06 09:03:17 -07:00
Mohan Zhang
2ef3e20e4d Run auto cargo locally
Summary: Since thirdpart depedency change on D21341319

Reviewed By: jsgf, wqfish

Differential Revision: D21417890

fbshipit-source-id: 3cc6bafa23512c7ae489513216bcafa46e7a744f
2020-05-05 20:59:02 -07:00
Zeyi (Rice) Fan
952069397c fix get blob local
Summary: This bug got in while iterating the original Diff. It should only be returning empty when the blob does not exist locally.

Reviewed By: xavierd

Differential Revision: D21417659

fbshipit-source-id: 676e22313ab4a024af5341d8c99797fc062bd293
2020-05-05 20:21:21 -07:00
Durham Goode
022196d3b7 configs: convert instagram-server_overrides.rc
Summary: Converts instagram-server_overrides.rc to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21339855

fbshipit-source-id: 1cd4709c1f239322de3ccf516c4ebef519ea41ac
2020-05-05 18:19:11 -07:00
Durham Goode
726e3f6a73 configs: convert configerator_overrides.rc
Summary: Converts configerator_overrides.rc to our dynamic config generator

Reviewed By: quark-zju

Differential Revision: D21339856

fbshipit-source-id: 84bd17d04db1a2e6070eb5e75bda668a596822d4
2020-05-05 18:19:11 -07:00
Durham Goode
97d84e3b5d configs: move hgrc.dynamic to always be in the shared repo
Summary:
Instead of trying to maintain two hgrc.dynamic's for shared repositories,
let's just always use the one in the shared repo. In the long term we may be
able to get rid of the working-copy-specific hgrc entirely.

This does remove the ability to dynamically configure individual working copies.
That could be useful in cases where we have both eden and non-eden pointed at
the same repository, but I don't think we rely on this at the moment.

Reviewed By: quark-zju

Differential Revision: D21333564

fbshipit-source-id: c1fb86af183ec6dc5d973cf45d71419bda5514fb
2020-05-05 18:19:10 -07:00
Durham Goode
c326c5fc6b configs: log dynamic config mismatches to scuba
Summary: Let's log the mismatches to scuba so we can track them down.

Reviewed By: quark-zju

Differential Revision: D21313255

fbshipit-source-id: ee79c9504a80ebe5b21849c0eae5993b65eaff28
2020-05-05 18:19:10 -07:00
Durham Goode
b9223b9db6 sampling: move ui.log sampling logic to core
Summary:
In a future diff we want to log information about configuration
mismatches. In order to do that, we need to be able to call ui.log before
extensions are setup. Let's move the ui.log sampling logic into core so it can
be called before extension setup.

Reviewed By: quark-zju

Differential Revision: D21313257

fbshipit-source-id: fe1c0f572720c17e7398f2a4fa7082ef8fb59536
2020-05-05 18:19:09 -07:00
Durham Goode
ece8408993 configs: migrate devserver_no_sandcastle_overrides.rc
Summary:
Moves the conditional configuration from
devserver_no_sandcastle_overrides.rc into our dynamic config fb rules.

Reviewed By: quark-zju

Differential Revision: D21310916

fbshipit-source-id: 116711afbfa9fb9f134bbe55b7b8b302b39dab36
2020-05-05 18:19:09 -07:00
Durham Goode
e67d609e1d configs: validate dynamic configs
Summary:
Adds python logic for validating the dynamic configs. Any dynamic
configs that don't match the given list of rc files will be reported and removed

Reviewed By: quark-zju

Differential Revision: D21310919

fbshipit-source-id: 07f584bba990f1b01347dfbc285e3ca814fe5c5a
2020-05-05 18:19:09 -07:00
Durham Goode
6e7f85b949 config: load .hg/hgrc.dynamic
Summary:
Adds .hg/hgrc.dynamic to the default load path, before .hg/hgrc though,
so it can be override.

Reviewed By: quark-zju

Differential Revision: D21310921

fbshipit-source-id: 288a2a2ba671943a9f8532489c29e819f9d891e1
2020-05-05 18:19:08 -07:00
Durham Goode
dc90e2ca04 configs: add domain, platform, and improve dynamicconfigs
Summary:
Adds dynamic config conditionals for domain, platform, and adds a few
useful helper functions.

Reviewed By: quark-zju

Differential Revision: D21310920

fbshipit-source-id: 58f35e52d6d7a4edae2b3aefff533ef2c021aa57
2020-05-05 18:19:08 -07:00
Durham Goode
8744b81151 git: update git dependency to 0.13.5 to match internal version
Summary:
Our internal git dependency got upgraded, so we need to upgrade our
Cargo.toml version.  Unfortunately this doesn't seem to have any test coverage?

Reviewed By: singhsrb

Differential Revision: D21410241

fbshipit-source-id: 64fe7f39a9c93aa5d97ce095ee1641c1cc6ed365
2020-05-05 15:35:12 -07:00
Durham Goode
1cd598279e backout D21348756 about printing progress of downloads
Summary:
The formatter is broken, it prints to stdout which breaks json output,
and it's questionable whether we want a new line printed to the user for every
200k files downloaded.

Reviewed By: quark-zju

Differential Revision: D21409529

fbshipit-source-id: 2a5d94f8fcc62dbe25f0aae5453e4664c49fdcb2
2020-05-05 14:33:22 -07:00
Chad Austin
8b5c1e66b7 remove stats memory command
Summary:
`eden stats memory` was never useful because it shows system
statistics which you can get better from `top`, `htop`, or `atop`.

Reviewed By: genevievehelsel

Differential Revision: D21392737

fbshipit-source-id: 010021b8a97bd8ba8ac289d906acc3c3ecd10768
2020-05-05 12:09:11 -07:00
Zeyi (Rice) Fan
3baa8cc9b4 check if the blob fetching is present locally
Summary:
Talked with xavierd last week and we can use LocalStore's `get_missing` to determine if a blob is present locally. In this way we can prevent the backingstore crate from accidentally asking EdenAPI for a blob, so better control at EdenFS level.

With this change, we can use this function at the time where a blob import request is created with confidence that this should be short cheap call.

This diff should not change any behavior or performance.

Reviewed By: xavierd

Differential Revision: D21391959

fbshipit-source-id: fd31687da1e048262cb4eae2974cab6d8915a76d
2020-05-05 11:14:40 -07:00
Durham Goode
1da0256921 discovery: use the latest commits for discovery instead of random ones
Summary:
When doing discovery, for repos with long master lines and infrequent
branches, picking a random set of sample commits could result in not picking the
master, and therefore having to do very long commit graph traversals to check
ancestors against the other samples.

To prevent this, let's pick the N most recent commits instead of a random
sample. This should generally get the master commit into our sample.

Reviewed By: quark-zju

Differential Revision: D21394302

fbshipit-source-id: f4b8110cd126b90553ec624e48cab0b590e124fb
2020-05-05 09:56:26 -07:00
Shannon Zhu
83dc7b9129 Custom pyre upgrade for eden
Summary:
Addressing issues simpkins brought up on D21207287 when we upgraded and introduced some pyre bugs.

Temporarily upgrading just this project, once we resolve some sandcastle capacity issues we'll release this via another global upgrade in fbcode.

Reviewed By: simpkins

Differential Revision: D21316793

fbshipit-source-id: f0c79f53d97f7182e7d8fe6e081c58ef53ce0c9a
2020-05-04 21:19:20 -07:00
Zeyi (Rice) Fan
da28f5a5b1 revisionstore: create directory with group share permission in correct places
Summary: When we create directory at certain places, we want these directories to be shared between different users on the same machine. This Diff uses the previously added `create_shared_dir` function to create these directories.

Reviewed By: xavierd

Differential Revision: D21322776

fbshipit-source-id: 5af01d0fc79c8d2bc5f946c105d74935ff92daf2
2020-05-04 19:21:33 -07:00
Shannon Zhu
0b93429dc1 Convert type check targets in eden to use configuration
Summary:
D21316793 is blocked from landing because there are a few targets in eden that are running pyre via buck targets integration.

We can't do custom version overrides for projects that are using a mix of local configurations and buck integration, because buck doesn't provide an interface for setting the equivalent pyre version override.

We're moving away from buck targets integration for pyre across the board, and I've run a codemod over the project to clean up all of the buck typing integration (including some residual mypy) as well as updated type ignores / fixmes accordingly.

Let me know if you have any concerns; upon skimming it looks like most changes are either converting `type: ignore`s into fixmes, or removing `type: ignores`.

Reviewed By: dkgi

Differential Revision: D21343093

fbshipit-source-id: 5ee1436377eb526c0a679fb821c42e07cbca52a5
2020-05-02 21:16:55 -07:00
Jun Wu
6438f28e99 color: detect ConEmu and limit colors to 16
Summary:
ConEmu tries to normalize 256 colors to 16 colors but its normalization logic
is buggy. For example, color196 gets normalized to green instead of red. See
the attached picture of ConEmu and its debug real console.

{F235735030}

Reviewed By: markbt, ikostia

Differential Revision: D21311443

fbshipit-source-id: cb6db07d6b10a7365e33f4aa8f5f3f61f90c8e69
2020-05-01 14:51:51 -07:00
Jun Wu
5b881f086f pyzstore: further reduce cpython_ext::Bytes usage
Summary: This avoids data copies.

Reviewed By: DurhamG

Differential Revision: D21213075

fbshipit-source-id: 9575173f163d71543affabd9861931c11086f40a
2020-05-01 14:24:52 -07:00
Jun Wu
73ff6559e6 zstore: add simple caching
Summary: Add simple caching so zstore can avoid some zstd calculation.

Reviewed By: DurhamG

Differential Revision: D21213076

fbshipit-source-id: 5e3152949cf4e6d6193c3ef3401f24e2efac5620
2020-05-01 14:24:52 -07:00
Durham Goode
3ac2be361a configs: move fbrules to a Facebook only part of the crate
Summary:
We'll be adding a bunch of Facebook specific configuration and values
here. Let's move it to someplace not open source.

Reviewed By: quark-zju

Differential Revision: D21241038

fbshipit-source-id: 2ac9cdce40b1b46f15f171d9d1f6b6692dcd29bf
2020-05-01 13:17:21 -07:00
Durham Goode
b1a2785a19 configparser: add ensure_location_supersets function
Summary:
Implements an ensure_location_supersets function who's goal is to
verify that a given config location specifies the exact same configs as a given
set of other locations. Any inconsistencies are removed from the config and
reported to the caller.

This will be used to ensure our dynamic configs match our existing rc file
configs exactly, before we delete the file configs.

Reviewed By: quark-zju

Differential Revision: D21240837

fbshipit-source-id: e2c8ec054a3696d2cf02e65c212ad886c5117253
2020-05-01 13:17:21 -07:00
Mark Thomas
ed49d36d41 templatekw: parents template should not return null p2
Summary:
The `parents` template currently returns "meaningfulparents".  This sometimes
returns the null revision as the second parent, making templates think this is a
merge commit when it is not.  Make sure we filter this out.

Reviewed By: quark-zju

Differential Revision: D21347776

fbshipit-source-id: af83fd5cff381850ac39d97b5b2f4c77033fe2fb
2020-05-01 12:49:37 -07:00
Jason White
d5b2fb798e Fix outdated Cargo.toml files
Summary: `cargo autocargo` should normally produce no changes on `master`. The features of the `log` crate was updated in D21303891 without re-running autocargo. This fixes it.

Reviewed By: dtolnay

Differential Revision: D21349799

fbshipit-source-id: ce487bc5989e179673297350249593103b4d34dd
2020-05-01 10:29:33 -07:00
Stanislau Hlebik
bec619bc5e remotefilelog: print the progress when downloading files
Summary:
Now we download files in 200K chunks, and it might be confusing - it's unclear
whether hg is making any progress or not.
This diff makes it clearer.

Note I'm not printing progress before first fetch to avoid breaking the tests

Reviewed By: farnz

Differential Revision: D21348756

fbshipit-source-id: 05e5169114adf2b99a74b37d933755a644214a42
2020-05-01 07:56:26 -07:00
Kostia Balytskyi
b17df254d7 infinitepush: do not record crossbackendsync bundles
Summary: Mercurial Infinitepush normally records received bundles into the `forwardfillerqueue`, which is later tailed by the commit cloud `forwardfiller` in order be replayed onto Mononoke. Now I am adding a reverse filler, which means that we will have two such queues and sync in two directions. Therefore, in order to avoid infinite loops we need to distinguish cross-backend bundle replay from genuine pushes. I propose to use `crossbackendsync` bundle2 param to indicate that no recording is needed.

Reviewed By: krallin

Differential Revision: D21255446

fbshipit-source-id: 70f6efe1331bd3c7fd3aca61d486d350d93086dc
2020-05-01 06:46:50 -07:00
Stanislau Hlebik
03023aa095 commit cloud: fix hg cloud --help
Summary:
Previously we weren't showing help at all when running "hg cloud --help". This
diff should fix it

Reviewed By: ikostia

Differential Revision: D21347825

fbshipit-source-id: 1d9d11e2f9fe18a03b5d2cd8bd316fe9a218347c
2020-05-01 06:08:14 -07:00
Adam Kramer
05f7469a84 Make graph renderer link command-clickable
Summary:
In vs-code if you have a well-formed url you can command-click it
to open it, e.g., when you see it in your terminal. But this URL is not
well-formed because it's missing the protocol. So let's add it.

Reviewed By: quark-zju

Differential Revision: D21336742

fbshipit-source-id: dd2de2d5177d3a2542c4a22f0099f28b97c79d06
2020-04-30 23:59:36 -07:00
Kostia Balytskyi
9b914911f6 infinitepush: do not read the whole file to check size
Summary: If the bundle file has 1G in size, we probably don't want to waste 1G of memory just to see that it is too big.

Reviewed By: markbt

Differential Revision: D21177359

fbshipit-source-id: 026b5ab40e6dbddba3d7142a8e34256d127bf82c
2020-04-30 13:00:22 -07:00
Kostia Balytskyi
e016ea16a2 commit cloud forwardfiller: add a test to exercise the flow
Summary:
Building on the previous two commits, this adds a test which performs the following steps:
- does an infintiepush push to a Mercurial server
- looks into the `forwardfillerqueue`
- runs commitcloud forwardfiller's `fill-one` to replay the bundle to Mononoke
- verifies that this action causes the commit to appear in Mononoke

As this test uses `getdb.sh` from Mercurial test suite, it needs to be whitelisted from network blackholing (Note: we whitelist mononoke tests, which run with `--mysql` automatically, but this one is different, so we need to add it manually. See bottom diff of the stack for why we don't use `--mysql` and ephemeral shards here).

Reviewed By: krallin

Differential Revision: D21325071

fbshipit-source-id: d4d6cbdb10a2bcf955ee371278bf2bbbd5f5122c
2020-04-30 13:00:22 -07:00
Kostia Balytskyi
5041433ad6 tests: make hgsql and infinitepush libraries usable from Mononoke
Reviewed By: krallin

Differential Revision: D21303956

fbshipit-source-id: 61c3eaf5235f55636fd5b5c8d9ac899f39691d9d
2020-04-30 13:00:22 -07:00
Mark Thomas
ff08b99c08 remotenames: hide unwanted commits after clone with selectivepull
Summary:
Cloning a repository with selectivepull enabled temporarily disables
selectivepull for the duration of the initial pull so that we can get a
streaming clone.

Once this is done, hide all of the commits in the repository by clearing the
visible heads.  Selective pull will then populate the remote bookmarks with the
public heads that we do want.

Reviewed By: quark-zju

Differential Revision: D21301037

fbshipit-source-id: 565ae50439ed5405ce940a5675caeba912fe7083
2020-04-30 05:44:04 -07:00
Mark Thomas
ac62d5b52c commitcloud: allow omission of remote bookmarks
Summary: If a scratch remotebookmark points to a draft commit that is not available locally (i.e., has been hidden on a different machine), then don't pull it into the local repository.  Instead, just omit the remote bookmark.

Reviewed By: quark-zju

Differential Revision: D21287886

fbshipit-source-id: 84e7c6b52250709f7c88b07fccdbb61e044370c8
2020-04-30 05:44:03 -07:00
Mark Thomas
e025e68e33 commitcloud: allow sync to delete remote bookmarks
Summary:
Rewrite `_processremotebookmarks` to allow sync operations to delete
remote bookmarks.

Reviewed By: quark-zju

Differential Revision: D21283026

fbshipit-source-id: 7ded1d1cfb725f4b60ad2d55cf7d102c91113d6a
2020-04-30 05:44:03 -07:00
Mark Thomas
a4648a7805 remotenames: don't remove selectivepull subscriptions on push
Summary:
Selective pull subscripts are lost during a push.  This is because
`remotenames.expush` calls `selectivepullbookmarknames` with the
remote, not the remote name.

`remotenames.exclone` does the same, but in that case there is
no need for the remote name as the destination can't have any
subscriptions other than the default set.

Reviewed By: quark-zju

Differential Revision: D21283029

fbshipit-source-id: 52c2e7e301b8e95b4a252cbfe2ad9de168e81044
2020-04-30 05:44:02 -07:00
Mark Thomas
da9e7b2264 commitcloud: add test demonstrating bugs in remotebookmarkssync
Summary:
Commit cloud remote bookmarks sync has several edge cases that don't work correctly.

This test demonstrates some that we will fix.

Reviewed By: quark-zju

Differential Revision: D21283028

fbshipit-source-id: 4e746476a0f3bf0ca7d7088f510451632a2ee075
2020-04-30 05:44:02 -07:00
Zeyi (Rice) Fan
8830ed55df util: not try to create the directory when it already exists
Summary: Fix permission issues we are seeing with the latest Mercurial release.

Reviewed By: xavierd

Differential Revision: D21294499

fbshipit-source-id: bcfb13dd005258b2e3b74fa281dbd8df36133ef6
2020-04-28 20:33:59 -07:00
Carolyn Busch
4eeab3b81b Update cpython to 0.5
Summary:
D21270958 updated the cpython, python27-sys, and python3-sys crates to 0.5. Update
the Mercurial cargo dependencies to match.

Reviewed By: xavierd

Differential Revision: D21281875

fbshipit-source-id: ccad68749a25d11240351b5faeef27cb9c693456
2020-04-28 11:47:41 -07:00