Commit Graph

6886 Commits

Author SHA1 Message Date
Mark Thomas
eb318ffa63 convert: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329501

fbshipit-source-id: 5312f905b513200904c79acbdb1c7b17968a8aba
2018-04-13 21:51:33 -07:00
Mark Thomas
af359e3856 churn: use new-style progress bars
Reviewed By: quark-zju

Differential Revision: D7329481

fbshipit-source-id: 4bf764216e23c1e38efe19340eabd7a29f960e64
2018-04-13 21:51:33 -07:00
Mark Thomas
b475295681 changegroup: use new-style progress bars
Reviewed By: DurhamG

Differential Revision: D7329508

fbshipit-source-id: b887265f9ceb051d14706bfee8708bbd4c74557d
2018-04-13 21:51:32 -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
Jun Wu
e83f8cfa4d rust: add more dependencies
Summary: Add crates that are used in the upcoming matcher implementation.

Differential Revision: D7319606

fbshipit-source-id: c269aa9afac635838940239f3e5ab173c38b2429
2018-04-13 21:51:31 -07:00
Martijn Pieters
36a3e5b595 sparse: use -l as the short option for --list-profiles
Summary: There's a precedent for `-l` for listing: `hg shelve -l`, `hg undo -l`, `hg resolve -l`.

Reviewed By: ryanmce

Differential Revision: D7337527

fbshipit-source-id: 3d9c340590e9756e39cad3bfdd0b017f45fd3a6e
2018-04-13 21:51:31 -07:00
Durham Goode
25ab786e07 hg: allow backfilling trees for a nullid manifest
Summary:
We have some repo's whose first commit didn't not add any files, which
means they have nullid as their manifest pointer which breaks backfilltrees.
This patch fixes that.

Reviewed By: singhsrb

Differential Revision: D7340678

fbshipit-source-id: 85b048b81c1861fd48d5cc082d414271aee7283b
2018-04-13 21:51:31 -07:00
Martijn Pieters
efd45069e3 sparse: use relglob to exclude readme files
Summary: Although the old glob *should* work, in practice the treemanifest matcher seems to have issues with glob:**/ paths, where relglob: works.

Reviewed By: ryanmce

Differential Revision: D7287992

fbshipit-source-id: d3802e730d937eeca7059dac691d8dac5a5de262
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
Phil Cohen
67a6bf19bd add repack --looseonly
Summary:
It can sometimes be nice to be able to just repack loose data and avoid existing packs.

This came up during building the megarepo, which creates many loose files, but including the packs added too much repack time.

Differential Revision: D7209296

fbshipit-source-id: 10afed40e409733e0ee004f025013cf86f3f7bf6
2018-04-13 21:51:30 -07:00
Phil Cohen
0a91c90b9c fsmonitor: don't invoke watchman on in-memory updates
Summary: Previously, this function assumed all calls to `merge.update` affected the working copy. That's no longer true with in-memory merge, so let's adapt it accordingly.

Reviewed By: DurhamG, singhsrb

Differential Revision: D7297552

fbshipit-source-id: d2eb299b6b6e8cf4a3ed3357ae51cbd13c144534
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
0a624e63f7 hg: specify kwargs name for linkrev
Summary:
The linkrev parameter is a named parameter, so let's use it's name
instead of relying on the order. This is just a cleanliness diff.

Reviewed By: ryanmce

Differential Revision: D7280108

fbshipit-source-id: 88a02d0b5ccb1f586fdc01fb3cb2cd44a70e82e9
2018-04-13 21:51:29 -07:00
Durham Goode
668b782de4 hg: support linkrevs in mutablehistorypack
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 mutablehistorypack to allow
resolving the linknodes at serialization time instead of add time. This will be
used in a future diff to fix storing linknodes in trees.

Reviewed By: ryanmce

Differential Revision: D7280105

fbshipit-source-id: 70063e627d0fd7baeb017bac5ac55957a100d06c
2018-04-13 21:51:29 -07:00
Durham Goode
e2ab772767 hg: use the correct linknode in converttotrees
Summary:
Previously converttotrees relied on being passed a linkrev to pass to
manifestlog.add(). If a linkrev wasn't provided though, it would pass None and
no linknode was stored. If a linknode is available, let's prefer that, and only
use the linkrev when we have to.

Reviewed By: ryanmce

Differential Revision: D7280109

fbshipit-source-id: d17015789a213fab6ff57563216e6943d2525fee
2018-04-13 21:51:29 -07:00
Durham Goode
976ae65ec7 hg: add linknode to manifestlog.add apis
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. As part of fixing this, let's add linknode to
the manifestlog.add api. A future diff will fill this in with the right value.

Reviewed By: ryanmce

Differential Revision: D7280103

fbshipit-source-id: dad3d2456e0cbde39392bf77af53ceeaadb49913
2018-04-13 21:51:29 -07:00
Durham Goode
ae52f1bd3c hg: don't send tree packs as part of pushrebase pushes
Summary:
Previously pushrebase pushes would send a tree pack part as well as a
rebase pack part. The tree pack part was ignored. Let's make receiving tree pack
parts on the server an error, and instead make the client not send them if it's
doing a pushrebase push.

A future diff will come back and add support for non-pushrebase push of tree
packs. This diff just makes use sure that the new logic won't run during
pushrebase.

Reviewed By: ryanmce

Differential Revision: D7267802

fbshipit-source-id: cabff989c178afb3706b77a03a299bcf3195f289
2018-04-13 21:51:29 -07:00
Durham Goode
161a6ddc0d hg: make infinitepush rebundling use the right bundlecaps
Summary:
infinitepush rebundling wasn't passing the appropriate bundlecaps. This
caused treeonly repositories to receive flat manifests from infinitepush
bundles. This allowed treeonly clients to receive the data and convert it to
trees, but really we should just convert the data to trees on the server before
we send and not rely on the client to be able to accept flat manifests.

Now that we no longer send flat manifests, we rely on the recently added
conversion logic to turn flat manifests into trees when necessary.

This will be required for turning the server into a treeonly client anyway.

Differential Revision: D7256556

fbshipit-source-id: bbaf9d4570eebd9f200004e34044b5b1a8c53e2e
2018-04-13 21:51:29 -07:00
Durham Goode
0803faf09d hg: make infinitepush convert flat manifests to trees during rebundling
Summary:
Currently infinitepush relies on the ability to send flat manifests to
tree clients and the clients doing the conversion. This relies on a hack where
we don't pass the bundlecaps to the infinitepush changegroup creator, so it
doesn't realize it's talking to a treeonly client and therefore sends flat
manifests to a treeonly client. This is hacky. To fix this, let's start by
making it possible for the server to generate trees on demand from the flat
manifests. This will also be useful later when the server is treeonly, so it can
ondemand generate old flat bundles into a treeonly one.

A later diff will then pass the appropriate bundlecaps to the rebundle
changegroup function.

Reviewed By: ryanmce

Differential Revision: D7256554

fbshipit-source-id: 40d5d9537a5e11b3d186c8ec9a2579261f1b772e
2018-04-13 21:51:29 -07:00
Durham Goode
398c80edba hg: allow writing to inmemory packs on bundlerepo
Summary:
In a future diff we'll want to allow converting flat manifests to tree
manifests during infinitepush. To do so, let's allow writing to in memory packs
on bundlerepositories.

Reviewed By: StanislavGlebik

Differential Revision: D7256563

fbshipit-source-id: 10ec58d1171b7882d6db9a916c50a19bc11dbcb4
2018-04-13 21:51:29 -07:00
Jun Wu
613b72b258 fsmonitor: add "merge" metadata to "hg.update" state
Summary:
The "merge" metadata is a boolean value that indicates whether a merge of
two branches are ongoing and could have potential conflicts.

Note: state-leave does not mean the merge conflict is resolved. There might
still be unresolved conflicts in the working copy.

Differential Revision: D7286169

fbshipit-source-id: 0948174eb9a9d7c28af64b8ade58dc509d49f747
2018-04-13 21:51:29 -07:00
Mark Thomas
93b97b7fe1 clienttelemetry: record client details in server telemetry
Summary:
Add a new extension, `clienttelemetry`, which sends information about the
client to the server.  This information is logged by the server, which can use
the `sampling` extension to store this information for later analysis.

Includes a few basic pieces of information by default, including a correlator
which can be used to correlate logs from the client and the server.

Reviewed By: mjpieters

Differential Revision: D7271508

fbshipit-source-id: f152fe177d8bc73179d3a2c4d0d070d468885e2a
2018-04-13 21:51:29 -07:00
Stanislau Hlebik
bdfe84aecc do not send treemanifest part if outgoing.missing is empty
Summary: This part is empty anyway, so there is no point in sending it.

Reviewed By: DurhamG

Differential Revision: D7271595

fbshipit-source-id: 53bdff76d63f925725b00be8d836ffa87bb32470
2018-04-13 21:51:29 -07:00
Ryan McElroy
4380742b11 fbsparse: cache translations and properly close progress bars
Reviewed By: markbt

Differential Revision: D7211458

fbshipit-source-id: 6536a9e7060ca945a0763a4a54b075bf747d09fc
2018-04-13 21:51:29 -07:00
Ryan McElroy
94ae24f468 fbsparse: show spinner while populating the fileset
Summary:
On a large repo, this can take seconds. Let the user see progress
during this time.

Differential Revision: D7211460

fbshipit-source-id: bfa9ad658a1c190399f9e33de7ddfbe006d6cbfb
2018-04-13 21:51:28 -07:00
Ryan McElroy
07c6e90f29 fbsparse: use context manager for wlock()
Summary:
During testing, I discovered that a ctrl-c while `hg sparse --refresh`
was waitign on the wlock would cause a traceback. This fixes that.

Differential Revision: D7211459

fbshipit-source-id: dde006208f688cc7e2509e822443dececd59c08d
2018-04-13 21:51:28 -07:00
Siddharth Agarwal
b87608eb2b make _addservercaps always return a list
Summary: This fixes Mononoke tests.

Reviewed By: ryanmce

Differential Revision: D7270772

fbshipit-source-id: 0d4cfb5b10af7c296ad9f2f1cd04add5428d35f6
2018-04-13 21:51:28 -07:00
Durham Goode
6b14e6809e hg: close discovering progress bar
Summary: We need to call None on the progress bar so it knows it's done.

Reviewed By: ryanmce

Differential Revision: D7267691

fbshipit-source-id: 81b19d945a44e8f46a15abdaf501ef6b5dea4ffc
2018-04-13 21:51:28 -07:00
Mark Thomas
4cea23b3a9 commitcloud: sync obsmarkers
Summary:
Add obsmarkers to the things that are synced.

For the LocalService, obsmarkers are stored base64-encoded using version 1 of
the obsmarker binary format.  This is sufficient for unit tests.

Differential Revision: D7181399

fbshipit-source-id: 61377105986de561622a160134d20fdbd54bb88f
2018-04-13 21:51:28 -07:00
Mark Thomas
6660438ea2 commitcloud: add basic cloudsync command
Summary:
Adds the initial skeleton of the `commitcloud` extension to Mercurial, which
will synchronise heads and bookmarks (and later, obsmarkers) with commit cloud.

Current limitations:
  - only supports a stub version of the service that uses local files
  - requires manual pushbackup to send commits to the server via infinitepush
  - doesn't do anything with obsmarkers

Differential Revision: D7167715

fbshipit-source-id: 53443f3fb8dff0fe52257d7b20fc601dbe10c883
2018-04-13 21:51:28 -07:00
Martijn Pieters
37547cff41 sparse: list profile titles
Summary: Put titles, if present, into a second 'column' in the plain output.

Differential Revision: D7258046

fbshipit-source-id: dedbb04ecbf0b2262c4c507683262e4b7bef8d70
2018-04-13 21:51:28 -07:00
Martijn Pieters
a8786716bf sparse: load metadata from profiles
Summary:
Profiles can now have a [metadata] section, with key-value pairs defining some metadata to be associated with the profile.

This supports multiline entries by starting a continuation line with some whitespace:

```
[metadata]
title = Some cool title
description = A longer description
 will be joined with newlines
 provided you start with a space
 or a tab.
```

Differential Revision: D7257628

fbshipit-source-id: d6b09161d54cb6824f691d07caee83d0f8bd0a84
2018-04-13 21:51:28 -07:00
Martijn Pieters
8bb4e6a0ec sparse: include a filename when reporting sparse profile parsing issues
Summary: We regularly parse multiple profiles, through includes or when discovering. Be clear what profile file caused the issue.

Differential Revision: D7257636

fbshipit-source-id: 1203c13f6c6a4e4d1397ace818aee21b9db38550
2018-04-13 21:51:28 -07:00
Durham Goode
44255f76a8 hg: fix incorrect public phases during infinitepush pulls
Summary:
infinitepush manipulates what phases are sent back to the client. The
old behavior was that it would report every commit from the bundle to the client
as draft, even if the commit wasn't related to the heads being fetched and even
if the commit wasn't actually a root. The mercurial client logic expected these
values to actually be roots, and this caused some logic to act incorrectly and
mark commits unrelated to the pulled head public.

The fix is to only send roots, and only ancestors of the requested head.

Reviewed By: singhsrb

Differential Revision: D7265155

fbshipit-source-id: 709c3c807258049e44e493b0668f3034a0b11328
2018-04-13 21:51:28 -07:00
Martijn Pieters
d02feb0eb6 sparse: refactor profile parsing
Summary:
- Include line numbers for error messages
- Handle sections via a mapping, for ease of extending
- Use identity to test for the excludes section, because even if the contents
  matched we'd want this to be an error.

Reviewed By: quark-zju

Differential Revision: D7239581

fbshipit-source-id: 36cf79102ed01758b809009bcbe470714ddd27e4
2018-04-13 21:51:27 -07:00
Martijn Pieters
0749a79a56 sparse: use a attrs class for internal sparse config passing
Summary: This makes it easier to add metadata later on, and code that needs only a single entry becomes cleaner.

Reviewed By: quark-zju

Differential Revision: D7239580

fbshipit-source-id: 8900b4fd4883e68ac599396e4a80063d11bbf07c
2018-04-13 21:51:27 -07:00
Martijn Pieters
74cb7a9391 fbsparse: use attrs to define the ProfileInfo class
Summary:
attrs is more flexible than a namedtuple, and we don't need indices on these objects.

The object is still immutable and has a low memory profile, but now we can trivially validate values. It's easier to extend the class now to add metadata.

Reviewed By: quark-zju

Differential Revision: D7239584

fbshipit-source-id: cbd0b38c54f08ed19d5a7e05811356e4694d7d19
2018-04-13 21:51:27 -07:00
Durham Goode
4f32c517ea hg: fix check code failures
Summary: I accidentally landed check code errors. Let's fix them.

Reviewed By: quark-zju

Differential Revision: D7247486

fbshipit-source-id: 769d5fe9da66418178764ee50380cbca6e606e4c
2018-04-13 21:51:27 -07:00
Durham Goode
bdff1aaa60 hg: infinitepush fix sending files with infinitepush bundles
Summary:
Previously, if we weren't sending trees we would not attempt to process
what files needed to be sent. This was incorrect, since files may be sent
independent of what trees are decided to be sent. So let's update the code to
care about shouldaddfilegroup instead of cansendtrees.

This exposed an additional bug where we wouldn't look at the treemanifests
during the file computation, so when sending treeonly infinitepush bundles we
would get an error.

Reviewed By: singhsrb

Differential Revision: D7240340

fbshipit-source-id: a9be69597f4f1cbbecdd7cb1661f1023114bf621
2018-04-13 21:51:27 -07:00
Durham Goode
c41de80f47 hg: fix infinitepush treeonly rebundling
Summary:
Sometimes infinitepush has to rebundle the data it's trying to send to
the client (like if you pull only part of a bundle). Previously, this was broken
for treeonly bundles because we did not correctly extend the bundlerepo's
data/history store on treemanifest servers. This patch fixes that and updates a
test.

Reviewed By: quark-zju

Differential Revision: D7240343

fbshipit-source-id: a9dd3ae884ace3fa9f4a748fe753fc394e69d6c9
2018-04-13 21:51:27 -07:00
Liubov Dmitrieva
2105ae2bdd short hashes: warn if upload too old commit
Summary:
For short hashes it is nice to warn if the commit is too old.

Scenario:

 After making commit on one machine, you can wait not enough time to
 try to upload it on another machine using short hash from `hg sl`

 in case of conflict (single conflict!) you can get automatically a very old commit,
 that is not yours, without a warning. (And there were cases, when this screwed up hg that tried to go 250,000 commits ago)

 I added a warning with a description of found commit if it is more than configured number of days old (default is 60)

Also, format of output has been redesigned. Now it is bold and got colors!
Also, I added #commitcloud

Another new features is that I added sorting by date in suggestions block.

Reviewed By: mjpieters

Differential Revision: D7195265

fbshipit-source-id: 7225a9b0fa8a7381f1e88ef7eb8a8fe2dfff43cd
2018-04-13 21:51:27 -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
4119bab06e hg: move treemanifest server caps to a function
Summary:
Every update to capabilities was requiring changing two spots. Let's
move that into a function. In a future diff we'll add another capability here.

Reviewed By: ryanmce

Differential Revision: D7148827

fbshipit-source-id: 5e8e95c330f2328c7e6c2b15ec708a45a72cf649
2018-04-13 21:51:27 -07:00
Durham Goode
2ffaf8c08e hg: support writing to revlogs through manifestlog.add
Summary:
Currently revlog writing is done through a custom external path. Let's
hide it behind manifestlog.add as well. This will make it simpler to support the
transition to a tree only server in an upcoming diff.

Reviewed By: ryanmce

Differential Revision: D7148822

fbshipit-source-id: af43a639395e4686cf4b3d654d4408e0747c1b47
2018-04-13 21:51:26 -07:00
Durham Goode
9015094431 hg: make treemanifestlog._revlog computed from the datastore
Summary:
Now that all revlog access happens through the store, let's drop the
duplicate revlog instance on the treemanifestlog. Instead let's get the copy
from the store.

Reviewed By: ryanmce

Differential Revision: D7148819

fbshipit-source-id: 3194247de583c55400b52a3b292efa7b9f9a4649
2018-04-13 21:51:26 -07:00
Durham Goode
a395884d38 hg: switch server tree reads/writes to use cstore treemanifest
Summary:
Previously, the hg server used the python treemanifest implementation
to represent and write treemanifests. As part of unifying the code base, and
making it easier to enable treeonly servers in a future patch, let's move all
tree server logic to use cstore treemanifest instead.

Reviewed By: ryanmce

Differential Revision: D7148826

fbshipit-source-id: 81003fbeef94e448ea3aca3380af1b4a9f8fd22d
2018-04-13 21:51:26 -07:00
Durham Goode
f45c1af184 hg: disable cuniondatastore support for treemanifest
Summary:
The cstore doesn't contain our ondemand generator, nor our mutable data
store, so it's really not usable yet. Let's disable it for now until we can fix
up the issues that prevent us from using it (like having it report metrics).

Reviewed By: ryanmce

Differential Revision: D7148823

fbshipit-source-id: 5cc46af33c049b751c1c04916aafe0768d80ce7a
2018-04-13 21:51:26 -07:00
Durham Goode
b248124ba7 hg: allow hybrid manifest's to exist without revlogs
Summary:
Once we move to a treeonly world, there won't be any more manifest revlogs.
During the transition we'll still use hybrid manifest's though (the class, and
it will just resolve to treemanifests every time), so we need to support hybrid
manifests that don't actually have a revlog.

This also sets manifestlog._opener. We were already storing that on the other
manifestlog implementations, so we should do it on the main one for consistency
(and because this diff depends on it).

Reviewed By: ryanmce

Differential Revision: D7148821

fbshipit-source-id: 8f278a7bf4c0909423257165df59eae400a05a9e
2018-04-13 21:51:26 -07:00
Durham Goode
ab127432c4 hg: instantiate manifestrevlog's instead of revlogs
Summary:
In a future patch we will start using the contents of the
manifestrevlogstore as the place we call add() to add new revisions. In order to
do that, those revlogs must be manifestrevlogs. This patch just changes them to
use the right type.

Reviewed By: quark-zju

Differential Revision: D7148824

fbshipit-source-id: 0d60cd22b041db83b61ccaec3b6172624ea97e42
2018-04-13 21:51:26 -07:00