Commit Graph

26 Commits

Author SHA1 Message Date
Saurabh Singh
6317ba0ca2 amend: replace with the fbamend extension
Summary:
The functionality we care about is provided by the `fbamend`
extension. Therefore, lets replace the `amend` extension with the `fbamend`
extension.

Reviewed By: farnz

Differential Revision: D10320739

fbshipit-source-id: 5700d39f488777fcc4033f60ce0a51cda15ef2ad
2018-10-11 06:59:23 -07:00
Mark Thomas
0ca4acd250 localrepo: add storerequirements feature
Summary:
Add the `storerequirements` feature to the repo.  This means the store may have
a `requires` file, and clients must check it for any store features that they
may be missing.  This allows new requirements to be added that affect the store
when the repo is shared.  Currently there are no store features.

This commit adds support for the feature, and only new repos have the
requirement added.  A future commit will optimistically upgrade repos to
include the requirement.

Reviewed By: quark-zju

Differential Revision: D9699156

fbshipit-source-id: 95c1ab6973d44c02abc69b78a15311fe6a8696fd
2018-09-15 03:22:34 -07:00
Durham Goode
a3ab094cbe treemanifest: prevent pushrebase from processing trees during reply
Summary:
In a previous diff we stopped pushrebase from sending flat manifests
back to treeonly client, but we didn't stop pushrebase from analyzing from
analyzing the manifests to decide what files to send. It turns out that this can
be expensive, since it needs to diff two manifests.

Let's fix up the bundle2 capabilities so that pushrebase knows to not send files
back to the client for a remotefilelog client.

Reviewed By: markbt

Differential Revision: D9021066

fbshipit-source-id: ba422ce8b5ada7905e4900ec68957a84613897ff
2018-07-27 10:36:23 -07:00
Durham Goode
7386791327 pushrebase: don't send flat manifests back during reply to treeonly
Summary:
When constructing the pushrebase reply part, we weren't passing the
bundlecaps along, so it was creating a normal flat-manifest changegroup. A
treeonly client that received this would have to translate it to a tree, which
was expensive for pushes that returned a lot of manifests.

The fix is to pass the appopriate bundle caps to the changegroup creation. Since
we don't have access to the bundle1 caps inside a bundle2 part handler, we had
to update the treeonly logic to also pass treeonly=True caps as bundle2 caps.

Reviewed By: StanislavGlebik

Differential Revision: D8958866

fbshipit-source-id: 4d68031aedb61ae4b113ea9376c704c7548f029c
2018-07-23 18:53:13 -07:00
Durham Goode
7add7dc1ef treemanifest: use manifestlog's mutable pack for prefetches
Summary:
The manifestlog has some mutable packs that it persists and manages the
lifetime of. As long as every tree writer uses these, we'll only get one new
pack per process/transaction.

The prefetch code was not using these though, so things like 'hg log -p' would
produce many packs over the course of many fetches. This change fixes it to
always write to the same pack.

Reviewed By: phillco

Differential Revision: D8670684

fbshipit-source-id: e56590c0ced84a99a06a94028d6a4e14bcc22ab6
2018-06-29 15:51:40 -07:00
Durham Goode
92e7bd4f4b treemanifest: change tree fetching to fetch a certain depth
Summary:
We're experiencing cases where users are pulling down far more trees
than they need. Now that we can download just portions of a tree, let's add a
depth limit to the fetch code path. This will let us avoid downloading trees
that are never used.

The default is still to fetch all trees, but future diffs will make certain code
paths download only portions of trees.

Reviewed By: quark-zju

Differential Revision: D8523217

fbshipit-source-id: 066c5aef14b00ea0a366cf43e8a89ee053f82d22
2018-06-27 18:06:13 -07:00
Durham Goode
d9abea8ff1 treemanifest: fix backfilling when there are local-only public heads
Summary:
Flat manifest backfilling (which is used when reverting from treeonly
mode) was failing when the client had public heads that didn't exist on the
server (for instance, if they pulled from svn directly or if they had old
commits that had been stripped from the server). This was breaking the pull.

Let's fix it so we never send unknown heads to the server during the backfill
pull.

Reviewed By: phillco

Differential Revision: D8526027

fbshipit-source-id: 8d5bf67d2022dbc24facd0b96e001c8c81a0a2da
2018-06-20 09:50:55 -07:00
Durham Goode
93eb7cc993 treemanifest: set a hint commit hash for resolving base trees
Summary:
When requesting trees from the server we try to provide a base tree
that we already have.  In the hybrid manifest days, when we were fetching
manifest X, we would look up the linknode for X in the flat manifest revlog,
then scan the changelog up and down from that linknode. In the treeonly world we
don't have that revlog anymore though, so the current algorithm just searches from
the tip. This ended up being a really bad algorithm, since if you have tip and you
request tip~1000, then tip~2000, then tip~3000, you end up basing them all
against tip and redownloading a lot of data. This makes hg blame and hg log -p
super slow.

Let's change the algorithm to base off of a hint linknode, and let's change
changectx to set that hint every time it attempts to read a manifest. In manual
testing this significantly sped up hg log -p

Reviewed By: phillco

Differential Revision: D8399613

fbshipit-source-id: 771a94ee8b82be682ea0091b8d6c0fcd5f4e6646
2018-06-13 11:49:46 -07:00
Mark Thomas
e41f0630e5 treemanifest: more logging for fetching trees
Summary:
Make the (user-facing) log for prefetching trees say how many commits (or which
commit) it is prefetching for.

When remotefilelog.debug is enabled, print out the manifest identity when
fetching a tree during normal operation.

Reviewed By: quark-zju

Differential Revision: D8056555

fbshipit-source-id: dc0c7bc5c949a0674d5f553661e736bc545134b4
2018-05-24 07:19:20 -07:00
Durham Goode
0fcd554c57 treemanifest: enable ondemand tree generation when sendtrees is enabled
Summary:
Previously we only enabled on demand tree generation when treeonly was
set, but we also need it when sendtrees is set since we'll need to generate
trees for sending.

Reviewed By: quark-zju

Differential Revision: D7927856

fbshipit-source-id: a69d6c7920a92e4f90bdcd1d04aad9ef59e9c778
2018-05-09 11:28:18 -07:00
Durham Goode
a54b05ee58 hg: use bundle2 for treemanifest backfill
Summary:
We weren't passing bundlecaps to the backfill pull, so we were getting
bundle1. Let's fix that

Reviewed By: quark-zju

Differential Revision: D7591167

fbshipit-source-id: 111e2967190dca17764c84e6d7be850644f222fd
2018-04-13 21:51:53 -07:00
Durham Goode
0ae182a740 hg: default to using bundle2 for pushrebase parts
Summary:
Pushrebase previously defaulted to bundlev1. Now that the server can
support v2, let's default to v2.

Reviewed By: quark-zju

Differential Revision: D7591174

fbshipit-source-id: bc5448490ff319543baedf3f5a1aab160a73ed27
2018-04-13 21:51:53 -07:00
Durham Goode
24653e5e32 hg: add develwarn for bundle1 format
Summary:
We want to deprecate the bundlev1 format, so let's start by adding a
develwarn. Later diffs will update the tests to not use v1, then remove v1 as a
supported outgoing bundle entirely.

Reviewed By: quark-zju

Differential Revision: D7591166

fbshipit-source-id: 143ad029bfe4d141f91d6d5077342dfa44ad2944
2018-04-13 21:51:52 -07:00
Jun Wu
238cda6c14 amend: use hint framework for restack
Summary: This allows people to silence the hint.

Reviewed By: markbt

Differential Revision: D7392127

fbshipit-source-id: ac16f952a178d567ce13e22946127456972ebe85
2018-04-13 21:51:49 -07:00
Durham Goode
d87789e3e7 hg: store repo on manifestlog instead of changelog
Summary:
Previously we were storing the changelog on the manifestlog and using
it to resolve linkrevs before serializing them. It turns out the changelog can
be invalidated at a different rate than the manifestlog, so we could encounter
issues where the manifestlog held a reference to the old changelog.

To fix this, let's hold a reference to the repo and access the changelog from
there when we need it. This introduces a circular reference between the
manifestlog and the repo, but it's probably fine for now until we can get rid of
the need for changelog invalidation.

Reviewed By: singhsrb

Differential Revision: D7360321

fbshipit-source-id: 2317c7fcd6b307a50b64f0c5df97dda2955f3e21
2018-04-13 21:51:35 -07:00
Durham Goode
4ac2448524 hg: handle case when manifest revlog is missing a node
Summary:
Previously, when looking for a treemanifest we'd inspect the flat
manifest revlog to get a hint for which nearby manifests might exist. This
assumed the data was in the flat manifest though, and if it wasn't it threw an
exception which caused us to not look at the server for the tree.

This commit fixes the case where the flat manifest doesn't have the commit, so
it can still look at the server.

Reviewed By: quark-zju

Differential Revision: D7343608

fbshipit-source-id: 57d5da9a8b8d71e33df9a8a0647b7bfe8815e37b
2018-04-13 21:51:31 -07:00
Durham Goode
b964f5d745 hg: always send all trees to the main server
Summary:
A prior diff optimized push/pull to not send public trees between
peers, since those trees can be downloaded from the main server. Let's be
careful when sending data to the main server and always send everything.

In the future we should add validation on the server that the received data is
complete, but Mercurial doesn't currently do that today.

Differential Revision: D7296253

fbshipit-source-id: 49513685d19991a70d66da1d734ddae23491ed0c
2018-04-13 21:51:30 -07:00
Durham Goode
d7d4e3f019 hg: enable pushing treeonly commits without pushrebase
Summary:
This allows pushing a treeonly pack to a server without using
pushrebase.

Differential Revision: D7295686

fbshipit-source-id: b0bfe4fbb04bc765e57f1db82909fa1ae7b3063b
2018-04-13 21:51:30 -07:00
Durham Goode
50392ae4cf hg: fix linknodes in new trees
Summary:
Previously we were just putting nullid as the linknode in client side
trees, because when the trees were added the changelog hadn't been written yet,
so we didn't know the linknode. This diff updates manifestlog.add to pass
linkrevs to mutablehistorypack, which get resolved at serialization time into
the appropriate linknode.

Reviewed By: ryanmce

Differential Revision: D7280104

fbshipit-source-id: bbc8a7bfad31da296a1b65973875ba2e1e1f7a95
2018-04-13 21:51:30 -07:00
Durham Goode
a5dab1deb5 hg: support treeonly mode on the server
Summary:
Once all clients are in treeonly mode, we can make the server tree only
mode as well and stop producing flat manifests entirely. This will speed up
pushes, save space, etc. This patch adds support for that mode.

Reviewed By: ryanmce

Differential Revision: D7148825

fbshipit-source-id: 15c899a58dd45af0c030c887c53f66347bc32b01
2018-04-13 21:51:27 -07:00
Durham Goode
09c987f22f hg: don't send public trees during pull/push
Summary:
Currently if you push or pull a bunch of commits between peers we will
include all the trees as part of the push. If the source repo doesn't have all
the necessary trees, it will go to the server to get them. Since the other
machine can just as easily go to the server (and probably won't need most of
those trees anyways), lets just have the source client send all draft trees and
skip the public commits,

Reviewed By: phillco

Differential Revision: D7141623

fbshipit-source-id: 6d33ae9d4c9cc32bf6dfa76f733c87c06890d719
2018-04-13 21:51:22 -07:00
Adam Simpkins
f4abe113fa treemanifest: support pulling from local repositories
Summary:
Update the treemanifest extension to also add a 'gettreepack()' function to
localpeer, and add the 'gettreepack' capability to localpeer if the repository
supports acting as a treemanifest server.

Also update the _addmanifestgroup() wrapper to only forbid it from being called
in a treemanifest server repository.  When pulling from a local treemanifest
server repository this function may need to be invoked in the client
repository.

Reviewed By: DurhamG

Differential Revision: D6980931

fbshipit-source-id: 61519c7deeaa0347650323a0002b89597e91d9cc
2018-04-13 21:51:14 -07:00
Durham Goode
5df613f729 hg: fix prefetch in treeonly mode
Summary:
remotefilelog prefetch was broken in treeonly mode since it referred to
the manifest revlog to get the parents. Let's switch to the more modern
manifestctx way of accessing parent information.

Reviewed By: quark-zju

Differential Revision: D6995267

fbshipit-source-id: e0c11fca0f2156be3f936a6e437e7a4d3dffe75b
2018-04-13 21:51:12 -07:00
Durham Goode
6b35de4f33 hg: fix initial commits in treeonly repos
Summary:
Previously we weren't able to commit right after creating a treeonly
repository. This was caused by the code attempting to read the null tree from
the store, which doesn't exist. The fix is to handle the null case and return an
empty tree instead of trying to look it up in the store. We already do this in a
number of other cases, so this was just a missing one.

Reviewed By: singhsrb

Differential Revision: D6930919

fbshipit-source-id: e227612be2640282eb997f4d563102d86f0be43a
2018-04-13 21:51:08 -07:00
Jun Wu
1cde63d99c codemod: drop hacks changing PYTHONPATH in tests
Summary:
Now they are unnecessary since `run-tests.py` will set up `PYTONPATH`
correctly.

Differential Revision: D6865042

fbshipit-source-id: ca95314f725968e14349a9d916434aa832c596f9
2018-04-13 21:51:00 -07:00
Durham Goode
0fbed23c0d treemanifest: move treemanifest tests to tests/
Summary:
Now that fastmanifest and treemanifest are moved, we can moved the
tests.

Test Plan: make local && ./run-tests.py

Reviewers: singhsrb, #mercurial

Reviewed By: singhsrb

Subscribers: singhsrb

Differential Revision: https://phabricator.intern.facebook.com/D6685334

Signature: 6685334:1515526455:57791d7f9d2a3f2a6119c0e79a81b31e63a11c60
2018-01-09 12:59:00 -08:00