Commit Graph

3 Commits

Author SHA1 Message Date
Jun Wu
9dc21f8d0b codemod: import from the edenscm package
Summary:
D13853115 adds `edenscm/` to `sys.path` and code still uses `import mercurial`.
That has nasty problems if both `import mercurial` and
`import edenscm.mercurial` are used, because Python would think `mercurial.foo`
and `edenscm.mercurial.foo` are different modules so code like
`try: ... except mercurial.error.Foo: ...`, or `isinstance(x, mercurial.foo.Bar)`
would fail to handle the `edenscm.mercurial` version. There are also some
module-level states (ex. `extensions._extensions`) that would cause trouble if
they have multiple versions in a single process.

Change imports to use the `edenscm` so ideally the `mercurial` is no longer
imported at all. Add checks in extensions.py to catch unexpected extensions
importing modules from the old (wrong) locations when running tests.

Reviewed By: phillco

Differential Revision: D13868981

fbshipit-source-id: f4e2513766957fd81d85407994f7521a08e4de48
2019-01-29 17:25:32 -08:00
Mark Thomas
78a14a1687 remotefilelog: don't process manifests when not necessary
Summary:
When building a bundle that will be used for a pull that can't use the linkrev
fastpath, we need to process the manifests of the commits for which we will
send files so that we can correctly set up their linkrevs.  Currently this is
sometimes happening for all commits, which can be very slow when pulling a
large number of commits.

First, make it clearer what `LocalFiles` and `LocalTrees` means, and make it
easier to test for trees being local.

Second, when processing manifests looking for files that will be included in
the bundle, don't process non-local trees if we are only interested in local
trees.

Third, correctly determine whether to send all, local, or no trees or files
depending on what combinations of treemanifest and remotefilelog the client and
server support, and what operation is taking place.

Finally, we aren't passing `b2caps` through to `changegroup.makestream` in the
changegroup part generator for bundle2 parts.  This means the above test for
whether the client supports treemanifest always failed.

With these combined changes, a pull of a specific public revision (so not
following the fastpath) where the client supports both remotefilelog and
treemanifest, will result in the server using `LocalFiles` and `LocalTrees`,
and therefore not processing the manifests of public commits looking for which
files to send.

Reviewed By: DurhamG, ikostia

Differential Revision: D8446137

fbshipit-source-id: 9a4247af75fe79c1962a29fcb8bf0181868699f4
2018-06-19 10:20:07 -07:00
Mark Thomas
5d1c8f581b add test for pulling public commits by revision
Summary:
Add a test for pulling public treeonly commits by their revision number.
Unlike a normal pull, this doesn't use the fastpath, and attempts to
recalculate some information.  It tries to calculate too much, and as a result
ends up diffing each flat manifest pair between the client head and the
requested revision.  For large numbers of commits, this is really slow.

Reviewed By: DurhamG

Differential Revision: D8446138

fbshipit-source-id: 5e2cbb7e710282b094d4fe93b1f7a37afaf7ab3d
2018-06-19 10:20:07 -07:00