Commit Graph

4322 Commits

Author SHA1 Message Date
Durham Goode
318343765a Enable fb dynamicconfig loading inside eden backingstore
Summary:
Reenables dynamicconfig loading with eden backingstore. Previously it
broke edenfs-windows-release, but we believe the
opensource/fbcode_builder/manifests/eden tweak has fixed it.

Reviewed By: xavierd

Differential Revision: D29561192

fbshipit-source-id: 775dd21d177f3baa09b0192e7d3f7231008c3766
2021-07-06 13:53:41 -07:00
Jun Wu
4a3664c40e localrepo: check before using repo weakref
Summary: The `repo` weakref might be invalid after `__del__`. Check before using it.

Reviewed By: DurhamG, singhsrb

Differential Revision: D29565718

fbshipit-source-id: 54c86414cd80db0d10a3966ed4e677b31ddcd906
2021-07-06 13:49:39 -07:00
Jun Wu
8bc4d6e3fb cpython-ext: rename pycell to PyCell
Summary:
cpython-ext is not part of hg business APIs. It does not need to be consistent
with lower-case class name (and hg codebase is okay with non-lowercase class names,
just that most classes there are lower-case).

This resolves a rustc warning about the struct name.

Reviewed By: kulshrax

Differential Revision: D29526579

fbshipit-source-id: a4bc8e788d55c65aae9eaa87e2c684c2fded7ae2
2021-07-06 13:16:10 -07:00
Thomas Orozco
19769b7cb3 commitcloud: only check local nodes in _checkomissions
Summary:
With segmented changelog, this `if head not in repo` check goes and queries
the server to know if this exists. That's slow:

https://fb.workplace.com/groups/corehg/permalink/880425025886062/

This should hopefully fix it.

Reviewed By: quark-zju

Differential Revision: D29550877

fbshipit-source-id: f874fea3f42e1bde0acd4146bcfede4854b585f1
2021-07-05 14:38:33 -07:00
Jun Wu
80714c8647 lib: remove most rustc warnings
Summary: The warnings make build output less clean.

Reviewed By: kulshrax

Differential Revision: D29526580

fbshipit-source-id: eb4069c2edd111bb04b8754e7051035b8aa8a508
2021-07-01 18:08:55 -07:00
Andrey Chursin
0e56fa056f cpython_ext: add pycell::import
Summary: The use case here is that we can export rust struct into python object, manipulate python object and then convert it back into rust struct

Reviewed By: quark-zju

Differential Revision: D29525281

fbshipit-source-id: 393c8a430a76c720c155432d732085892d56521a
2021-07-01 17:32:13 -07:00
Andrey Chursin
3360815092 cpython-ext: add method to export pycell into inspectable python object
Reviewed By: quark-zju

Differential Revision: D29521113

fbshipit-source-id: ff5c0be50149262d555105e495633847059a78a6
2021-07-01 16:11:48 -07:00
Andrey Chursin
6b649ab8e2 cpython-ext: conditionally derive traits for Serde
Summary:
Previously Serde<T> required T to implement bunch of traits like Eq, Clone etc

This diff lifts this restriction and only implements those traits for Serde if T implements them, but does not require them

Reviewed By: quark-zju

Differential Revision: D29521112

fbshipit-source-id: e9387b08ab129fc1f2450f6c88fa7fe0f6451349
2021-07-01 16:11:48 -07:00
Carolyn Busch
4046bbcae5 setdiscovery: add edenapi http lookup
Summary: Use the bookmarks and commitknown edenapi methods in the setdiscovery process.

Reviewed By: kulshrax

Differential Revision: D29305605

fbshipit-source-id: efbac229e37870f95e0c04c5db275e6e4c8239ac
2021-07-01 14:10:34 -07:00
Carolyn Busch
8e6b4b6678 eagerpeer: fix push_key bookmark update
Summary: Fix two bugs in the eagerpeer pushkey implemention for the case where the bookmark has an existing value. The existing bookmark is already in hex form and errors on conversion. The new bookmark should be set when the new bookmark doesn't match the existing bookmark.

Reviewed By: quark-zju

Differential Revision: D29305606

fbshipit-source-id: 79ec6432d2fe7709f51f5cc508a39238ce446e23
2021-07-01 14:10:34 -07:00
Andrey Chursin
682ac6f93a pull: track pull metrics
Reviewed By: DurhamG

Differential Revision: D29505072

fbshipit-source-id: 9af370b8be6212b7d41880908a1f788291826367
2021-07-01 12:11:11 -07:00
Nitzan Raz
88fd2997d6 Mercurial: Added "commitphab" template
Summary:
Mercurial is already pulling the remote commit for the "local changes" indicator in `hg ssl`.
I'd like to more easily access this remote commit from CLI.
After this change I can run something like `hg ssl -T '{phabcommit}` to get the remote commit and diff locally against it.

I'm very open to changes about the naming / anything else

Reviewed By: DurhamG

Differential Revision: D29482374

fbshipit-source-id: b01fd0186a1f3a999f388edf140b089c89be7bf6
2021-07-01 12:00:20 -07:00
Andrey Chursin
95d16b05d5 pull: update fastpath message
Reviewed By: quark-zju

Differential Revision: D29502091

fbshipit-source-id: 58b989ea773e38398e453a7a319acb13f415237f
2021-07-01 10:49:01 -07:00
Andrey Chursin
7ad57c10a5 bindings: use pycell instead of mincode for pull data
Reviewed By: quark-zju

Differential Revision: D29474445

fbshipit-source-id: dd6536bdbac6e5690c918a222bf3823537ceffcc
2021-07-01 10:49:01 -07:00
Andrey Chursin
b3187fa74a dag-types: introduce CloneData::convert_vertex
Reviewed By: quark-zju

Differential Revision: D29474443

fbshipit-source-id: 06ee410d11d5be3d7655f64dc1aa999efaa938c6
2021-07-01 10:49:01 -07:00
Andrey Chursin
910e457673 cpython_ext: introduce pycell
Summary:
We currently encode/decode data when passing it between pull_fast_forward_master and importpulldata and some other cases
pycell is alternative to that, allowing to just transfer pointer, instead of encoding data

Reviewed By: quark-zju

Differential Revision: D29474444

fbshipit-source-id: aabbbb670fde08645031c199afbdeab5cc9093d8
2021-07-01 10:49:01 -07:00
Durham Goode
d41c23f862 treemanifest: remove explicit edenapi fetching
Summary:
Since we pass edenapi to the contentstore, it should be doing the http
fetching internally. Let's get rid of the http fetching from the python logic
then.

Once we're 100% on edenapi, this will let us just delete the remotetreestore
entirely.

Reviewed By: quark-zju

Differential Revision: D29167443

fbshipit-source-id: fe1c4d7aae38135bdebf41a39c8beec34153e60e
2021-07-01 09:31:16 -07:00
Durham Goode
ccc95d7f5a treemanifest: move fetching logic into remotetreestore
Summary:
Previously the fetch path could go from repo.prefetchtrees down to
rust datastore.prefetch then back to python remotetreestore.prefetch then over
to repo._getdesignatednodes. This was loopy and very poor layering.

Let's move the tree fetching logic down into remotetreestore so at least we're
not circling back to the repo object.

Reviewed By: quark-zju

Differential Revision: D29167397

fbshipit-source-id: 0260640367c6fa3365b5756c738ddc234df593f5
2021-07-01 09:31:15 -07:00
Durham Goode
e2d2fe887c treemanifest: remove non-designatednodes fetch paths
Summary:
These are no longer used. This may let us get rid of the complete trees
edenapi endpoint.

Reviewed By: quark-zju

Differential Revision: D29148506

fbshipit-source-id: 36e8b76228d2f741cdded0dacc5d5e5bf4a60a4e
2021-07-01 09:31:15 -07:00
Durham Goode
954fa919ac treemanifest: make ondemandfetch the default
Summary:
All our clients fetch with ondemandfetch set to true. Let's enable it
by default and remove the other fetch path.

Reviewed By: quark-zju

Differential Revision: D29148507

fbshipit-source-id: ea348aedba495d9d3a8652c4289178c08dae2f08
2021-07-01 09:31:15 -07:00
Durham Goode
1ecd0244f3 treemanifest: support designatednodes in python server
Summary:
All our client fetches now use the designatednodes api call. Let's
support it on the treemanifest python server so we can simplify the client code
around this one way of fetching.

Reviewed By: quark-zju

Differential Revision: D29148505

fbshipit-source-id: 22a92cdcfb105d8861b590de683e1bc12618abae
2021-07-01 09:31:15 -07:00
Durham Goode
4221e71961 treemanifest: remove generating store concept
Summary:
Since the python stores are gone, we no longer need the generating
store concept. Deleting it simplifies are remotetreestore to just a prefetch
function, which will make later fetch path refactoring easier to reason about.

Reviewed By: andll

Differential Revision: D29143583

fbshipit-source-id: 9f5e1063cb9637542f7b4400bddff11fc2215353
2021-07-01 09:31:15 -07:00
Durham Goode
311d95cb12 treemanifest: remove non-rust store
Summary:
All treemanifest uses the rust store now. Let's delete the alternative
path.

Reviewed By: andll

Differential Revision: D29142988

fbshipit-source-id: e74a2643ccd25f5e18feb2fa6bc0424ee642d3d0
2021-07-01 09:31:15 -07:00
Durham Goode
21c9df08a4 treemanifest: remove ability to receive flat manifest deltas
Summary:
Since we no longer send flat manifests as part of the changegroup,
let's remove the ability to convert flat manifest deltas into local trees.

Reviewed By: andll

Differential Revision: D29142989

fbshipit-source-id: 2b060b3412bf0b48f85de21e68a9ae123c19d360
2021-07-01 09:31:15 -07:00
Durham Goode
6ef8f6c44e treemanifest: remove unused legacy code
Summary:
Now that we only support treeonly and the server has been moved out, we
can drop a bunch of dead code.

Reviewed By: andll

Differential Revision: D29140648

fbshipit-source-id: 3d80da0b703e9b20b3522adc3363c32e3d01d4f5
2021-07-01 09:31:15 -07:00
Durham Goode
ba25f1d416 treemanifest: remove non-treeonly conditionals
Summary:
All our production clients have been treeonly for years. Let's remove
all the non-treeonly paths. This diff just removes all the conditional logic. A
later diff will remove the classes and functions that are no longer used because
the conditions are gone.

Reviewed By: andll

Differential Revision: D29140647

fbshipit-source-id: 381195d7b48dee33e8540eb428b8061845e13ced
2021-07-01 09:31:15 -07:00
Durham Goode
14b3b10632 treemanifest: remove server conditions
Summary:
Now that the tests are using the copy of treemanifest we can remove the
server logic. To start with, let's remove all the conditional paths for the
server.

A later diff will remove the server specific storage bits (like revlog usage).

Reviewed By: quark-zju

Differential Revision: D29120431

fbshipit-source-id: aceb7ee265ce7333e26065202f114fed93895619
2021-07-01 09:31:15 -07:00
Durham Goode
8fb6b52ac1 treemanifest: move test server logic to separate extension
Summary:
The treemanifest store and pull/push logic is overly complicated.
Untangling it is a bit tricky since it needs to support both server and client
use cases. Since we no longer care about the server code except for tests, let's
copy the treemanifest extension and use it for the server repo in tests.

A future diff will take advantage of this to delete all the server logic from
the main treemanifest extension.

Reviewed By: quark-zju

Differential Revision: D29115069

fbshipit-source-id: 8b7080aa6c7de77be058b34baad5e976cd7c1acf
2021-07-01 09:31:15 -07:00
Durham Goode
d77bcdfcff backout: fix hg backout losing move info
Summary:
Backout lost move info when copy tracing was disabled. Let's force it
to be enabled for reverts.

Reviewed By: andll

Differential Revision: D29501812

fbshipit-source-id: be2a64fa0185ff91df58edc8ae680da17bedf96f
2021-07-01 09:17:41 -07:00
Durham Goode
2e2757a502 backout: add test demonstrating hg backout losing move info
Summary:
S236795 is about hg backout losing blame/history after backing out a
move. Let's add a test demonstrating the bug.

Reviewed By: andll

Differential Revision: D29501813

fbshipit-source-id: 95efe8fd03f2b744661960c79fed928b5f3d4d8f
2021-07-01 09:17:41 -07:00
Jun Wu
3140e36685 revset: avoid excessive remote lookups for predecessors
Summary:
Figured out by

  export EDENSCM_LOG=dag::protocol=debug

to see the commit hashes being resolved remotely. Then

  export EDENSCM_DISABLE_REMOTE_RESOLVE=1e60115cd0477b0b7569d7a3bdac9b0f7d55bd66

to find the traceback of the code accessing it.

This happens when commits are synced but their predecessors do not exist in the
local repo.

Reported by: markbt

Similar to  D29114049 (880b5c3cd8).

Reviewed By: markbt

Differential Revision: D29509362

fbshipit-source-id: b94516cf312cb247d85d1a195919d9e63745ef99
2021-07-01 06:50:43 -07:00
Navid Qaragozlou
538bb71548 Do not mark commits as "landed as" if it contains local changes
Summary: If the user has modified the commit (ex. amend) and not sending it to Phabricator, we shouldn't mark the local commit as "landed" because it might contain changes that do not exist in the "master" branch.

Reviewed By: quark-zju

Differential Revision: D29401200

fbshipit-source-id: fc09921decdcffb8fc16e65d6a975c5a4154a96d
2021-06-30 19:42:44 -07:00
Meyer Jacobs
a93602fa3f scmstore: introduce config to allow writing serialized LFS pointers directly
Summary: We'd like to eliminate directly writing serialized LFS pointers, but it turns out this is still necessary even when `remotefilelog.lfs=True` in some cases. With this change, we can enable writing serialized LFS pointers directly with a config.

Reviewed By: kulshrax

Differential Revision: D29496358

fbshipit-source-id: 66f53e0f0de52060920658a1781c32f27984ff3a
2021-06-30 19:41:09 -07:00
Jun Wu
c3e47b80fd shelve: filter local nodes more efficiently
Summary:
`x in repo` will trigger remote lookup for lazy changelog, because
x might be a public commit hash in the local graph but not known
locally. For shelved changes, they aren't expected to be public,
so just use the local filtering without remote lookup.

Reported By: markbt

Reviewed By: DurhamG

Differential Revision: D29495144

fbshipit-source-id: da36d39f21ac2533d0e723e53593365722d61bd8
2021-06-30 13:08:45 -07:00
Meyer Jacobs
4cff0b4160 scmstore: update remaining contentstore binding sites
Summary:
Eliminate remaining uses of `contentstore` directly in the Python bindings.

Add repack functionality to `LegacyStore`.

Implement repack methods on `FileStore` by calling into contentstore fallback if possible, otherwise directly.

Reviewed By: kulshrax

Differential Revision: D29469901

fbshipit-source-id: 5cd134d25680bb55b4ddbe1f6d69e02af8942b16
2021-06-30 10:38:04 -07:00
Jan Mazur
d92440d984 hard fail when lfs credentials not found
Summary:
If the default is to pass certificates we should hard fail every single time they are not found instead silently making unauthenticated request. This will surface issues much quicker.

best_match_for can return `Ok(None)`.

Reviewed By: johansglock

Differential Revision: D29159532

fbshipit-source-id: ff28a627d91a9cf37258a97dc2c7f709ba8d00c2
2021-06-30 09:09:20 -07:00
Jun Wu
c82c43ab67 doctor: fix check-code
Reviewed By: singhsrb

Differential Revision: D29486195

fbshipit-source-id: 69a006c4986b6fd45bfbba55bd1bb057d9dc2ddd
2021-06-30 09:00:10 -07:00
Andrey Chursin
4aa1a1653c Print number of commits and segments during pull
Reviewed By: quark-zju

Differential Revision: D29467412

fbshipit-source-id: 65cc0b3a44fc832b16f3d25fbb608c7ab1245c0c
2021-06-29 19:32:53 -07:00
Andrey Chursin
3a52389401 pydag: expose commits and segments in pullfastforwardmaster
Reviewed By: quark-zju

Differential Revision: D29467413

fbshipit-source-id: 4e7609b23111230fa771a91f7d2d9c27dd12f15c
2021-06-29 19:32:53 -07:00
Andrey Chursin
3880c74621 dag: expose number of commits and segments in PreparedFlatSegments
Reviewed By: quark-zju

Differential Revision: D29467414

fbshipit-source-id: b361ed27ac34be6de4f543057f90d05afb9ab3a6
2021-06-29 19:32:53 -07:00
Liubov Dmitrieva
04aa0405e8 add 'upload/filenodes' request
Summary:
add 'upload/filenodes' request

This API must be called after file content has been uploaded. It requires a valid upload token for already uploaded file content.

The token can contain file content id of different types (canonical, sha1, sha256). It may or may not contain content size.

Reviewed By: StanislavGlebik

Differential Revision: D29197219

fbshipit-source-id: 3de31831ab06265675617a5c43cbd4be91f5cbe2
2021-06-29 19:28:45 -07:00
Jun Wu
3eb2eb2257 importhelper: request restart for non-lazy -> lazy changelog migration
Summary:
If the repo changelog was migrated to lazy, existing processes including the
import helpers might start failing to resolve commits. Detect that, and request
a restart of the import helper.

An example traceback:

  edenscm.mercurial.error.RepoLookupError: unknown revision 'ce48ccc4197b2066a8c7f2a930cee89e8aea6379'
  2021-06-29 12:33:12,738 error processing command 4
  Traceback (most recent call last):
    File "edenscm/mercurial/commands/eden.py", line 363, in process_request
      cmd_function(req)
    File "edenscm/mercurial/commands/eden.py", line 604, in cmd_manifest_node_for_commit
      node = self.get_manifest_node(rev_name)
    File "edenscm/mercurial/commands/eden.py", line 821, in get_manifest_node
      return self._get_manifest_node_impl(rev)
    File "edenscm/mercurial/commands/eden.py", line 790, in _get_manifest_node_impl
      node_hash = ctx.manifestnode()
    File "edenscm/mercurial/context.py", line 569, in manifestnode
      return self._changeset.manifest
    File "edenscm/mercurial/util.py", line 987, in __get__
      result = self.func(obj)
    File "edenscm/mercurial/context.py", line 540, in _changeset
      return self._repo.changelog.changelogrevision(self._node)
    File "edenscm/mercurial/changelog2.py", line 374, in changelogrevision
      return changelogrevision(self.revision(nodeorrev))
    File "edenscm/mercurial/changelog2.py", line 463, in revision
      p1, p2 = self.parents(node)[:2]
    File "edenscm/mercurial/changelog2.py", line 610, in parents
      parents = list(self.dag.parentnames(node))
  error.CommitLookupError: '<int> cannot be found'

Reviewed By: andll

Differential Revision: D29470181

fbshipit-source-id: 40ad6eebe1f656c63d3f96b2b70ad60b350eed21
2021-06-29 16:47:49 -07:00
Jun Wu
df7fc44718 localrepo: improve edenapi None error reporting
Summary:
Previously the None edenapi error isn't great for understanding what's going on:

  File "edenscm/mercurial/changelog2.py", line 123, in _openhybrid
    inner = bindings.dag.commits.openhybrid(
  TypeError: Expected type that converts to client but received NoneType

Let's make edenapi non-nullable by default, with nicer error messages, and make
places using the nullable edenapi opt-in explicitly.

Example errors:

  % lhg sl --config edenapi.url=
  abort: edenapi is required but disabled by missing edenapi.url config

  % lhg sl --config edenapi.enable=
  abort: edenapi is required but disabled by edenapi.enable being empty

  % lhg sl --config paths.default=/tmp
  abort: edenapi is required but disabled by paths.default being 'file:'

  % lhg sl --config paths.default=ssh://x --config ui.ssh=dummyssh
  abort: edenapi is required but disabled by paths.default being 'ssh:' and dummyssh in use

Reviewed By: kulshrax

Differential Revision: D29462258

fbshipit-source-id: 84fab5a7cce837c52ccb8108d1f4fe44ef2b6d1e
2021-06-29 15:46:00 -07:00
Jun Wu
d5cc8e6224 localrepo: enable edenapi more reliably
Summary:
D29372739 (ef79c2d811) caused issues that repo.edenapi becomes None due to scheme being ssh
(hit by markbt) or fb (hit by StanislavGlebik). Given that it's just legacy tests
that do not want EdenAPI, let's use a blacklist for legacy tests, instead of a
(fragile) whitelist for where EdenAPI should be enabled.

Reviewed By: kulshrax

Differential Revision: D29461305

fbshipit-source-id: 4a0317747d9ee3412ffdfdb25dc0d8383305a25c
2021-06-29 15:46:00 -07:00
Jun Wu
23797a9437 doctor: fix compatibility with lazy changelog
Summary:
To construct a lazy changelog, the repo object needs to have `name` and `edenapi`. Implement them.
Besides, print why changelog fails to open with `--debug` or `--traceback`.

Reviewed By: andll

Differential Revision: D29468005

fbshipit-source-id: 5815e0d9313dac897f20fa32668cae05ba90c727
2021-06-29 13:16:05 -07:00
Pyre Bot Jr
b0ad4f06b6 suppress errors in fbcode/eden - batch 1
Reviewed By: chadaustin

Differential Revision: D29457835

fbshipit-source-id: 6507be023601f42ada35f572ec5f21cb401cad2f
2021-06-29 12:29:06 -07:00
Claire Alexandra Cate
17e02d6ca0 Add edenapi_retries to FileStore
Summary: Add edenapi_retries to FileStore

Reviewed By: kulshrax

Differential Revision: D29107328

fbshipit-source-id: 2e782648af811983f3fa359585311455970ed65b
2021-06-28 18:31:01 -07:00
Carolyn Busch
0d91553914 tests: fix test-debugchangelog.t
Summary: Looks like another test needs updating after D29437983 (5b1b1febc1).

Reviewed By: quark-zju

Differential Revision: D29446063

fbshipit-source-id: c71684609830b6ec047a2efc615b806dd2a0066b
2021-06-28 17:46:06 -07:00
Jun Wu
e5fe117d81 pullcreatemarkers: do not use legacy commit scan with lazy pull fast path
Summary:
With lazy pull fast path, the legacy commit scan will trigger one-by-one id
resolution, which is terrible and defeat the purpose of laziness. Let's just
force graphql path instead.

Reviewed By: andll

Differential Revision: D29440142

fbshipit-source-id: 4b0d10e6f5a3eb0533b2d95b1889a1f1c1f281cb
2021-06-28 14:36:39 -07:00
Jun Wu
38f3ceafbc hgcommits: add a way to inject failure on resolving ids remotely
Summary:
Similar to D29404057 (cedddd1c8d), add a way to disable resolving IDs by setting
a limit using `EDENSCM_REMOTE_ID_THRESHOLD`.

Reviewed By: andll

Differential Revision: D29440143

fbshipit-source-id: 30409089493ae2cd5c189e37b0d4f88df9a6d8e8
2021-06-28 14:36:39 -07:00