Commit Graph

45264 Commits

Author SHA1 Message Date
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
Arun Kulshreshtha
2ab9df3b9d types: implement Display for Key
Summary: Implement the `Display` trait for `Key`. This is important for human-readable output for debugging since both filenode and path inside the `Key` are stored as byte arrays, which are just printed out as numbers by the derived `Debug` implementation.

Differential Revision: D14294970

fbshipit-source-id: a601dc9a0c23ac40894ec27135171928f5635507
2019-03-04 12:11:23 -08:00
Saurabh Singh
091c77ffa5 setup: start bundling the memcommit extension with the package
Summary:
This commit is to start including the memcommit extension in the
Mercurial package.

Reviewed By: quark-zju

Differential Revision: D14293241

fbshipit-source-id: c6e840d66e7e31b35d6c6aea176043cf56a16ad2
2019-03-04 09:32:25 -08:00
Johan Schuijt-Li
fe14359a3b logginghelper: log normalized repo name
Summary:
Filter query strings from logging helper to avoid polluting logging tables with
parameters.

Reviewed By: StanislavGlebik

Differential Revision: D14298421

fbshipit-source-id: fe5d405570ce6f0e16d574b9970b2d526ec8b5c9
2019-03-04 00:05:00 -08:00
Stefan Filip
82bbd0326f manifest: improve store imports in tree/mod.rs
Summary:
We currently alias many of the imports from the store submodule. It is nicer
if we just import the submodule name and prefix with the submodule.

Differential Revision: D14276638

fbshipit-source-id: 6661df7f9cb5d976b11153003f653a1f66301c9a
2019-03-03 12:35:50 -08:00
Xavier Deguillard
7e6fe67687 remotefilelog: give memcache the right cache directory for packsfile
Summary:
When using memcache in its packfile mode, the key no longer contains the name
of the repo, and therefore, memcache will store the downloaded packfiles under
/var/cache/hgcache instead of /var/cache/hgcache/fbsource/packs.

Reviewed By: quark-zju

Differential Revision: D14217056

fbshipit-source-id: f78ce1021985dbb71a1db21d8821e8b8fcda8179
2019-03-01 11:15:25 -08:00
Mark Thomas
87da4d2043 infinitepushbackup: always check remote when checking remote backups
Summary:
Currently when checking if a commit is backed up on the server, we assume that
if the local backup state says it is not backed up then the server can't have
it.  However, it's possible for the local repo to have received the commit
from elsewhere even if the backup state says it is not backed up, when in fact
it is.  Make the --remote flag always check with the server, even if the local
state says the commit is not backed up.

Reviewed By: ikostia

Differential Revision: D14279495

fbshipit-source-id: cbd8253c6bfd0ee4cc3f573fabe5b632af7ad569
2019-03-01 10:04:18 -08:00
Arun Kulshreshtha
6c5123d822 remotefilelog: add newlines to docstring
Summary: Apparently we need to add newlines between config items in the docstring to ensure that it gets formatted correctly in the help output. A similar change was made upstream: https://www.mercurial-scm.org/repo/hg/rev/040447dc3c62

Reviewed By: quark-zju, singhsrb

Differential Revision: D14267738

fbshipit-source-id: c61f67f2c119fd9d71326eb42c2a4aa2106573da
2019-02-28 19:47:05 -08:00
Arun Kulshreshtha
b855ea2fbc fileserverclient: add ability to request packs over http
Summary: Allow file data/history packs to be fetched via HTTP when the Eden API is enabled.

Reviewed By: quark-zju

Differential Revision: D14257368

fbshipit-source-id: 8b6823a57a6fdef546a596df20387b3fc1ccdd4a
2019-02-28 17:10:47 -08:00
Arun Kulshreshtha
5f578e136c remotefilelog: add debuggethistory command
Summary: This diff adds a new `hg debuggethistory` command that takes filenode/path pairs from stdin, fetches the history of the files from the API server, and writes the results to a historypack in the hg cache.

Reviewed By: quark-zju

Differential Revision: D14248082

fbshipit-source-id: 8014a758abd3a578ea213d8d3177812629b2fd51
2019-02-28 15:42:17 -08:00
Arun Kulshreshtha
55171a856b remotefilelog: attach edenapi client to repo object
Summary: The Eden API client in Mercurial should be a singleton. This diff assigns the client to `repo.edenapi` so that it is accessible throughout the code.

Reviewed By: quark-zju

Differential Revision: D14233314

fbshipit-source-id: 8e0ed22c32611e8f6e7d4461c3e31870d47a0e95
2019-02-28 15:42:17 -08:00
Arun Kulshreshtha
6181da2178 edenapi: add method to get file history
Summary: Add a `get_history()` method to the `EdenApi` trait that queries the API server's `getfilehistory` endpoint and writes the resulting history entries to a historypack in the user's cache.

Differential Revision: D14223269

fbshipit-source-id: bf69c767f5a89177c36e755250330dbbbc219e4f
2019-02-28 15:42:17 -08:00
Arun Kulshreshtha
0fc20f828d remotefilelog: add --long option to debughistorypack
Summary: Add a `--long` option, similar to the one avaiable on `hg debugdatapack`, which prints full node hashes.

Differential Revision: D14256168

fbshipit-source-id: 342932aa4dd96197daf6bbba7b5bc8623ebbf9bd
2019-02-28 12:52:57 -08:00
Arun Kulshreshtha
1f6435f6c1 asyncpacks: add add_entry() function
Summary: Add an `add_entry()` method, similar to D14162781 which did the same for non-async packs.

Differential Revision: D14246980

fbshipit-source-id: 8c8f507f2e0133d80d826d04345df7b41d6013a3
2019-02-28 12:47:13 -08:00
Liubov Dmitrieva
51cd05bf46 commitcloud remove excessive details on tls error
Summary: just provide the important information

Reviewed By: quark-zju

Differential Revision: D14230573

fbshipit-source-id: 945bb0be48ed38ba4511d0cef605ef0b7baa2b5d
2019-02-27 20:56:30 -08:00
Adam Simpkins
b360d9ee62 make debugedenimporthelper require an --out-fd argument
Summary:
When using the `debugedenimporthelper` subcommand that is part of `hg` itself
it is much more important to make sure that we don't try to use `stdout` as
the import communication mechanism.

The old `hg_import_helper.py` script more carefully set up its own `UI` object
to try and avoid ever printing any messages to `stdout`.  However it isn't
easily possible to do this as part of the normal `hg` program.  Therefore
abort the command if `hg debugedenimporthelper` is ever run without an
`--out-fd` argument.

This also helps avoid potentially confusing users by printing binary data to
stdout if they invoke accidentally `hg debugedenimporthelper` interactively in
a terminal.

Reviewed By: chadaustin

Differential Revision: D14222372

fbshipit-source-id: 7e0829dff41b2bca28c7f4539b90c6c354f8c79f
2019-02-27 13:44:29 -08:00
Adam Simpkins
a6832788b5 allow hg debugedenimporthelper to use the normal repo object
Summary:
This starts to fix some of the `hg debugedenimporthelper` behavior and make it
work more like most other hg subcommands with respect to how it finds the hg
repository.

Previously the code was copied into hg largely as-is from an external script
that took the repository path as a separate argument.  This resulted in
confusing behavior as it completely ignored the normal repository object
opened by `hg`.

This makes `debugedenimporthelper` honor the normal hg repo object if the
extra repository path argument is not specified.

Reviewed By: chadaustin

Differential Revision: D14222323

fbshipit-source-id: 57048178b588dd1dd7150184665d6c13427d6b56
2019-02-27 13:44:29 -08:00
Arun Kulshreshtha
a430c04f81 revisionstore: use AsRef<Path> in constructors
Summary: `AsRef<Path>` is more ergonomic than `&Path` since the former can accept `PathBuf`, `String`, etc.

Differential Revision: D14223167

fbshipit-source-id: 12d26adaa63855c339e04734c19d6697624f9c9e
2019-02-27 12:43:43 -08:00
Xavier Deguillard
b6d63aaabd remotefilelog: ignore OSError when cleaning temporary files
Summary:
When the pack directory is missing, os.listdir will throw an OSError. Instead
of failing repack, let's just ignore the error.

Reviewed By: singhsrb

Differential Revision: D14234830

fbshipit-source-id: 14e683b7d850ab316d9821031e91a19e5f2f4c1e
2019-02-27 11:35:56 -08:00
Xavier Deguillard
176e57b6d0 remotefilelog: do not error when the repack lock is already held
Summary:
Instead of falling back to python, we should just skip the current repack. The
python code already does this, but the rust one will report the error to the
user (and scuba).

Reviewed By: singhsrb

Differential Revision: D14234831

fbshipit-source-id: d285499ae85205d6ccee3c22eb50352d77673488
2019-02-27 11:35:56 -08:00
Stefan Filip
d543e91b45 types: order imports in path.rs
Summary:
The order of imports we're trying to follow is: std, remote crates
(ie: crates.io), local crates (ie: fbcode crates), and crate local. A new line
in between each group can be used to prevent rustfmt from re-ordering them.

Reviewed By: singhsrb

Differential Revision: D14243163

fbshipit-source-id: fbbb07693af14b13ae6b3f4e788972d99193fd64
2019-02-27 10:00:40 -08:00
Stefan Filip
6825832b19 manifest: order imports
Summary:
The order of imports we're trying to follow is: std, remote crates
(ie: crates.io), local crates (ie: fbcode crates), and crate local. A new line
in between each group can be used to prevent rustfmt from re-ordering them.

Reviewed By: singhsrb

Differential Revision: D14243162

fbshipit-source-id: 6fc2cceb3d6834b602be20b8b8f74e0f61b227e1
2019-02-27 10:00:40 -08:00
Stefan Filip
b20f22f0a7 manifest: implement tree entry serialization/deserialization
Summary:
This diff focuses on addding deserialization. Because the most effective way
 of testing deserialization is doing round-trip conversions we also implement
 serialization.

 `manifest::tree::store::Entry` is the structure that is in charge of perfroming
 serialization and deserialization. We update the Store trait to interface with
 this new object.

Differential Revision: D14178264

fbshipit-source-id: bb12262c181a518ba4111d40c079d6836ec44301
2019-02-27 10:00:40 -08:00
Stefan Filip
5809294733 manifest: replace crate lazy-init with once_cell
Summary:
The `once_cell` crate is more flexible than `lazy-init`. It has more types,
a richer api, recent updates and more features.

Differential Revision: D14232727

fbshipit-source-id: 14aeb34a96e094069bb8dc3fb5efcf5b5707ce8c
2019-02-27 10:00:40 -08:00
Durham Goode
1c4bc4c533 treemanifest: don't crash when pushing empty commits
Summary:
When pushing an empty commit, the server receives a pack part with no
data, which ends up not producing any pack files. Some newly added logic tries
to access the pack paths, which then crash.

Let's fix it so we get None for the paths in this situation, and update the only
consumers of those paths to handle the None case.

Reviewed By: quark-zju

Differential Revision: D14237452

fbshipit-source-id: 418bd30179fdb76b9de3bc2c2509079502edfef8
2019-02-27 09:53:16 -08:00
Mark Thomas
2603eab68c flake8: fix lints for unused imports and variables
Summary:
Fix lint errors involving unused imports and variables.  In some cases we are
relying on the side effect of importing, so tag these with the appropriate
noqa flag.

Reviewed By: ikostia

Differential Revision: D14241398

fbshipit-source-id: b639af47c563f914a54188af48f1f9100442d08f
2019-02-27 06:26:06 -08:00
Jun Wu
6a639c1153 sshaskpass: workaround sys.executable
Summary:
The Rust entry point has an incorrect `sys.executable`. Workaround it with a
hard-coded `python2` for now.

Differential Revision: D14236437

fbshipit-source-id: 97d99d59365c2d5c70bfdeebc66b51f870073ded
2019-02-26 18:19:43 -08:00
Saurabh Singh
f93cde953d hgsql: execute memcommit with the hgsql lock
Summary:
We need to ensure that memcommit is executed with the hgsql lock if
the `hgsql` extension is enabled.

Reviewed By: DurhamG

Differential Revision: D14177416

fbshipit-source-id: dcabf08003b618579461c608f924fe7f5b796c37
2019-02-26 13:16:35 -08:00
Saurabh Singh
ac86455d22 memcommit: print JSON output for easy consumption by clients
Summary:
The `memcommit` command output will be processed by the calling
process and therefore, let's just output JSON for easy consumption.

Reviewed By: quark-zju

Differential Revision: D14177417

fbshipit-source-id: 541cf73fa2bef20512164b43f1c4224415fba596
2019-02-26 13:16:35 -08:00
Saurabh Singh
5b52bc60d9 memcommit: introduce command to allow making commits without working copy
Summary:
This commit introduces the `memcommit` command to allow creation of
commits without a working copy.

Reviewed By: quark-zju

Differential Revision: D14177415

fbshipit-source-id: 518d29e2fe8fcc7e74d10ec22ebfcd22e136da06
2019-02-26 13:16:35 -08:00
Saurabh Singh
4f208ae0cf stackpush: create pushrequest from memcommit parameters
Summary:
We will be relying on `pushrequest` to create commits to the
repository without a working copy using the `memcommit` command that will be
introduced in D14177415. Therefore, lets introduce a class method for creating
a pushrequest based on memcommit parameters.

Reviewed By: quark-zju

Differential Revision: D14177413

fbshipit-source-id: fe326e1e2908724b81a95fbf13a05163fb435ada
2019-02-26 11:18:25 -08:00
Saurabh Singh
a92aa38702 stackpush: move calculating file conditions to a separate method
Summary:
Calculating the file conditions will be a common operation for any
class method which creates the pushrequest object as in D14177413. Therefore,
it makes sense to segregate this functionality.

Reviewed By: quark-zju

Differential Revision: D14177414

fbshipit-source-id: d57919098f372a9cbed13f59e3d3c4e3cc7a0b55
2019-02-26 11:18:25 -08:00
Saurabh Singh
885d694fe4 stackpush: make specifying the commit date function optional
Summary:
This is certainly not required while creating new commits using
stackpush. Therefore, let's change the code to make this optional. See
D14177415 for an example of when specifying the date is not required.

Reviewed By: quark-zju

Differential Revision: D14177422

fbshipit-source-id: 6a8c5bcf8a01d79c46bc4fe1b4cca8ec16f7f0c2
2019-02-26 11:18:25 -08:00
Johan Schuijt-Li
3150d75e47 hgsubversion: fix or silent tests with latest branchmap change
Summary: Same fix as D14210968.

Reviewed By: quark-zju

Differential Revision: D14224459

fbshipit-source-id: 58adb09a7092e5bc2106fe10e409d8bad5581952
2019-02-26 08:44:42 -08:00
Johan Schuijt-Li
15776f6393 hgsubversion: fix or silent tests with latest branchmap change
Summary: Same fix as D14210968.

Reviewed By: lukaspiatkowski

Differential Revision: D14223540

fbshipit-source-id: 952f60fbf71e9b1829a16826b2029c976606cdda
2019-02-26 03:23:08 -08:00
Adam Simpkins
06e4448f19 only print backup status message when backing up
Summary:
Change the message about limiting the number of backup heads to only print
when actually performing a backup.  Previously it was printed by anything that
used the `notbackedup()` revset predicate, which could cause it to be printed
in `hg log` commands in the middle of normal log template output.

e.g.:

  $ hg log -r. --graph -T'{node} {sl_backup}\n'
  @  backing up only recent 50 heads
  |  ffc89f60162956497cd9e8e33798dd1d63ddd1da
  ~

This diff also changes the behavior to print the message to stderr rather than
stdout (using `ui.warn()` instead of `ui.status()`).

Reviewed By: quark-zju

Differential Revision: D14212701

fbshipit-source-id: ef3636850d8149cb0c1931b84b9a5b45e60f89c7
2019-02-25 20:40:28 -08:00
Saurabh Singh
72d929c351 memcommit: introduce extension and debug command for serializing commit
Summary:
This commit introduces the `memcommit` extension along with the
`debugmemcommit` command. The `debugmemcommit` serializes a commit in a format
that is consumable by the command for creating commit i.e `memcommit`
introduced in D14177415. The `debugmemcommit` is mainly for testing purposes.

Reviewed By: quark-zju

Differential Revision: D14177419

fbshipit-source-id: 3a05a210986402f661d7d08902f28fd53f4bdb2d
2019-02-25 18:55:20 -08:00
Jun Wu
304e5c383b push: remove newbranch option
Summary:
`push --new-branch` is very rarely used and it does not make much sense with
checkheads removed (D14179861). Remove it everywhere.

There is still [one user](https://fburl.com/t5hmcxrp) of the
`push --new-branch` flag. Do not remove it just yet.

Reviewed By: singhsrb

Differential Revision: D14212180

fbshipit-source-id: 18f80576ab6464fc36b047a8a35b339231ee9d8e
2019-02-25 17:51:10 -08:00