Commit Graph

61550 Commits

Author SHA1 Message Date
Thomas Orozco
b37bd20ab8 mononoke/filestore: update multiplexer to futures 0.3 / tokio 0.2
Summary:
Like it says in the title. This updates the Filestore's multiplexer to new
futures. The change is pretty mechanical, save for:

- We don't use filestore::spawn anymore, since that's provided by
  `tokio::task::spawn`  now.
- We no longer need to use futures or streams with `Error = !` since in Futures
  0.3 you can have an `Output` that isn't a `Result`.
- We need to make the `Stream` we accept `Send` because we can't used
  `boxed().compat()` otherwise. I'd like to remove that constraint once the
  conversion is complete, but considering all callsites do have a `Send` stream
  (the only one that didn't was API Server but that's long gone), just adding
  the bound is easiest.

Reviewed By: farnz

Differential Revision: D24708596

fbshipit-source-id: 8b278b5ae49029b7f0d0d9d4fe96c467e1343f60
2020-11-06 07:26:02 -08:00
Thomas Orozco
390d305281 mononoke/test: call the filestore with static streams
Summary:
This makes some refactoring later easier. I'd like to not require this, but for
now it's a bit simpler to just do this. Those are the only callsites that
send non-static streams.

Reviewed By: markbt

Differential Revision: D24727258

fbshipit-source-id: c0e4dc86e249a08c2194a20de5a2dfd5a5933d0b
2020-11-06 07:26:02 -08:00
Stanislau Hlebik
a5f6874c72 mononoke: add a tunable to log large read requests
Reviewed By: krallin

Differential Revision: D24780218

fbshipit-source-id: 9207a471e65407a023223ce5a0aeee3511a9823e
2020-11-06 04:23:40 -08:00
Lukas Piatkowski
a3c2ea6fa0 mononoke/commit_rewriting: fix doc generation
Reviewed By: ahornby

Differential Revision: D24780398

fbshipit-source-id: 79570f6b6959362bcdbc20f425378b7ec460e480
2020-11-06 03:24:20 -08:00
svcscm
ab30d06185 Updating submodules
Summary:
GitHub commits:

a49a24ab6c
3dc4f8e4c9
ba3d679926
172c0d1c68
6e5eb45e36
8e07573bbf
bdfac9530a
6e042852c1
e7bca3185b
c1ff6070fc
d42fa2b9b9

Reviewed By: bigfootjon

fbshipit-source-id: a11d5035a79964e5d201e613569b2a0f5305a94c
2020-11-06 03:24:20 -08:00
Alex Hornby
14128ce2dc mononoke: remove unnecessary .version("0.0.0") in clap App setup
Summary: We don't need to declare a fake empty version number

Reviewed By: farnz

Differential Revision: D24757981

fbshipit-source-id: 594c97e225704d783bea723efcbb9dfc4d5d800b
2020-11-06 02:23:46 -08:00
svcscm
7a916000cf Updating submodules
Summary:
GitHub commits:

f6f11a74c1
6831a29627
95b6a4d050
7ddffe807c
d44b01c030
765390bd50
54ab77c0b6
b162d65672
f22419cf95
a282b6abb4
77aaaf9a7f
025655b63c
2759c566eb

Reviewed By: bigfootjon

fbshipit-source-id: 9e550b9ec98b5822c609a74c27678fce77e22be5
2020-11-06 02:23:46 -08:00
Koray Polat
efa7a0e7a7 Add an option to specify lfs path
Reviewed By: rsunkad

Differential Revision: D24750170

fbshipit-source-id: 5c48ab812b5438a33713315faf83e7a21a3c4eae
2020-11-06 01:24:04 -08:00
svcscm
3e9c72a63b Updating submodules
Summary:
GitHub commits:

088c674218
a609825964
4583fa6848

Reviewed By: bigfootjon

fbshipit-source-id: 86263425a36691ce1c036b47909ccb89868421c3
2020-11-06 01:24:04 -08:00
svcscm
f0dea7fb78 Updating submodules
Summary:
GitHub commits:

567b2fc2eb
f7cc11e65f
65ba90889c
29b2d56cbd

Reviewed By: bigfootjon

fbshipit-source-id: c1b9e56c11652123fba37cda45ff2b24a174d195
2020-11-05 20:23:01 -08:00
Xavier Deguillard
c5480fdf6f hooks: forbid windows reserved names in the repos
Summary:
The root cause for S199754 was a file named "con.rs" was checked in onto the
repo. Since this is a reserved filename on Windows, this broke all Windows
users having it in their sparse profiles.

The rules for reserved names are defined as such by Microsoft:

"CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9,
LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these
names followed immediately by an extension; for example, NUL.txt is not
recommended. For more information, see Namespaces."

Of course, since the filesystem is case insensitive, these can have any casing.

Reviewed By: krallin

Differential Revision: D24453528

fbshipit-source-id: 389f15e2b1a88e3c1e8721fb7868616acabebc64
2020-11-05 19:24:04 -08:00
svcscm
62e5d16d62 Updating submodules
Summary:
GitHub commits:

9dd6cec5b0
c010efa7c4

Reviewed By: bigfootjon

fbshipit-source-id: a4a14f5de322c7f0523d0dc18e91428e04f85e10
2020-11-05 19:24:04 -08:00
svcscm
22b7b14b15 Updating submodules
Summary:
GitHub commits:

0997683b5c
d658643832
83ec478105
1a39d28f99

Reviewed By: bigfootjon

fbshipit-source-id: 2c820b134b8bb8ac061d5d36de8403f927c9dcfa
2020-11-05 16:23:27 -08:00
Xavier Deguillard
800952135e crecord: make it more readable on Windows terminal and light colors
Summary:
On Windows terminal, with light color schemes, crecord text was barely visible
(sometimes invisible) due to low contrast on either the background, or the
foreground. Making the text bold makes it brighter and thus more readable.

As a bonus, I've also made the hunk lines magenta to mimic what `hg diff` does.

Reviewed By: DurhamG

Differential Revision: D24718598

fbshipit-source-id: 18c2ff03fc2a46ca45808d5061db21e1f1b501ae
2020-11-05 13:44:41 -08:00
Jun Wu
83ad42d760 config: reduce treestate mingcage to 15 minutes
Summary: This makes it clean up stale files more aggressively.

Reviewed By: DurhamG

Differential Revision: D24744461

fbshipit-source-id: 76d163c9f16d8f8d1bf628e9197a3086d7cd48aa
2020-11-05 11:35:32 -08:00
svcscm
37ef005673 Updating submodules
Summary:
GitHub commits:

b2ab8086fe
161ed3320b
4aee1c53b6
3099b9be31
7f95d993df
5775d87aaa
f5e66ddb20
c9856c2f0d
0fd462bb14
3f6af52b2c
43dd906184
5b900c105c

Reviewed By: bigfootjon

fbshipit-source-id: a78bd29e09c603c183024f3f9e21944a03f863d0
2020-11-05 10:16:03 -08:00
Durham Goode
a1d2d702d7 datastore: fix bug in indexedlogdatastore max log size
Summary:
The goal of this code was to divide the cache limit by the number of
logs. Instead it divided the cache limit by the default per-log size (2GB). That
results in a very small max-bytes-per-log so data was being thrown out
constantly. This fixes it and updates tests to actually demonstrate the issue.

Reviewed By: kulshrax

Differential Revision: D24712842

fbshipit-source-id: 8062758b5bfa40493e2003d5a9028d601b1522b1
2020-11-05 09:48:26 -08:00
Durham Goode
5fd8358356 chg: don't set line buffering
Summary:
Python 3 doesn't support line buffering for binary file descriptors.
Let's stop setting it in chg.

This was causing warnings to pop up during prompts for users.
```
.../python3.8/os.py:1023: RuntimeWarning: line buffering (buffering=1) isn't supported in binary mode, the default buffer size will be used
  return io.open(fd, *args, **kwargs)
```

Reviewed By: singhsrb

Differential Revision: D24747777

fbshipit-source-id: 0b881b4067e8c7086fe73380f81d526a2ecc364a
2020-11-05 09:44:00 -08:00
svcscm
ab7b57fa29 Updating submodules
Summary:
GitHub commits:

ca8a9cf35a
86ee282050
bf8f34d6af
b519e71b0c
950b3b1d0e
017c11ccdf
c769068b24
73727599ef
347ce56cad
7c4a944f2e
9572d9dc0d
ea7afd41c0

Reviewed By: bigfootjon

fbshipit-source-id: ec2b393e283a5623320a528583ef74b297074bc8
2020-11-05 09:35:07 -08:00
Liubov Dmitrieva
463ba371b8 add getfrombackup command to provide API to fetch from bundle store
Summary:
Downloading and applying mercurial bundles directly for list of given heads.

Backup store stores commits as mercurial bundles that can be fetched directly from the store and applied (everstore).

The command could be useful when we migrate our server from one backend to another (Mononoke) and some commits can be missing in Mononoke.

The command could probably be deleted after a while once we migrate completely...

Reviewed By: mitrandir77

Differential Revision: D24756583

fbshipit-source-id: 1629c3756f244621efb965dfe15b75c7509a1cd1
2020-11-05 06:30:18 -08:00
Lukas Piatkowski
3c3de9e954 rust-shed/futures_01_ext: rename futures_ext to futures_01_ext
Summary: As part of the effort to deprecate futures 0.1 in favor of 0.3 I want to create a new futures_ext crate that will contain some of the extensions that are applicable from the futures_01_ext. But first I need to reclame this crate name by renaming the old futures_ext crate. This will also make it easier to track which parts of codebase still use the old futures.

Reviewed By: farnz

Differential Revision: D24725776

fbshipit-source-id: 3574d2a0790f8212f6fad4106655cd41836ff74d
2020-11-05 06:07:16 -08:00
Aida Getoeva
1240231656 mononoke/mysql: share single connection pool in the same SMC between shards
Summary:
In Mononoke for a sharded DB we historically used connection pool size 1 per shard. With the Mysql FFI client now it doesn't make sense, as the client's conn pool is smart enough and designed to works with sharded DBs, so currently we don't even benefit from having a pool.

In this diff I added an API to create sharded connections: a single pool is shared between all the shards.

Reviewed By: farnz

Differential Revision: D24475317

fbshipit-source-id: b7142c030a10ccfde1d5a44943b38cfa70332c6a
2020-11-05 05:34:22 -08:00
Stanislau Hlebik
7b1798be37 sparse: use xormatcher instead of unionmatcher
Summary:
This diff makes "Calculating additional actions for sparse profile update" more
efficient by using xormatcher instead of unionmatcher. Indeed, we are
interested only in files that changed their "state" after sparse profile change
e.g. either a file was included in sparse profile and then became excluded.

Reviewed By: sfilipco

Differential Revision: D24725902

fbshipit-source-id: ee611e7c123b95937652ced828b5bea6d75a3daf
2020-11-05 04:39:48 -08:00
Stanislau Hlebik
abfe3d84c7 match: make differencematcher.visitdir slightly more efficient
Summary:
At the moment differencematcher.visitdir never returns "all".

This diff changes it to return all in the case if self._m2 doesn't visit the directory at all and
self.m1.visitdir(dir) returns "all". This makes sense - if m1 visits all files
in the directory and m2 doesn't exclude any file then it's safe to return all
in this case.

This optimization will be used in the next diff.

Reviewed By: sfilipco

Differential Revision: D24725903

fbshipit-source-id: 2a049cfb1ea4878331e8640cbb20af74da86a1a1
2020-11-05 04:39:48 -08:00
Stanislau Hlebik
5b92b6978e sparse: use mf.walk with ondemand fetch when calculating updates on sparse profile change
Summary:
Whenever a sparse profile changes (e.g. we include or exclude a directory or a file) we do a full prefetch for all trees in the revision and then for each file in a revision we check if this file has changed its state after sparse profile change (i.e. whether it was included before the change and became excluded after the change and vice versa). It can be quite expensive for large repos and looks like checking all the files is unnecessary.

For example, there might be top-level directories that are excluded in sparse profile before and after the change. In that case there's no reason to check every file in this directory, and there's no reason to prefetch manifests for this directory.

More importantly, `mf.walk()` method is already smart enough to do manifest prefetches if treemanifest.ondemandfetch is set to True, so it looks like there's no reason to do any additional prefetching at all (at least in theory).

So this diff does a few things:
1) The default mode is to use mf.walk() method with a union matcher to find all the files that were are included either in old or new sparse profile. In order for it to prefetch efficiently we force enable treemanifest.ondemandfetch config option.
2) It also adds a fallback option to full prefetch (i.e. the same thing we do right now)  Hopefully this fallback option won't be necessary and we'll delete them soon. I've added them only to be able to fallback to current behaviour in case there are problems with the new behaviour

I think we can do an even more efficient fetch by using xor matcher instead of union matcher. I'll try to implement it in the next diffs

Reviewed By: sfilipco

Differential Revision: D24705823

fbshipit-source-id: 2c232a66cc74ee95bdaa84201df46448412f087f
2020-11-05 04:39:48 -08:00
Thomas Orozco
eb8156f8c8 mononoke: flag comment text as text
Summary:
This seems to trip up Cargo builds

```
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `with`
 --> src/lib.rs:365:3
  |
7 | S with version V1
  |   ^^^^ expected one of 8 possible tokens

error: aborting due to previous error
```

Reviewed By: StanislavGlebik

Differential Revision: D24754708

fbshipit-source-id: 0dc5539acf340ac409bf7b6158313c8fec16a275
2020-11-05 03:43:50 -08:00
svcscm
862b79e5e8 Updating submodules
Summary:
GitHub commits:

03687be491
4612a0e2ec
b0aa99eea3

Reviewed By: bigfootjon

fbshipit-source-id: a35c165c64b59e679493857abaf2309eed348587
2020-11-05 03:43:50 -08:00
svcscm
a6123f79ca Updating submodules
Summary:
GitHub commits:

ec5701edc7
0206c66bc7
deb6e82531
079cd3cc39
061ce2fe6e
a97f75eab8
4232c33707
e54087571a
84383ebaac
4e062acafb
eee60cced9
5225bc412d

Reviewed By: bigfootjon

fbshipit-source-id: afa8b4a5bc09c9f39b9aea287b3692b007a19898
2020-11-05 00:08:36 -08:00
Wez Furlong
3b7d1d78fa getdeps: don't depend on git fetch depth any longer
Summary:
This commit takes advantage of git 2.5.0 being able to fetch a
requested revision rather than relying on the desired revision being within the
depth limited fetch.

This relies on having git 2.5.0 on the server which is true for all
of the projects we have manifests for; this shows zero matches:

```
$ rg repo_url opensource/fbcode_builder/manifests | grep -v github
```

We've had a couple of situations recently where folks have run into issues with
the commit rate in folly being higher than then fetch depth, so this should
address that.

Refs: https://github.com/facebook/watchman/issues/866

Reviewed By: fanzeyi

Differential Revision: D24747992

fbshipit-source-id: e9b67c61dddc9f55e05d8984e8d210e7d2faabcb
2020-11-04 23:49:47 -08:00
svcscm
ae82a39efa Updating submodules
Summary:
GitHub commits:

233c670078

Reviewed By: bigfootjon

fbshipit-source-id: 6813cfe730cb51ba140989c22d3325962ac29f1d
2020-11-04 23:49:47 -08:00
svcscm
1539ed8a96 Updating submodules
Summary:
GitHub commits:

244b6f44a5

Reviewed By: bigfootjon

fbshipit-source-id: 0104c9e80d3f6ebf71cac733a8ceb6e638c6ca5a
2020-11-04 19:11:56 -08:00
Chad Austin
6fcf159049 move eden/scripts/ into eden/fs/
Summary: force-unmount-all.sh is a convenience script for edenfs, so move it into eden/fs/.

Reviewed By: fanzeyi

Differential Revision: D24745361

fbshipit-source-id: 661a6f09b73911411fbb8a00bc016757ad19eb2a
2020-11-04 18:29:49 -08:00
svcscm
4b400fc6d9 Updating submodules
Summary:
GitHub commits:

e9ab1bc640
58b6028a6e

Reviewed By: bigfootjon

fbshipit-source-id: 7f945fd148233c8d2e72d001a8b6a4fd5f0bf2d7
2020-11-04 18:29:49 -08:00
svcscm
6af3249c9e Updating submodules
Summary:
GitHub commits:

00a72c8f8a
6e279175da
04e2e1fb63
24a1dfab7f
1f627210ca
92fcebf05b
ccb41c6841
763af65369
7e2bf4e27e
9efa46e9d2
ac6d2546d8
97b3ccd421

Reviewed By: bigfootjon

fbshipit-source-id: 23bd3a52169644f8d2d2ccc155610234a37308e0
2020-11-04 17:34:01 -08:00
Xavier Deguillard
bb9b0b46e1 inodes: remove unecessary include of FuseChannel.h
Summary: This is unecessary, remove it.

Reviewed By: chadaustin

Differential Revision: D24743519

fbshipit-source-id: 5e10eafcd3f84d9ad053be35798df86b21f97d4f
2020-11-04 17:34:01 -08:00
Xavier Deguillard
e50725d2cb inodes: rename FUSE refcount to fs refcount
Summary:
One of the issue that EdenFS on Windows is currently facing is around
invalidation during an update. In effect, EdenFS is over invalidating, which
causes update to be slower than it should be, as well as EdenFS recursively
triggering ProjectedFS callbacks during invalidation. Both of these are a
sub-par UX.

The reason this issue exist is multi-faceted. First, the update code follows
the "kPreciseInodeNumberMemory" path which enforces that a directory that is
present in the overlay needs to be invalidated, even if it isn't materialized.
The second reason is that no reclamation is done for the overlay, combine the
two and you get an update that gets both slower over time and will issue
significantly more invalidation that is needed.

Solving this is a bit involved. We could for instance start by reclaiming
inodes from the overlay, but this wouldn't be effective as we use the fact that
an inode is present in the overlay as a way to know that the file is cached in
the overlay. If we reclaim from the overlay we simply won't be invalidating
enough and some files will be out of date.

It turns out that we already have a mechanism to track what is cached by the
kernel: the fuse refcount. On Linux/macOS, everytime an inode is returned to
the kernel, this refcount incremented, and the kernel then notifies us when it
forgot about it, at which point the refcount can be decremented. On Windows,
the rules are a bit different, and a simple flag is sufficient: set when we
write a placeholder on disk (either during a directory listing, or when
ProjectedFS asks for it), and unset at invalidation time during update. There
is however a small snag in this plan. On Linux, the refcount starts at 0 when
EdenFS starts as a mount/unmount will clear all the kernel references on the
inodes. On Windows, the placeholder aren't disappearing when EdenFS dies or is
stopped, so we need a way to scan the working copy when EdenFS starts to know
which inodes should be loaded (an UnloadedInode really).

The astute reader will have noticed that this last part is effectively a
O(materialized) operation that needs to happen at startup, which would be
fairly expensive in itself. It turns out that we really don't have choice and
we need to do it regardless due to Windows not disallowing writes to the
working copy when EdenFS is stopped, and thus for EdenFS to be aware of the
actual state of the working copy, it needs to scan it at startup...

The first step in doing all of this is to simply rename the various places that
uses "fuse refcount" to "fs refcount" which is what this diff does.

Reviewed By: chadaustin

Differential Revision: D24716801

fbshipit-source-id: e9e6ccff14c454e9f2626fab23daeb3930554b1a
2020-11-04 17:34:01 -08:00
svcscm
85d5aee2d1 Updating submodules
Summary:
GitHub commits:

6c7cc81ea6
90d5d2a1f8
23a7d72744
aaf2076d81
8b67f45829
c9c9709a1a
000de84f70
aff3c87886
765739586d
daaaaf2171
1a7d0b0ca9
3bf4a93e7e
131995399d

Reviewed By: bigfootjon

fbshipit-source-id: 561b1007fa6a65bb2d0239b2823ec7ed9fdafeb1
2020-11-04 16:43:25 -08:00
Alexey Spiridonov
d0faf27e9f Fix OSS build
Summary:
There are two separate changes here.

### Use `find_package`

The old setup of "let's manually enumerate and order the libraries that Bistro depends on" worked fine, except:
 - it was a bit brittle (requiring occasional patches as deps changed), and
 - it garnered a lot of feedback to the effect of "your build is weird, so it's probably broken because of that."

Now I expect to have fewer breaks and more plausible deniability :)

 More importantly, this should make it much easier to migrate to `getdeps.py`.

## Statically link `fmt`

After `fmt` was added as a `folly` dependency, and linked into Folly code used by Bistro, its tests would fail to run with this error: `test_sqlite_task_store: error while loading shared libraries: libfmt.so.6: cannot open shared object file: No such file or directory`.

Something was getting messed up in the dynamic linking, and it wasn't clear to me what -- the way that Bistro is linking its dependencies certainly seems sensible. Most likely one of the dependencies is incompatible with dynamic linking in a subtle way. I suspect Proxygen.

The `fmt.py` change in this diff addresses this problem by forcing static linking on the offending library.

Reviewed By: yfeldblum

Differential Revision: D24604309

fbshipit-source-id: 35ecbbb277b25907ecaee493e8b0081d9f20b865
2020-11-04 16:16:49 -08:00
Alexey Spiridonov
b80291023a Fix discovery of libsodium
Summary:
By putting this in `fizz-config.cmake`, we can use depend on the `sodium` target without compromising our dependents ability to find the library.

Put the search module in the common location under `fbcode_builder/CMake` to let dependents use it.

Reviewed By: yfeldblum

Differential Revision: D24686041

fbshipit-source-id: 942d1ab34feef6cadac2b584eb8cb2d999bae0ca
2020-11-04 16:16:49 -08:00
svcscm
a765b961bd Updating submodules
Summary:
GitHub commits:

22e23f8e21

Reviewed By: bigfootjon

fbshipit-source-id: b4fdfe5cc64eb01aa069fac76e3198212dbfc7cd
2020-11-04 16:16:48 -08:00
svcscm
f02ae77a42 Updating submodules
Summary:
GitHub commits:

0808ce9609

Reviewed By: bigfootjon

fbshipit-source-id: 8ca72fc42f664ef803fc1b79c575f6d678b2e2bb
2020-11-04 15:04:58 -08:00
Jun Wu
c3bcc1ab88 fastlog: do not construct revlog changelog
Summary:
The revlog changelog has incompatible rev numbers with changelog2 backends. Do
not construct it.  Instead, just use the current changelog.

Reviewed By: DurhamG

Differential Revision: D24513444

fbshipit-source-id: 35d9326cd9fde4af8b98d628f6df66bd80883f92
2020-11-04 14:39:04 -08:00
svcscm
aeb8c15614 Updating submodules
Summary:
GitHub commits:

a01453c29c
2da48a24bb

Reviewed By: bigfootjon

fbshipit-source-id: 57cf44f41d32bf9816e1a37c1816111a663a50ab
2020-11-04 14:39:03 -08:00
svcscm
e470672b3e Updating submodules
Summary:
GitHub commits:

340d90513c
6bb79f5151
6f6ed05f3f
b6d8e36741
ce1024ae6f
52f4fe68b6
043286b372
e039616f33

Reviewed By: bigfootjon

fbshipit-source-id: fc29b68c7be9d7c8f5e0cce0e9a82f28d56fc347
2020-11-04 12:59:44 -08:00
Stanislau Hlebik
b5991c8dfa mononoke: fix repo_import to choose correct version
Summary:
Previously we were choosing current version, and just as with backsyncer this
is not always correct. Let's instead choose not the current version but the
version of the bookmark you are importing to.

This diff also introduced an integration test for a repo import into a pushredirected repo, and turned out there were a few bugs in the repo_import code (open_source_sql was used instead of open_sql). This diff fixed them as well

Reviewed By: ikostia

Differential Revision: D24651849

fbshipit-source-id: bfe36e005170ae2f49fa3a6cb208bf6d2c351298
2020-11-04 11:33:22 -08:00
Stanislau Hlebik
bccc2779cf mononoke: remove _DEPRECATED method calls
Summary: Instead let's fetch mover by version name

Reviewed By: farnz

Differential Revision: D24651848

fbshipit-source-id: 08c0a980d139cc74cc7963b1b38f045b10874060
2020-11-04 11:33:22 -08:00
Stanislau Hlebik
b65c8a15eb mononoke: do not backsync commits if no version is found
Reviewed By: ikostia

Differential Revision: D24648254

fbshipit-source-id: ad00dfd096ec5644d48ebd6593101fa5a8e3e04c
2020-11-04 11:33:22 -08:00
Stanislau Hlebik
14e80fdd77 mononoke: disallow syncing commit with no parents without specifying a version
Summary:
This diff changes semantic of `sync_commit()` function to return an error when
trying to sync a commit with no parents. This is a small code change which has big change
in semantics, and because of that I had to change how backsyncer and
mononoke_x_repo_sync job.

Instead of using `unsafe_sync_commit()/sync_commit()` functions both backsyncer and
`x_repo_sync_job` now use `unsafe_sync_commit_with_expected_version()`
which forces them to specify which version to use for commit with no parents.
And in order to find this version I changed find_toposorted_unsynced_ancestors
to not only return unsynced ancestors but also return mapping versions of their
(i.e. of unsynced ancestors) parents. Given this mapping we can figure out what
version is supposed to be used in `unsafe_sync_commit_with_expected_version()`.

The question raises what to do when a commit doesn't have any synced ancestor and hence we can't decide
which version to use to remap it. At the moment we are using current version (i.e. preserving the existing behaviour).
However this behaviour is incorrect, and so it will be changed in the next diffs

Reviewed By: ikostia

Differential Revision: D24617936

fbshipit-source-id: 6de26c50e4dde0d054ed2cba3508e6e8568f9222
2020-11-04 11:33:22 -08:00
Stanislau Hlebik
58224708fa mononoke: select version for pushrebase commit
Summary:
Previously we were always choosing the current version for remapping via
pushrebase, but this is incorrect. Let's instead select the version based on
what version parent commits used to remap with.

Reviewed By: ikostia

Differential Revision: D24621128

fbshipit-source-id: 2fedc34b706f090266cd43eaf3439f8fb0360d0d
2020-11-04 11:33:22 -08:00
Alex Hornby
37d17cd46c mononoke: use strum EnumString instead of own parsing
Summary: use strum  EnumString instread of own macro generated parsing

Reviewed By: krallin

Differential Revision: D24680440

fbshipit-source-id: 1f4cac6b8abf4420965702785b5df1d5bf225d32
2020-11-04 09:48:18 -08:00