Commit Graph

206 Commits

Author SHA1 Message Date
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
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
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
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
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
Jun Wu
cdc42a94d1 pushrebase: 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: D18926787

fbshipit-source-id: cfbf8de6d8c841478d7aa3de180a0816349fa4e4
2019-12-11 15:45:22 -08:00
Xavier Deguillard
291db4b116 tests: fix test-fb-hgext-treemanifest.t
Summary: This looks like an omission from D18912817

Reviewed By: mitrandir77, ikostia

Differential Revision: D18935510

fbshipit-source-id: f72d95155c54d7eb36ff7c868f5e6b0ff6d6e39c
2019-12-11 10:20:59 -08:00
Mark Thomas
23fe5a7780 reset: add visibility tracking support
Summary:
The `reset` extension does its own obsmarker creation, rather than going
through `scmutil.cleanupnodes`.  This means it doesn't support new-style
visibility tracking.

Fix this by making it use `scmutil.cleanupnodes`.  This isn't completely
straightforward:

* The revset it uses to work out what to prune might accidentally include
  public commits (e.g. when you reset to a different public branch).  Make sure
  these are filtered.
* The tests originally had strip and obsmarker based tests.  The strip tests,
  when converted to obsmarkers and using `scmutil.cleanupnodes` stop working
  because they strip and revive the same commit over and over, which is an edge
  case that obsmarkers can't handle well.  Fix this by restoring the strip tests
  as strip tests.  A separate test handles the new-style visibility.
* Reset's behaviour is still a bit wonky.  If an ancestor of the source commit
  has other (non-bookmarked) descendants, then reset will try to prune those
  commits.  New-style visibility will ignore this, and this is tested in the
  new test.

Reviewed By: farnz

Differential Revision: D18912817

fbshipit-source-id: cc115333407cf67d339c24fcd0807ddedce2660d
2019-12-11 03:49:38 -08:00
Jun Wu
20c87ae2db demandimport: blacklist windll
Summary:
This solve the following issue when running on devserver with demandimport enabled:

  In [1]: ui.config?
  abort: No module named windll!

Reviewed By: xavierd

Differential Revision: D18898009

fbshipit-source-id: bf4f3b12ac6f0a1628ed8ef805f6843868363542
2019-12-10 17:53:39 -08:00
Jun Wu
27a1ffa9d1 tests: fix test-doctor.t on Windows
Summary:
On Windows the error message is different. In this test we only need to verify
a command fails. Therefore remove the output and only keep the exit code.

Reviewed By: xavierd

Differential Revision: D18915580

fbshipit-source-id: bd1031170335918d507e6225b02541ec52bc62fa
2019-12-10 14:45:43 -08:00
Zeyi (Rice) Fan
ecfc387fe6 backingstore: optionally create EdenApiRemoteStore
Summary: This diff makes EdenFS to be able to use EdenApi to import blobs and trees when requested objects are not present in local hgcache.

Reviewed By: chadaustin

Differential Revision: D18605547

fbshipit-source-id: 4acd2e07cfd9de6b6775ded30ea22a4478b9f1e4
2019-12-10 13:40:56 -08:00
Zeyi (Rice) Fan
2f15f80957 revisionstore: make EdenApiRemoteStore to be able to fetch trees from remote
Summary: This will allow us to use EdenApi in EdenFS to fetch trees and blobs.

Reviewed By: xavierd

Differential Revision: D18622844

fbshipit-source-id: 59a9091e9f2fdbcae078da2fb24ee9c0dd18505b
2019-12-10 13:40:55 -08:00
Zeyi (Rice) Fan
ae1dae6b96 eden: add experimental:use-edenapi for optionally turn on EdenApi importing
Summary:
Add an option `experimental:use-edenapi` to `EdenConfig`.

See the next diff for usage.

Reviewed By: chadaustin

Differential Revision: D18605549

fbshipit-source-id: 2786c21bb38a76229078662cc5c1ddf906d1be4a
2019-12-10 13:40:55 -08:00
Xavier Deguillard
d21a108280 tests: fix test-atomictempfile.py
Summary:
os.stat uses float values, use util.stat instead.

(Note: this ignores all push blocking failures!)

Reviewed By: singhsrb

Differential Revision: D18913982

fbshipit-source-id: 2df5ad0efbba3b18ef90669b4d1910ab39730e18
2019-12-10 11:57:12 -08:00
Stefan Filip
1d61f2dbfd manifest: add TODOs with ideas about improvements on Manifest
Summary: Ideas for improvements. Put them in the code for future consideration.

Reviewed By: quark-zju

Differential Revision: D18870140

fbshipit-source-id: a2a84d94d72303adc64614b06e36588ff7778aab
2019-12-10 10:18:19 -08:00
Stefan Filip
ef220f3f7c manifest: add the list method to the Manifest trait
Summary:
The list functionality is required by EdenFs. We want this functionality
to be well supported by the Manifest.

Reviewed By: quark-zju

Differential Revision: D18870143

fbshipit-source-id: 1ebaa713ff521226e6ace22cbd35cc841d967298
2019-12-10 10:18:19 -08:00
Stefan Filip
67b0e3a600 manifest: rename FsNode to FsNodeMetadata
Summary:
Consistency in naming. The general idea is to have Metadata types that don't
contain paths. Then we will have File, Directory and eventually FsNode that
will contain paths.

Reviewed By: quark-zju

Differential Revision: D18870141

fbshipit-source-id: a1f09add7f1c3dd4fa0348693cd3ce2fd5767fa7
2019-12-10 10:18:18 -08:00
Stefan Filip
05aa630a18 manifest-tree: rename Tree to TreeManifest
Summary:
This rename is going to make it easier to import and use outside of
manifest specific crates.

Reviewed By: quark-zju

Differential Revision: D18870142

fbshipit-source-id: 2f3ea460170308162ee834efc038b2dcedd9e233
2019-12-10 10:18:18 -08:00
Jun Wu
2781801365 doctor: attempt to fix mutationstore, metalog and allheads
Summary:
Since we got `repair` APIs in the Python land, use them to attempt to repair
things.

This would hopefully be able to fix some user-reported issues, usually
caused by hard reboots.

Reviewed By: xavierd

Differential Revision: D18737907

fbshipit-source-id: ef3deccbf4a1c959cff7e3eb78771acd9ae9bd01
2019-12-09 20:02:09 -08:00
Stefan Filip
ef336812a7 hggit: update dulwich usage to match 0.19+
Summary:
From Dulwich changelog:
0.19.0 2018-03-10
API CHANGES
GitClient.send_pack now accepts a generate_pack_data rather than a
generate_pack_contents function for performance reasons.

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D18901269

fbshipit-source-id: 9510b3a516cb2fcbeae9f1f2072d8445e442a9ed
2019-12-09 17:59:14 -08:00
Jun Wu
a3129104fe tests: fix buck run :run_tests
Summary:
`buck run :run_tests -- ...` was added to be a buck version of `run-tests.py`.
However it does not work because the watchman path provided was invalided.

Reviewed By: xavierd

Differential Revision: D18892361

fbshipit-source-id: 8745a33e0d19b14f042ef1cd255d10c5737dffb1
2019-12-09 15:26:30 -08:00
Jun Wu
75a8173a10 tests: enable chg for 572 tests
Summary:
Add `#chg-compatible` to 572 tests that seem to pass with chg enabled.
This should make them run faster.

Reviewed By: xavierd

Differential Revision: D18870507

fbshipit-source-id: fe895e733efffc9286cd3d17c7a156c803124395
2019-12-09 15:26:29 -08:00
Jun Wu
84a4da85ca metalog: implement bi-directional migration
Summary:
Previously, it's fine to migrate up to metalog, and fine to migrate down once
since we double write data. However, re-enabling metalog can be problematic
since there is no code path to do "migrate up" again.

This diff fixes the issue by tracking what files (or "keys") are using metalog
as the source of truth in metalog. So we can accurately figure out whether to
migrate svfs files to metalog on demand.

Reviewed By: xavierd

Differential Revision: D18864424

fbshipit-source-id: e61e1790c231f9c88de869f413f27bb954a29920
2019-12-09 14:18:18 -08:00
Jun Wu
d754747d01 bindings: add repair to structures
Summary: Expose the repair API to the Python world.

Reviewed By: xavierd

Differential Revision: D18737913

fbshipit-source-id: c31085727589b6938c2fafb28897925aea617bc4
2019-12-09 14:15:47 -08:00
Jun Wu
02b4902319 metalog: implement Repair
Summary:
Provide a way to repair the MetaLog. It's not just repairing 2 indexedlog
structures, but also checking the relationships between them.

Reviewed By: xavierd

Differential Revision: D18737904

fbshipit-source-id: fcf8ae56a1fdbb0561765701d962dfad4a8b5bd4
2019-12-09 14:15:47 -08:00
Jun Wu
083bf3f1c3 run-tests: support '#chg-compatible' header
Summary:
Detect `#chg-compatible` in test header and force enable chg. This would allow
us to mark tests as chg-compatible to get some speed ups.

Reviewed By: xavierd

Differential Revision: D18870508

fbshipit-source-id: 923d6cb10b0c621d9995809b60ae535126f6f2a5
2019-12-09 13:20:25 -08:00