Commit Graph

43042 Commits

Author SHA1 Message Date
Jun Wu
582d06422e patch: buffer lines for a same hunk
Summary:
Instead of yielding tokens directly, buffer them if they belong to a same
hunk. This makes it easier for the upcoming new worddiff algorithm to only
focus on the diff hunk, instead of having to worry about other contents.

This breaks how the existing experimental worddiff algorithm works, so the
algorithm was removed, and related tests are disabled for now.

Reviewed By: ryanmce

Differential Revision: D7314725

fbshipit-source-id: 344e502cd185b2412fbd2ee299131bbb4560ac17
2018-04-13 21:51:30 -07:00
Jun Wu
44fe605864 patch: move yielding "\n" to the end of loop
Summary:
The original logic makes it harder to reason about - it yields the "\n"
character belonging to the last line in the next loop iteration.

The new code is in theory a little bit slower. But is more readable. It
makes the following changes easier to read.

Reviewed By: ryanmce

Differential Revision: D7314727

fbshipit-source-id: cb792577adc8f7629bc2e0fe8f0688e705bf4b30
2018-04-13 21:51:30 -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
58c32fe0c3 hg: pass the bundle2 caps down to the changegroup packer
Summary:
Previously, during a push the changegroup packer had no information about the
destination server, aside from what changegroup version it supported. In a
future diff we'll want to package certain files and trees based on if the server
is a main server or not, so let's pass thread the bundle2caps down to the
changegroup packer.

The changegroup already had the old style bundlecaps on it, but those
capabilities don't actually exist on the client side during a push, so let's
just use the bundle2 ones, which are more modern anyway.

Differential Revision: D7297899

fbshipit-source-id: 74ab529baccbdc999267555779a10c0d27f8bd47
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
Ryan McElroy
b2007943be templater: provide hint for templates with parse errors
Summary: Help people debug issues by providing useful hints when templates fail to parse.

Differential Revision: D7148780

fbshipit-source-id: bd2b0f2bdeb0c970732fcaf53854d4a003b08571
2018-04-13 21:51:30 -07:00
Ryan McElroy
2e2949fcbf revsetlang: add a hint for more useful parse errors
Summary:
This logic is largely based on the similar logic added to template error
messages in D2608 and D2609, but with a few tweaks based on how revsets
actually work.

Differential Revision: D7148779

fbshipit-source-id: fb435788711a2c4ef881dfaeac5176fc1972c07a
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
a5c5d43e98 hg: fix infinitepush phases test
Summary:
I somehow had a brain fart before landing my infinitepush phases diff
and replaced a hash with a rev number, even though rev numbers don't work with
infinitepush. This fixes that.

fbshipit-source-id: aa85614d40e173f6472cb9570af8510eb15ea353
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
Durham Goode
e3898ae004 hg: add test for infinitepush messing up phases
Summary:
There's a bug in infinitepush where it can cause client phases to get
screwed up. This affects pulls where multiple stacks were uploaded at once, then
only part of the stack is pulled. Let's add a test to expose the bug.

Reviewed By: singhsrb

Differential Revision: D7265104

fbshipit-source-id: ec1320d46ec865e8fbcf324e8d94737a5c111ef7
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
Xinjie Lei
3963adf502 Delete unnecessary test command
Summary: Delete an unnecessary test command which delete a non-existed local bookmark.

Reviewed By: StanislavGlebik

Differential Revision: D7216466

fbshipit-source-id: f8fc4215ef1fa725c5e5f92ef03cc2616326ac59
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
Durham Goode
d80a47a7a7 hg: add test for treeonly rebundling during infinitepush
Summary:
If we're pulling just part of an infinitepush bundle, it needs to
rebundle the data. We had a test for this for flat manifests, but we need a test
for treeonly commits as well. The test currently fails with an error. A future
diff will fix the error.

Reviewed By: quark-zju

Differential Revision: D7240342

fbshipit-source-id: 6acda3dfa6059f0957507a951df1b5e97df6dc4e
2018-04-13 21:51:27 -07:00
Durham Goode
2dd1a9d90b hg: test that the manifest is readable in treeonly infinitepush test
Summary:
Previously we just verified the pull worked. Let's also verify the
manifest is readable.

Reviewed By: quark-zju

Differential Revision: D7240341

fbshipit-source-id: 75c97591592699ff582fec5169ea20e0549fc603
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