Commit Graph

45232 Commits

Author SHA1 Message Date
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
Stanislau Hlebik
dee75aa345 pushrebase: support deletion of a bookmark in sendunbundlereplay
Summary:
Previously one couldn't use `sendunbundlereplay` to replay a bundle that just
deletes a bookmark i.e. sends only pushkey part. The problem was in that
`bundleoperation.gettransaction` method wasn't called and so a few hook
arguments weren't set.

In order to fix it this diff just calls this method before calling pushkey. The
solution is not clean, but I don't see much better alternatives.

Another smaller change that this diff is doing is changing sendunbundlereplay
command to require `--deleted` flag. This is just for convenience.

Reviewed By: quark-zju

Differential Revision: D14185380

fbshipit-source-id: f511dc0b9906520b7877501b37639d89ada6fc45
2019-02-25 13:08:00 -08:00
Stanislau Hlebik
086e927aab sendunbundle: better process errors
Summary:
We didn't process parts like `error:abort` and so we might have easily missed
an error. This diff fixes it.

Reviewed By: quark-zju

Differential Revision: D14185378

fbshipit-source-id: e68e365fd939a4bd6a0c2835a513ebc94530aa87
2019-02-25 13:08:00 -08:00
Jun Wu
da0b66a8ec copytrace: fix an issue where undesirable entries are reported
Summary:
This solves an issue vipannalla saw that the heuristics logic behaves incorrectly
when running `hg up -C c4a88583; hg graft 23001ead`. The file `great_persons_on_ex_civilization-inl.h`
would be marked as "unresolved" and removed from the working copy potentially
due to other mergedriver actions, while it should be merged cleanly and do not
appear in mergestate at all.

After debugging, the file was only renamed on one side, and not changed on the
other side. In the heuristics code path, the file was reported as copied and
confused the callsite.

Reviewed By: singhsrb

Differential Revision: D14195031

fbshipit-source-id: 0602fd56b75219f851c0175debfe72c4d49d652d
2019-02-25 12:43:20 -08:00
Jun Wu
3f0893c3ab tests: add a test showing suboptimal copytrace + mergedriver behavior
Summary: As explained in the test.

Reviewed By: singhsrb

Differential Revision: D14195032

fbshipit-source-id: 29a19d5ad4abd4a8d77480bd72922b8967a11997
2019-02-25 12:43:20 -08:00
Jun Wu
97755349f5 hgsubversion: fix or silent tests with latest branchmap change
Summary:
This is probably not the proper fix but we're getting rid of svn too.

Remove tests coupled with named branches. Modified some critical tests (ex.
"push") so they can still pass.

Reviewed By: DurhamG

Differential Revision: D14210968

fbshipit-source-id: 62e02179b0e4745db8f90f718613afad42d7376a
2019-02-25 11:23:56 -08:00
Xavier Deguillard
12eedc5745 rage: add ssh config
Summary:
In some cases, a user has a badly configured ssh config which leads to
unexpected errors when running hg pull. Collecting the ssh config should help
us catch what is wrong.

Reviewed By: sfilipco

Differential Revision: D14189702

fbshipit-source-id: 73fff933987bcc95f23795c5cb6beee54ae2f141
2019-02-25 10:22:28 -08:00
Saurabh Singh
f7c02136cd memcommit: introduce the data model
Summary:
We are working on a `memcommit` extension to provide a command for
making commits without a working copy. This is required for implementing the
ScmWrite Commit API i.e. https://fb.quip.com/u5WJAx6i59Kl. The plan is that
ScmWrite service will use this command to create the commits in the repository.

This commit just introduces the data model for the memcommit.

Reviewed By: DurhamG

Differential Revision: D14177420

fbshipit-source-id: 5c5e63bfecedd71a56d9e0b27e308e1803a4dafe
2019-02-25 10:10:03 -08:00
Saurabh Singh
45971b1eb7 branchcache: fix the tests after removal of branch cache
Summary:
It seems these tests were not updated while fixing the branch cache.
This commits updates the test to address the test failures.

Reviewed By: quark-zju

Differential Revision: D14208936

fbshipit-source-id: 6ec741886a2ef8da0feb294847757d3ae94b36ee
2019-02-25 09:18:41 -08:00
Liubov Dmitrieva
f30445fbce pushbackup: increase waiting time
Summary: I think when we moved to process commits stack by stack we didn't change the timeout.

Differential Revision: D14188545

fbshipit-source-id: a01432e6aef29f7e603742f854c323996856fdda
2019-02-25 04:21:44 -08:00
Mark Thomas
9a19e06fee strip: move extension to core and rename to debugstrip
Summary:
Move the strip extension to core.  Rename the command to `hg debugstrip` as it
is not intended for use by users.  Users should use `hg hide` instead.

Reviewed By: quark-zju

Differential Revision: D14185822

fbshipit-source-id: ef096488cb94b72a7bb79f5bf153c064e0555b34
2019-02-25 03:55:08 -08:00
Mark Thomas
cb47493670 commitcloud: accept cloud bookmarks for hidden commits
Summary:
When receiving cloud bookmarks, if they point to a hidden/obsolete commit,
don't omit them.  The bookmark will make the commit visible again.

Reviewed By: quark-zju

Differential Revision: D14183009

fbshipit-source-id: ddcb8cce6aaa1eefae93490f76c3dffeaffda21c
2019-02-25 02:34:50 -08:00
Jun Wu
bfaf19a6a8 fetch: remove the extension
Summary:
`fetch` is a deprecated extension. It uses non-trivial branch-related logic.
Drop it to unblock further branch related cleanups.

Differential Revision: D14180593

fbshipit-source-id: 8288a7f0ac1ba72cf476cb78f109c71aa11c92c0
2019-02-22 21:02:42 -08:00
Jun Wu
56338d7005 branchmap: drop revbranchcache and other unused logic
Summary:
They're no longer used. Drop them. The `branchcache` is still somehow used,
although it's basically equvilent to `{"default": heads}`.

We can probably clean it up further after detached from subversion.

Reviewed By: singhsrb

Differential Revision: D14180592

fbshipit-source-id: 45230d486f203bf3f55e89ce9eb89e6855e14e54
2019-02-22 21:02:41 -08:00
Jun Wu
b8eecfa308 streamclone: drop branchmap code
Summary: It's a no-op already. Drop it.

Reviewed By: singhsrb

Differential Revision: D14180595

fbshipit-source-id: 9f904b818bcf56b9d12405ca9894baa9c786801b
2019-02-22 21:02:41 -08:00
Jun Wu
e188aff028 revset: make "branch(x)" equvilant to "all()"
Summary:
All commits belong to `default` branch. Therefore `branch(x)` can be seen as
just `all()`, assuming `x` is a valid name.

This removes the only user of `repo.revbranchcache`.

In a later step, branch related features will be moved to an extension so the
code becomes separate and features are optional.

Reviewed By: sfilipco

Differential Revision: D14180594

fbshipit-source-id: 9dc52743f1b69a1838114c8c0de5fc69383dc41e
2019-02-22 21:02:41 -08:00
Jun Wu
66f2e5f45e branch: disable branchcache and drop all branches other than "default"
Summary:
This hardcodes several perftweaks configs that have been enabled for major FB
repos for months:

  [perftweaks]
  disablebranchcache = True
  disablebranchcache2 = True
  disableresolvingbranches = True
  disableupdatebranchcacheoncommit = True

Practically, this means the branchmap is now just `{'default': heads}`. (i.e.
there are no named branches other than `default`), and branchcache is removed
(i.e. `.hg/cache` does not exist without clindex or in-repo tags).

This diff only makes easy-to-verify logic changes by assuming the configs and
removing dead code. Things can be further cleaned up. They will be done by
upcoming changes.

Most test changes are due to the fact that `.hg/cache` is no longer created.

Reviewed By: singhsrb

Differential Revision: D14179858

fbshipit-source-id: 479f7427168eb1d9614a973e273a229e50f5620a
2019-02-22 21:02:41 -08:00
Jun Wu
d30f175cde test-treediscovery: remove the tests
Summary:
The tests are about HTTP bundle1 support, which is not an environment we care
about. They will break in a way that is non-trivial to fix with the upcoming
branchmap removal. There is little value keeping them. So let's just remove the
tests.

Reviewed By: sfilipco

Differential Revision: D14179859

fbshipit-source-id: 09392bb2e5c0aebc30e584ed3a6593b0b2a81089
2019-02-22 21:02:41 -08:00
Jun Wu
9c13621dea test-hgweb-non-interactive: remove the test
Summary:
The WSGI parameter part gets changed with the upcoming branchmap removal.
We don't have resources to maintain WSGI for now, so let's just remove the
test.

Reviewed By: singhsrb

Differential Revision: D14179860

fbshipit-source-id: b2b82f7658a754caece220fa5f80d15514dd9260
2019-02-22 21:02:41 -08:00
Jun Wu
850022dd70 convert: drop cvs support
Summary:
The CVS branch support will break with the upcoming branchcache removal.
CVS repos are rare. Let's just remove the code.

Differential Revision: D14179863

fbshipit-source-id: 890ce34958d2efe4f2ef02b1d72cf92f6269378c
2019-02-22 21:02:41 -08:00
Jun Wu
047b1a05f4 exchange: kill checkheads
Summary:
We had `ui.checkheads=false` set for a long time. Let's remove the feature
entirely and update the tests.

This is necessary before killing the branch cache, as some tests still use
different branches and there would be suddently more "heads" that cause
test issues.

Reviewed By: sfilipco

Differential Revision: D14179861

fbshipit-source-id: 0de76566799a9560b45e823cc5f49cfda9e3dd30
2019-02-22 21:02:41 -08:00
Jun Wu
581f379320 tests: remove tests about checkheads
Summary:
The checkheads feature is being removed. See D8148016 for details.
This diff just removes tests with "checkheads" in their names.

Reviewed By: sfilipco

Differential Revision: D14179862

fbshipit-source-id: abd5bb26c0d92276273bef7ea93096ca3fde95dc
2019-02-22 21:02:41 -08:00
Jun Wu
1e25b19068 setup: make openssl crate buildable on Windows
Summary: Build openssl using vcpkg. Then zip its build results.

Reviewed By: kulshrax

Differential Revision: D14197306

fbshipit-source-id: 7f019f52fb93118cb7c20c95cf41aedf3a1fbefc
2019-02-22 19:41:16 -08:00
Stefan Filip
29e6198309 manifest: make FileMetadata members public
Summary:
The purpose of `FileMetadata` is to be a data container. Using the
`FileMetadata` implies accessing the underlying values. That means that the
underlying values need to be `public`.

Differential Revision: D14178260

fbshipit-source-id: 8b8e5ead23d47962498f991152c2a5fd94ac3c74
2019-02-22 15:42:45 -08:00
Stefan Filip
59ce91e857 manifest: add Arbitrary implementation for FileType and FileMetadata
Summary: These implementations are going to used in quickcheck tests.

Differential Revision: D14178259

fbshipit-source-id: 0bded67deab3422b4aad53666c14cf195ea1b0d4
2019-02-22 15:42:45 -08:00
Stefan Filip
e496e01d8f types: Add as_byte_slice() to RepoPath and PathComponent
Summary:
`as_bytes` is useful for interacting with code that is written in reference
to a `slice` or when attempting to serialize them. It is fine to serialize
these paths using their underlying representation because we request that they
be normalized.

Reviewed By: quark-zju

Differential Revision: D14178263

fbshipit-source-id: 36529e2ae47580ae4014ae279df98b35eac5484a
2019-02-22 15:42:45 -08:00
Stefan Filip
5c04aead8f types: add Arbitrary implementations for RepoPathBuf & PathComponentBuf
Summary:
Implementing these traits allows easy use of `RepoPath` and friends in
quickcheck tests.
It is tricky to implement `PathComponentBuf`. I believe that most strings will
end up being a valid `PathComponent` so I think that it is reasonable to loop
until a valid string is found. To note generating Arbitrary Unicode `char`s is
implemented using a loop where random bytes are validated against the `char`
constructor.

Reviewed By: quark-zju

Differential Revision: D14178262

fbshipit-source-id: 759486a2053b851f8259d7cc03eee1cd69893f9f
2019-02-22 15:42:44 -08:00
Stefan Filip
49e7e99131 types: add public constant functions Node::{len, hex_len}
Summary:
These constant can be useful for parsing byte streams that we expect to contain
`Node`s. These constant should replace all potential hardcoding of values that
intend to represent the byte lengths for `Node`.

Differential Revision: D14178261

fbshipit-source-id: 34471151b5d253504e32a9e8b039608c1d4943fe
2019-02-22 15:42:44 -08:00
Liubov Dmitrieva
6ee9cf11e5 infinitepush + commitcloud: strip the marker to get build the
Summary: Mononoke uses the markers but we shouldn't look at them for Commit Cloud.

Differential Revision: D14188356

fbshipit-source-id: e5dee581728a9bc83d2f7a17575b3ae6b3183d39
2019-02-22 13:16:24 -08:00
Liubov Dmitrieva
65b628a472 commit cloud: check that the secondary path is not the same as the first.
Summary:
add this check to avoid overhead

we don't need to backup to the secondary place if it is the same as the first.

Reviewed By: singhsrb

Differential Revision: D14187754

fbshipit-source-id: 6ee59ae2f0846716ca99253958af7088d0538df9
2019-02-22 12:55:14 -08:00
Liubov Dmitrieva
ac751a0ac1 fix format for broken check-code test
Summary: Just renaming, and another variable as well to look similar

Reviewed By: DurhamG, quark-zju

Differential Revision: D14185033

fbshipit-source-id: e34de690274afd2f2c6e51db21c7b158f6c3452a
2019-02-22 11:44:51 -08:00
Xavier Deguillard
91b1a56c3a radixbuf: make it compile on windows
Summary:
Instead of using the rand crate imported into quickcheck, we can use the
rand crate directly.

Reviewed By: quark-zju

Differential Revision: D14174653

fbshipit-source-id: c848f139765b9e458d374790227399f0ad836af6
2019-02-22 10:22:30 -08:00
Xavier Deguillard
9f05c94729 watchman_client: fix windows build
Summary:
The watchman_client crate relied on unix-only crates for both
unix_socket_transport and command_line_transport. Let's not compile
these on windows.

Reviewed By: quark-zju

Differential Revision: D14174654

fbshipit-source-id: 67d26d1799e71a1bf20af1a57a687249f5dce227
2019-02-22 10:22:30 -08:00