Commit Graph

45301 Commits

Author SHA1 Message Date
Mark Thomas
3c5d3fba54 visibility: add pushrebase support
Summary:
Support updating of commit visibility when using pushrebase.  Since obsmarkers
may not be available, this also involves looking at the commit mutation data
returned from the server.

Reviewed By: DurhamG

Differential Revision: D12980783

fbshipit-source-id: 837e356e500e7bf9710a3619a31094cae21d36c9
2019-03-08 03:05:58 -08:00
Mark Thomas
d7375d7397 visibility: update visibility when commits are modified
Summary:
When commits are added or modified, update the set of visible heads if
visibility tracking is enabled.

Reviewed By: DurhamG

Differential Revision: D12980779

fbshipit-source-id: 8f44045159c86a374ae530fa4327ee0807b4320d
2019-03-08 03:05:58 -08:00
Mark Thomas
cfbe15d7d2 visibility: add storage of visible heads
Summary:
Add a method of tracking explicit visible heads.  Rather than using the
implicit set of commits that are not obsoleted (which may differ between repos
that are connected to a single commit cloud workspace), we instead track commit
visibility explicitly.

This is more like the git model, where only commits that are reachable from
refs are considered for most operations, except that we keep track of the heads
automatically, and use obsmarkers to keep track of the obsoleted commits,
rather than garbage collecting them.

Reviewed By: DurhamG

Differential Revision: D9560361

fbshipit-source-id: 07dabfc04415f2ecb97d57c4e3944c071579ee50
2019-03-08 03:05:57 -08:00
Mark Thomas
edbb3112bd templatekw: disable obsolescence fate templates when mutation enabled
Summary:
Disable the various templates that attempt to determine the fate of a
particular commit based on obsmakers when mutation is enabled.  The old
templates were either insufficiently generic (e.g. `amendsuccessors`), or
leaked internal implementation (e.g. `succsandmarkers`).

With mutation enabled, callers should use the `mutations` template to get a
list of a commit's mutations.

Reviewed By: DurhamG

Differential Revision: D12980772

fbshipit-source-id: 920d47f7c61ad52f562cd90f1cb405250c14bc25
2019-03-08 03:05:57 -08:00
Mark Thomas
3b41f2f54c mutation: detect landed commits using synthetic mutation records
Summary:
Add support for detecting landed commits.

Since we don't currently have an index for successor information in the
changelog, we can only detect the successor relationship for predecessors of
draft commits (for which we build a cache).  As a temporary workaround,
make it possible to put mutation records in the mutation store that lead to
landed commits.  These will allow land detection to work until we have a
changelog that supports indexing on predecessor.

Reviewed By: quark-zju

Differential Revision: D12980780

fbshipit-source-id: d7b14fa073d0406990b92731fe66dfe1c73b404c
2019-03-08 03:05:57 -08:00
Mark Thomas
2e67ee0c44 templatekw: add mutations template keyword
Summary:
The `mutations` template keyword expands to a list of the results of mutating
the commit.  Each element of the list has an `operation` field, which is a
string describing the mutation operation, and a `successors` field, which is a
list of the successor commits for this operation.  Sequences of mutations that
result in a single successor are collapsed into a single `rewrite` operation.

Reviewed By: quark-zju

Differential Revision: D12980787

fbshipit-source-id: 82be2f9131832209cc3ab088f587c45f8c45a9ad
2019-03-08 03:05:57 -08:00
Mark Thomas
6ce749a3e1 infinitepush: exchange mutation information via infinitepush bundles
Summary:
Include mutation records for all predecessors of the pushed commits in
infinitepush bundles.

When received from infinitepush, store these additional records in the local
store.  This allows us to bridge any gaps in mutation that are omitted from the
local commits when they are received from infinitepush.

Reviewed By: DurhamG, quark-zju

Differential Revision: D12980777

fbshipit-source-id: b1535ca29c0fca3e6cb0f563d78c4c60d4aef58e
2019-03-08 03:05:57 -08:00
Mark Thomas
13a768d274 debugcommands: support mutation store in debugmutation
Summary:
The debugmutation command should also show information about mutation entries
in the mutation store.

Reviewed By: DurhamG, quark-zju

Differential Revision: D12980785

fbshipit-source-id: 06c3ec2cb9c42edf43729ba3b7c471b1bf8dfb96
2019-03-08 03:05:57 -08:00
Mark Thomas
78d4d4ce49 mutation: look-up entries in the store when traversing mutations
Summary:
When traversing mutation entries, if we don't have any information for a
commit, then look instead in the store to see if we have a cached entry
from a non-local commit there.

There aren't any ways of putting entries there, yet.  Those will come in
later commits.

Reviewed By: DurhamG

Differential Revision: D12980776

fbshipit-source-id: 63ff12382eb9294aa43ff100a4fe19b7c05f9e61
2019-03-08 03:05:57 -08:00
Mark Thomas
b416acce15 histedit: use mutation information for adjusting replacements
Summary:
Histedit needs to adjust its records of what commits are replaced.  Currently
it does this by examining obsmarkers.  If mutation is enabled, use the mutation
information instead.

Reviewed By: quark-zju

Differential Revision: D13279987

fbshipit-source-id: e9622a67635afe2023088fdf0e0b43b0bcd9223f
2019-03-08 03:05:57 -08:00
Mark Thomas
6ff8a8a394 mutation: create common access methods for mutation information
Summary:
We will be making looking up entries for complex by adding a secondary store of
the information.  Make accesses to this information common through lookup
functions.

Reviewed By: quark-zju

Differential Revision: D13279986

fbshipit-source-id: a30084b548762e69cb354c3760d7ec66027a24e1
2019-03-08 03:05:57 -08:00
Mark Thomas
b059c3a3bf mutation: implement successorssets and foreground
Summary:
Implement successorssets and foreground in terms of mutation records and
replace them when mutation metadata usage is enabled.

Reviewed By: quark-zju

Differential Revision: D10149263

fbshipit-source-id: bbf6d1fc44a9787660147e15936a9ee1951373ca
2019-03-08 03:05:56 -08:00
Mark Thomas
892986d685 mutation: use mutation information for revsets
Summary:
When enabled, use mutation metadata for the `obsolete`, `extinct`, `orphan`,
`phasedivergent` and `contentdivergent` revsets.

Reviewed By: quark-zju

Differential Revision: D10149265

fbshipit-source-id: 5559fa22a6025e1d341538f3eb2257d8efee15e5
2019-03-08 03:05:56 -08:00
Mark Thomas
a14bfeebbb mutation: add mutationcache
Summary:
Add a mutationcache to the repo.  This computes the following information:

* The successor sets for all predecessors of visible commits - these are the
  sets of immediate successors for each commit.
* A map from commits which are the results of splits to the final split commit.
* The set of public commits that have visible draft successors.
* The set of draft commits that have multiple sets of visible eventual successors.
* The set of obsolete commits - draft commits with visible eventual successors.
* The set of orphan commits - commits with obsolete ancestors.
* The set of extinct commits - obsolete commits with no orphaned descendants.

These sets will be used later on to replace the obsmarker-based equivalents.

Reviewed By: DurhamG

Differential Revision: D13279988

fbshipit-source-id: 3f063bb68aaba2f19da257efdf79b485b947b7b1
2019-03-08 03:05:56 -08:00
Stefan Filip
b7dee64bd2 manifest: fix tree entry serialization
Summary:
Follow up from D14178264.

Two changes:
 * tree manifest entries must end with a line feed
 * `t` is the byte that flags a directory

Reviewed By: DurhamG

Differential Revision: D14368316

fbshipit-source-id: b0b46c876649b8f25bf0ecdb1266527dbeb33796
2019-03-07 17:51:39 -08:00
Stefan Filip
660992a50a manifest: add tree::diff(Tree, Tree)
Summary:
`manifest::tree::diff()` returns an iterator over the differences between two
tree manifests.

I chose a function that takes two parameters over a method on Tree because it
felt more clear to write `left` and `right`. Also because I am not sure how
iterators would be abstracted on a trait.

Differential Revision: D14347656

fbshipit-source-id: 537574070cd18b08c77b3cd1cf4cff38d77fbf81
2019-03-07 17:46:44 -08:00
Stefan Filip
2deb0e6e42 manifest: add tree::Cursor and Tree::files()
Summary:
Cursor is a utility for iterating over a manifest tree. In this diff it is used
to implement Files. In the future it will be used to do a diff between two tree
manifests.

I am not sure how to describe an iterator return value in the Manifest trait so
I kept the function on the tree only for now. Looking forward to hearing your
suggestions.

Differential Revision: D14347655

fbshipit-source-id: ffd856443d8abe3ebd0557a096bf7a5ec46312d3
2019-03-07 17:46:44 -08:00
Xavier Deguillard
f868d77cd1 revisionstore: use remove_file from vfs.rs
Summary: The historypack wasn't using remove_file from vfs which was causing repack to fail.

Reviewed By: sfilipco

Differential Revision: D14373649

fbshipit-source-id: 2d87f24bda541bc011ed38533db1ac7bdddc81e3
2019-03-07 15:24:10 -08:00
Jun Wu
426a80a117 zstd: back out "make Python APIs zero-copy"
Summary:
Original commit changeset: af43d4cce555

D14338313 didn't trigger the main `.t` tests. A lot of things actually
depend on `zstd` APIs returning `bytes`. Therefore back out the change.

Reviewed By: DurhamG

Differential Revision: D14372351

fbshipit-source-id: d8daa7d1d2a49d9d0c4d48de22ed0567d1d953a7
2019-03-07 13:30:10 -08:00
Mateusz Kwapich
1f26aa77eb improve githelp for 'rebase -i'
Summary: We have rebase -i, let's mention it.

Differential Revision: D14363798

fbshipit-source-id: 94d3322af8dafd8fc81bfcfc86b61227bec85968
2019-03-07 13:11:28 -08:00
Jun Wu
40044e66d5 tests: remove hgweb, commandserver, and http related tests
Summary:
We don't care about hgweb, or commandserver, or the Python http interface.
Maintaining those low-impact tests for breaking changes have been a pain.
Therefore just remove them, to make upcoming breaking changes slightly easier.

There are also long tests which are written in ways that are very hard to
maintain, namely:

- test-command-template.t
- test-glog.t
- test-revlog.t

We might just rewrite them once we have ideas about what the replacement
APIs are.

Reviewed By: DurhamG

Differential Revision: D14222121

fbshipit-source-id: 5c18f32bb55fb20cf8ccafe1cdd169a4ffaaf5ce
2019-03-07 13:06:29 -08:00
Stefan Filip
c305e13566 manfiest: mark FileMetadata as Copy
Summary:
`Node` is marked as `Copy`. `FileMetadata` is not much more than `Node` so it
seems pretty clear that it should be marked `Copy`.

Reviewed By: DurhamG

Differential Revision: D14347657

fbshipit-source-id: 939abf88087bc8c6f942047a08d6a4a0d61e053f
2019-03-07 11:20:07 -08:00
Stefan Filip
5b370ffb72 manifest: move tree link to a separate file
Summary:
Cleaning up the `mod.rs` file so that it provides more signal.
`Link` is an internal implementation detail that other internal components may depend on so it is a great candidate to be moved to a dedicated file.

Differential Revision: D14347654

fbshipit-source-id: e5b5a42faf1e9f9c4a0591e5bd94182391ed511f
2019-03-07 11:20:07 -08:00
Liubov Dmitrieva
6a40cb0312 infinitepush - better handling changes of the path
Summary:
Unfortunately, Mononoke team needs to rename paths to add the markers everywhere.

They deprecated mononoke url:

ssh://hg.vip.facebook.com//mononoke/fbsource

And they are asking us not to use ssh://hg.vip.facebook.com//data/scm/fbsource url without markers.

We finally agreed to have:

```
infinitepush = ssh://hg.vip.facebook.com//data/scm/fbsource?force_mercurial

infinitepush-other = ssh://hg.vip.facebook.com/data/scm/fbsource?force_mononoke
```

So, we would like that rename of the path don't cause `hg sl` show that nothing is backed up.

We use the path as part of our filename.

So, we will go to the server to check the commits, it might slow down a bit the very first `hg sl` or `pushbackup` after the path change, but it should be acceptable.

Reviewed By: quark-zju

Differential Revision: D14366820

fbshipit-source-id: a0fd7bad530dd6690926fe02d38b93c2a72df00b
2019-03-07 11:01:30 -08:00
Liubov Dmitrieva
f23f981dba inifinitepush: raise error for unsupported commands with Mononoke
Summary:
Basically the supported ones are:

hg pushbackup
hg isbackedup -r <rev> --remote

Unsupported:
hg pullbackup
hg getavailablebackups
hg backupdelete
hg debugcheckbackup

Supported (client side):
hg backupenable
hg backupdisable
hg debugwaitbackup

Reviewed By: DurhamG

Differential Revision: D14106642

fbshipit-source-id: ebdea01b72333692b1a65d138c1dee21874a45c0
2019-03-07 07:56:22 -08:00
Jun Wu
932bb1492c zstd: make Python APIs zero-copy
Summary:
Make them zero-copy to reduce overhead. A side effect is the types become
`bytearray`, instead of `bytes`. It seems fine for zstd use-case.

Reviewed By: ikostia

Differential Revision: D14338313

fbshipit-source-id: af43d4cce5559fe877373737a71e1e1678a17ca7
2019-03-06 21:35:10 -08:00
Saurabh Singh
c305090b83 globalrevs: fix formatting for 'hg help globalrevs'
Summary: See title

Differential Revision: D14332372

fbshipit-source-id: f4a25ae034d66e7c9f8ab6bb44c8919c717e35c2
2019-03-05 16:48:14 -08:00
Stefan Filip
6d9dc154ca manifest: add flush function to manifests
Summary:
Save, finalize, flush, they mean about the same thing.

The first thing to note is that this implementation is not complete because
the parents are not correctly passed into the hashing function.

The second thing is that store failures make the code a little more complex
than it would have been otherwise.

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D14292713

fbshipit-source-id: 807d7a385a62cb5f4948f1781d3146eaa6502ca9
2019-03-05 16:12:48 -08:00
Stefan Filip
25edcc014b manifest: inline store_entry_to_links
Summary:
This function is a bit on it's own with the removal of the pair conversion.
Since it is used in only one place it makes sense to inline it.

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D14292712

fbshipit-source-id: abbf1dc70d61c0ad039f5bc5ed5277d0770e3899
2019-03-05 16:12:48 -08:00
Stefan Filip
c5cc253234 manifest: refactor tests to use store::Entry::from_elements
Summary:
Working on the save mechanism I realized that links_to_store_entry is not that
useful because we can avoid the failure states where we would try to serialize
an ephemeral node. I am removing that function and converting the code that was
using that function to using the Entry constructor directly.

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D14292714

fbshipit-source-id: 54ef46670319c27d90fc78511a1eb6abf47d3acf
2019-03-05 16:12:48 -08:00
Stefan Filip
43fb573c23 types: add explicit conversions from owned paths types to unsized ref
Summary:
There are scenarios where an &PathComponentBuf or a &RepoPath will show up.
An example when using get from a HashMap. These are not the references that we
are looking for. We want &PathComponent and &RepoPath respectively. Adding
explicit conversions.

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D14292711

fbshipit-source-id: 29f4de25c2ffebf7f009e4f2515e0ba8f0371ae0
2019-03-05 16:12:47 -08:00
Stefan Filip
765659d505 manifest: update tree manifest to take owneship of Store
Summary:
This is what Rust is telling us to do. The situation that triggers this update is
writing to the store. Particularly when the store is an in memory hashmap we
need to have a mutable borrow to the hashmap to insert into it. From a general
point of view this means that any sharing of the store between different
instances of a manifest will have to be handled by the struct that implements
the `Store` trait.

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D14292716

fbshipit-source-id: 6e789527dbdf3cd3ffe967f4900251bf31f7d6b2
2019-03-05 16:12:47 -08:00
Stefan Filip
fcc560357a types: add RepoPathBuf::pop()
Summary:
The practical aspect of this method comes when iterating over a tree and having
to maintain the current path. When going deep we will be pushing path
components and when coming back we will be poping path components.

I am not sure if it makes sense to return the path component or not. However I
believe that we should return some sort of error when RepoPath is empty.

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D14292715

fbshipit-source-id: 4ef1e10de7a60775340063b5baa317d3d626bc64
2019-03-05 16:12:47 -08:00
Stefan Filip
14f26aa355 manifest: add remove implementation for tree
Summary:
Removes a file from the manifest. Nothing special for it.

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D14276645

fbshipit-source-id: 85e8ffd6cffee426c73eb627484dfa5a866a364b
2019-03-05 16:12:47 -08:00
Stefan Filip
1e9b7fafe9 manifest: refactor get_link out of manifest::get to allow code reuse
Summary:
It is going to be useful in tests to check how certain internal nodes change
so adding an api that allows fetching an internal node.

(Note: this ignores all push blocking failures!)

Differential Revision: D14276642

fbshipit-source-id: 9a3e488be6031f7b4727a8643f64970dcec8c400
2019-03-05 16:12:47 -08:00
Stefan Filip
e2b06628cd manifest: update Tree::get() to use RepoPath::parents()
Summary:
This removes the need for the local buffer for the parent.

(Note: this ignores all push blocking failures!)

Differential Revision: D14276648

fbshipit-source-id: a9378ea592d502ddf2dcdc35fe6ffa9ba213bc14
2019-03-05 16:12:47 -08:00
Stefan Filip
3c2c09f431 manifest: update tree::Manifest::insert
Summary:
Using the recently added path utilities so that we don't keep a secondary
parent buffer around.
Updating the file insert logic so that it is readable and intuitive.

(Note: this ignores all push blocking failures!)

Reviewed By: quark-zju

Differential Revision: D14276649

fbshipit-source-id: 8e7e835814f0039645601abbf1b701e8c1ed3697
2019-03-05 16:12:47 -08:00
Stefan Filip
dd2bfc6c04 types: add test for to_owned() on Path types
Summary:
I had an issue where I incorrectly ended up with a &&RepoPath. While debugging
I added this tests to validate my sanity. I think that keeping these tests is
useful for the future.

(Note: this ignores all push blocking failures!)

Differential Revision: D14276640

fbshipit-source-id: d7e1cedc80b3a0ecb97e5a0c80fc4eea110e943f
2019-03-05 16:12:47 -08:00
Stefan Filip
f71814f8e2 types: add dedicated iterator type for RepoPath::components()
Summary:
The current implementation has some gotchas that are related to how the `split`
method is implemented for `&str`. The new implementation is more clear for how
we construct path components

(Note: this ignores all push blocking failures!)

Differential Revision: D14276639

fbshipit-source-id: 1a22c177ba570915b7952eee78ed9191f7b72976
2019-03-05 16:12:47 -08:00
Stefan Filip
27c0d1c991 types: add RepoPath::last_component()
Summary:
Return the last component of the path. The empty path, `RepoPath::empty()`
does not have any components so `None` is returned in that case.

(Note: this ignores all push blocking failures!)

Differential Revision: D14276643

fbshipit-source-id: 9c4caf455891e77d03f22d81b39e3a34ae61ffcc
2019-03-05 16:12:47 -08:00
Stefan Filip
ed6e6245ad types: add RepoPath::parent()
Summary:
`RepoPath::parent` returns the parent of the path. The empty path,
`RepoPath::empty()` does not have a parent so `None` is returned in that case.

(Note: this ignores all push blocking failures!)

Differential Revision: D14276641

fbshipit-source-id: fc60da9750dc76e4f598dd483a63adc180135cb4
2019-03-05 16:12:47 -08:00
Stefan Filip
736cfe89bd types: add RepoPath::split_last_component()
Summary:
Tries to split the current `RepoPath` in a parent path and a component. If the
current path is empty then None is returned. If the current path contains only
one component then the pair that is returned is the empty repo path and a path
component that will match the contents `self`.

(Note: this ignores all push blocking failures!)

Differential Revision: D14276644

fbshipit-source-id: e85a22f65cc267e48f12af6bf6b40c7673b7eaaa
2019-03-05 16:12:47 -08:00
Stefan Filip
68b6897a78 types: Add RepoPath::parents()
Summary:
An iterator for the parent directories of a path.

(Note: this ignores all push blocking failures!)

Differential Revision: D14276646

fbshipit-source-id: 2b580ee8d762db5113110ec9b09ec3a093a1063a
2019-03-05 16:12:47 -08:00
Stefan Filip
ffffdd2a44 types: Add RepoPath::empty()
Summary:
This diff defines the empty `RepoPath`. This path is equivalent with the root
of the repository.
Also adding a method to check whether a `RepoPath` matches this special path.

(Note: this ignores all push blocking failures!)

Differential Revision: D14276647

fbshipit-source-id: 6e9ad5957ad39a711a1680bd084f448bb9d73f87
2019-03-05 16:12:47 -08:00
Xavier Deguillard
f09d3b816c treemanifest: fix repack and backfilltree
Summary: These 2 commands were broken when treemanifest.treeonly=True was set

Reviewed By: DurhamG

Differential Revision: D14316779

fbshipit-source-id: e626df41c92036fa3bd61c072f09b0d6c99c6f9f
2019-03-05 11:40:46 -08:00
Stanislau Hlebik
48e7592c3e localrepo: fix changed file generation
Summary:
If an executable filenode was reused from p2 and mode hasn't been
changed (i.e. a filenode was executable and it is still an executable after a
merge) and and p1 didn't have this file at all then file will still be listed as
changed just because manifest1.flags(fname) returns ''.

After this diff if a filenode is reused then file will be listed as changed
only if it's a parent from where this filenode was reused have different flags.
So if filenode was reused from p1/p2 and p1/p2 has same flags and new
filenode, then file is not listed. But if filenode was reused from p1 and p1
has different flags, then filenode won't be reused.

It's possible that both new filenode is equal to both p1 and p2. In that case
we'll compare only with p1's mode.

Note that it's only get triggered during pushrebase, because during local
commits `fctx.filenode()` is None

Reviewed By: DurhamG

Differential Revision: D14300214

fbshipit-source-id: 1bf6c4802cfce5db6654da673333a56389432617
2019-03-05 10:53:32 -08:00
Arun Kulshreshtha
e6909b217b edenapi: pretty print keys in debug output
Summary: Now that `Key` has a `Display` implementation that produces useful output (namely the filenode and path as strings rather than bytes), we can use it to get better debug output.

Differential Revision: D14310544

fbshipit-source-id: ace5b76f07aa1216b5e9aae22dc7b6bd561e9560
2019-03-04 19:22:19 -08:00
Xavier Deguillard
5ede544f83 asyncpacks: remote unecessary Arc<Mutex> from the mutable packs
Summary:
Since all the methods of an aync mutable pack are taking the ownership of self,
there can only be one accessor to self, and therefore the Mutex is not
required. For the same reasons, the Arc can be removed.

This saves a bunch of atomic operation when operating on the mutable packs.

Reviewed By: kulshrax

Differential Revision: D14287252

fbshipit-source-id: 792bc41aa0dc372e2114dfca4895cca7083f3a56
2019-03-04 13:48:11 -08:00
Xavier Deguillard
073c33a933 asyncpacks: AsyncWrapper only accept Sync types
Summary:
Since most of the datastore/historystore types are already Sync, we don't
really need to wrap them in a Mutex. For the ones that aren't Sync, we can
easily wrap them in a Mutex and pass that to AsyncWrapper.

Reviewed By: kulshrax

Differential Revision: D14287253

fbshipit-source-id: 0f5c04c651592561403caa6e4627017ab1731d0a
2019-03-04 13:48:11 -08:00
Xavier Deguillard
0fdc258804 remotefilelog: add a packfile remote store
Summary:
When searching for data, mercurial will search the datastores by first looking
into the local cache, then try to find the data over the network. When
remotefilelog.fetchpacks is enabled, all the data fetched over the network will
be stored into packfiles, but those fetches are done via the loose-files remote
datastore. Due to this, even if memcache successfully find the requested data,
the datastore won't find it, due to it expecting loosefiles.

Fixing this simply requires the fetches to be done via a packfile store when
remotefilelog.fetchpacks is enabled.

Reviewed By: DurhamG

Differential Revision: D14216815

fbshipit-source-id: ed97c64651a733b36e0f2b4e209ce8ccdbb7911e
2019-03-04 13:48:11 -08:00