Commit Graph

59970 Commits

Author SHA1 Message Date
Arun Kulshreshtha
374eb7d1bf edenapi_server: remove extract_identities function
Summary: This function used to be longer before AclChecker was replaced with PermissionsChecker. Now the function is a one-liner, so it doesn't make sense to keep it as a separate function.

Reviewed By: sfilipco

Differential Revision: D23304899

fbshipit-source-id: 23e8c4b2334cdbff21ca336aecedf6ba6c466f99
2020-08-25 17:18:49 -07:00
svcscm
cb98b00ba3 Updating submodules
Summary:
GitHub commits:

cdb40625e0
38f9210d27
cecdd5d2ab
ef8a0b3ab5

Reviewed By: bigfootjon

fbshipit-source-id: c530162c067f4e188bbb7322d8636762f97635ef
2020-08-25 17:10:55 -07:00
Durham Goode
8fa5577b30 tests: fix test-debugdynamicconfig.t again
Summary: My OSX fix broke Centos :(

Reviewed By: sfilipco

Differential Revision: D23331182

fbshipit-source-id: 07aa3f67f218e96f0021d10198aa4e0da0f6e2e8
2020-08-25 15:56:40 -07:00
svcscm
bfdbdcb1ba Updating submodules
Summary:
GitHub commits:

260439ec01
44a66d8499
96c99afb06
2690a07389
b6bf1ad9fd

Reviewed By: bigfootjon

fbshipit-source-id: 09d684d7221fc3a09651588d38c5c1b6ce7422c4
2020-08-25 15:54:47 -07:00
David Tolnay
840e6dd6f6 edenapi: Unmanage Cargo.toml
Reviewed By: quark-zju

Differential Revision: D23329351

fbshipit-source-id: e07440a2ac5f93efda19e7a3c7d5e7ae18598c7d
2020-08-25 15:37:55 -07:00
Zeyi (Rice) Fan
619904bc69 re-implement normalize_windows_path
Summary: This diff fixes the issue that mkscratch does not build on Rust < 1.45.0

Reviewed By: xavierd

Differential Revision: D23325087

fbshipit-source-id: 7e737eb5bc0d75255a84c8ac353bf3a17c269300
2020-08-25 12:38:07 -07:00
Durham Goode
cbd1d445d0 tests: fix test-debugdynamicconfig.t
Summary:
This was just a dumb issue. I added a test that depended on the
previous logic which didn't run on OSX.

Reviewed By: kulshrax, singhsrb

Differential Revision: D23324601

fbshipit-source-id: 259175c91c9eb54e8350f196770ff967b53ee841
2020-08-25 11:59:32 -07:00
svcscm
45388d339b Updating submodules
Summary:
GitHub commits:

9ea1c4a261
a6c84091f9
d51f88c9e4

Reviewed By: bigfootjon

fbshipit-source-id: 2fc628da385844bdbb788c37f2a7943126efa5fd
2020-08-25 11:59:32 -07:00
svcscm
15789d259f Updating submodules
Summary:
GitHub commits:

0e9fb8e907
af7939f17b
54d6b99043
2439661a1b

Reviewed By: bigfootjon

fbshipit-source-id: 6561eadd4392e5e7dd58c456a010417fcbbd7806
2020-08-25 09:17:01 -07:00
Mark Thomas
dee916ec4c bookmarks_movement: handle services with all or no permitted paths
Summary:
If a service is configured with no permitted paths, ensure we deny any writes
that might affect any path.  This is not hugely useful, and probably means a
configuration error, but it's the safe choice.

In a similar vein, if a service is permitted to modify any path, there's not
much point in checking all the commits, so skip the path checks to save some
time.

Reviewed By: StanislavGlebik

Differential Revision: D23316392

fbshipit-source-id: 3d9bf034ce496540ddc4468b7128657e446059c6
2020-08-25 09:14:09 -07:00
Mark Thomas
f15976637e bookmarks_movement: restrict bookmarks that are marked allow_only_external_sync
Reviewed By: StanislavGlebik

Differential Revision: D23294907

fbshipit-source-id: ed89e5fd841e7d516b5d259c1f5de4e9f8f40ee3
2020-08-25 09:14:09 -07:00
Mark Thomas
eed7df1c52 bookmarks_movement: add integration test for bookmark modifications
Summary:
This tests creating, moving and deleting bookmarks using the source control
service, making sure that hooks and service write restrictions are applied
appropriately.

Reviewed By: StanislavGlebik

Differential Revision: D23287999

fbshipit-source-id: bd7e66ec3668400a617f496611e4f24f33f8083e
2020-08-25 09:14:09 -07:00
Mark Thomas
f474c09d90 scs_server: implement repo_create_bookmark and repo_delete_bookmark
Summary: Implement these new thrift methods by calling the corresponding mononoke_api method.

Reviewed By: StanislavGlebik

Differential Revision: D23288002

fbshipit-source-id: 2abf1144fe524f695984a7aa472308b8bf067d45
2020-08-25 09:14:09 -07:00
Mark Thomas
4747346e82 mononoke_api: add create and delete bookmark methods
Summary: Add methods to create and delete bookmarks.

Reviewed By: StanislavGlebik

Differential Revision: D23288003

fbshipit-source-id: 5fca60254f00966478270e1a4447cc6a1b5a438e
2020-08-25 09:14:09 -07:00
Mark Thomas
c3070381b3 bookmarks_movement: implement service write path restrictions
Summary:
Use `PrefixTrie` to ensure that all service writes are to paths that are permitted
for the service.

By default, no paths are permitted.  The service can be configured to allow all
paths by configuring the empty path as a permitted prefix.

Reviewed By: StanislavGlebik

Differential Revision: D23287997

fbshipit-source-id: 2b7a0df655084385f73551602d6107411d6aad2f
2020-08-25 09:14:09 -07:00
Mark Thomas
d7dcd5c4c3 mononoke_types: add PrefixTrie for testing path prefixes
Summary:
Add `PrefixTrie`, which is a collection of path prefixes for testing against.

The tree is initially populated with a set of path prefixes.  Once populated,
it can be tested against using other paths.  These tests will return true if
the trie contains a prefix of that path.

Reviewed By: StanislavGlebik

Differential Revision: D23288127

fbshipit-source-id: 6096a9abc8e3a1bf5a8309123a46d321d9795f77
2020-08-25 09:14:08 -07:00
Mark Thomas
a11e0052ac bookmarks_movement: implement service write bookmark restrictions
Summary:
Move handling of service write bookmark restrictions into the `bookmarks_movement` crate.

This moves `check_bookmark_modification_permitted` from `mononoke_api` onto
`SourceControlServiceParams`, where it can be called from `bookmarks_movement`.

Reviewed By: StanislavGlebik

Differential Revision: D23288000

fbshipit-source-id: e346231b183ce1533ab03130fd2ddab709176fcd
2020-08-25 09:14:08 -07:00
Mark Thomas
111bec050d bookmarks_movement: move hook running to a restrictions enum
Summary:
Bookmark movement for service write will use different restrictions than hooks.
Move hook running to be controlled by an enum in preparation for adding service
write restrictions.

Reviewed By: StanislavGlebik

Differential Revision: D23287998

fbshipit-source-id: 30670d4d6666c341885b57a3f41246e52db541a2
2020-08-25 09:14:08 -07:00
Mark Thomas
0606b32fbe mononoke_api: use bookmarks_movement for repo_move_bookmark
Summary: Use bookmarks_movement to implement the bookmark move in repo_move_bookmark.

Reviewed By: StanislavGlebik

Differential Revision: D23222562

fbshipit-source-id: 31249411d9521823f90248f459eb34ed4e2faea5
2020-08-25 09:14:08 -07:00
Mark Thomas
bd24c15579 repo_client: fix fast-forward failure falsehood
Summary:
The error message for fast-forward failure is wrong.  The correct way to allow
non-fast-forward moves is with the NON_FAST_FORWARD pushvar.

Reviewed By: StanislavGlebik

Differential Revision: D23243542

fbshipit-source-id: 554cdee078cd712f17441bd10bd7968b0674bbfe
2020-08-25 09:14:08 -07:00
Mark Thomas
61d45865de bookmarks_movement: prepare for running hooks on additional changesets
Summary:
When bookmarks are moved or created, work out what additional changesets
should have the hooks run on them.  This may apply to plain pushes,
force pushrebases, or bookmark only pushrebases.

At first, this will run in logging-only mode where we will count how many
changesets would have hooks run on them (up to a tunable limit).  We can
enable running of hooks with a tunable killswitch later on.

Reviewed By: StanislavGlebik

Differential Revision: D23194240

fbshipit-source-id: 8031fdc1634168308c7fe2ad3c22ae4389a04711
2020-08-25 09:14:08 -07:00
Mark Thomas
a2bbb7e259 metaconfig_parser: parse hooks_skip_ancestors_of
Differential Revision: D23222560

fbshipit-source-id: 928f35be98682298f2891fefe82c3ed4f6e63097
2020-08-25 09:14:08 -07:00
Mark Thomas
02e382b203 sync repos.thrift
Reviewed By: StanislavGlebik

Differential Revision: D23222561

fbshipit-source-id: 09c25e11b5e022547c1a1363a4cbe1926714be86
2020-08-25 09:14:08 -07:00
Mark Thomas
889e84f8d5 bookmarks_movement: move hook running into bookmarks_movement
Summary:
Move the running of hooks from in `repo_client` to in `bookmarks_movement`.

For pushrebase and plain push we still only run hooks on the new commits the client has sent.
Bookmark-only pushrebases, or moves where some commits were already known, do not run
the hooks on the omitted changesets.  That will be addressed next.

The push-redirector currently runs hooks in the large repo.  Since hook running has now been moved
to later on, they will automatically be run on the large repo, and instead the push-redirector runs them on
the small repo, to ensure they are run on both.

There's some additional complication with translating hook rejections in the push-redirector.  Since a
bookmark-only push can result in hook rejections for commits that are not translated, we fall back to
using the large-repo commit hash in those scenarios.

Reviewed By: StanislavGlebik

Differential Revision: D23077551

fbshipit-source-id: 07f66a96eaca4df08fc534e335e6d9f6b028730d
2020-08-25 09:14:07 -07:00
Mark Thomas
8790a793b9 mononoke_api: add HookManager
Summary: We will shortly need a `HookManager` in the write methods of the source control service.  Add one to `mononoke_api::Repo`

Reviewed By: StanislavGlebik

Differential Revision: D23077552

fbshipit-source-id: e1eed3661fe26a839e50ac4d884f4fadf793dbbb
2020-08-25 09:14:07 -07:00
Durham Goode
18b20f4b24 configs: move dynamicconfig to be before system configs
Summary:
We want to eventually get rid of system and repo configs, but for now
they should take precedence over the dynamicconfigs. Previously we relied on
validation to remove any entries from dynamicconfig that interferes with a
system rc config, but in some code paths we didn't run that validation (like if
we loaded configs purely from Rust).

Let's just make dynamicconfig load before system configs. If validation doesn't
run, we might miss the case where dynamicconfig sets a value and the system rc
doesn't. But that's probably fine.

Reviewed By: quark-zju

Differential Revision: D23305711

fbshipit-source-id: 77b5f49d348cfa116694a641ed17e6d1184a81ab
2020-08-25 07:33:28 -07:00
Durham Goode
d643f48c8c configs: remove loaddynamicconfig option
Summary:
Dynamicconfigs are now part of our critical path. Let's remove the
option to not load them. This also let's us get rid of a circularl dependency
where loading dynamicconfigs required having already loaded some configs. This
will let us move dynammicconfig loading to be before system rc loading in a
later diff.

Reviewed By: sfilipco

Differential Revision: D23309090

fbshipit-source-id: 5138059a8ed944c3616007e7c1289b6a57be0e65
2020-08-25 07:33:28 -07:00
Durham Goode
a0184dde57 configs: validate config during all load paths
Summary:
An earlier diff moved all dynamicconfig loadding into Rust, but it lost
some of the config validation along the way. This allowed dynamicconfig values
to take precedence over system rcs when they shouldn't yet. Most notably the
remotefilelog.cachepath value.

Let's ensure validation is run on all load paths. A future diff will go a step
farther and move dynamicconfigs to be loaded before system configs so we can
ensure system configs always take precedence, until we can remove them entirely.

Reviewed By: quark-zju

Differential Revision: D23305712

fbshipit-source-id: 33a6b4c56d97fa2e2e8f3acc343a8a8868b797ef
2020-08-25 07:33:27 -07:00
svcscm
6aa932cd5a Updating submodules
Summary:
GitHub commits:

bd86f7a7a7
adc391eaad

Reviewed By: bigfootjon

fbshipit-source-id: ae66ee4723dafd345a1e5bc5acd4b46179561fa8
2020-08-25 07:33:27 -07:00
svcscm
34130b73b2 Updating submodules
Summary:
GitHub commits:

e86cad65f7

Reviewed By: bigfootjon

fbshipit-source-id: 90844135658abca182e414a269615b30bf24886e
2020-08-25 06:18:11 -07:00
Harvey Hunt
d7f58b3cfc python3: Don't access socket.error using an index to get errno
Summary:
Python 2's `socket.error` type provided a tuple of (errno, error
string) that could be used for identifying the specific error type. In Python 3
this was switched to an object that doesn't expose such an interface. As a
result, accessing `socket.error` using an index will cause an exception, such
as:

```
  File "/opt/fb/mercurial/edenscm/mercurial/keepalive.py", line 608, in safesend
    if v[0] == errno.EPIPE:  # Broken pipe
TypeError: 'BrokenPipeError' object is not subscriptable
```

Replace the use of indexing with accessing `.errno` instead, as this works for
both python 2 and python 3.

Differential Revision: D23294090

fbshipit-source-id: 5f901493c2db270817949d93840c6d469b17a560
2020-08-25 05:21:11 -07:00
Mateusz Kwapich
37192dc0e1 add a way to exclude a commit and its ancestor from commit history
Summary: We need this functionality for scmquery replacement.

Reviewed By: krallin

Differential Revision: D22999792

fbshipit-source-id: 56e5ec68469cb9c154a5c3045ded969253270b94
2020-08-25 03:48:49 -07:00
Mateusz Kwapich
42cc5431a4 add a way to exclude a commit and its ancestor from commit history
Summary: We need this functionality for scmquery replacement.

Reviewed By: krallin

Differential Revision: D22999793

fbshipit-source-id: 94e53adf5458e0bc1ebceffb3b548b7fc021218a
2020-08-25 03:48:49 -07:00
Durham Goode
c42a494668 dynamicconfig: don't block read operations on dynamicconfig write permission errors
Summary:
Dynamicconfig was throwing errors if hgrc.dynamic wasn't writable.
Let's eat those errors for normal read operations. We still treat it as an error
for straight hg debugdynamicconfig invocations.

Reviewed By: quark-zju

Differential Revision: D23301100

fbshipit-source-id: ed0bd1282d2c7ee747f0909c238a5fa07b7bc9bc
2020-08-24 21:40:00 -07:00
Durham Goode
9b7b351ed9 configs: introduce test demonstrating permission denied error
Summary:
We've seen user reports of this error. Let's add a test to demonstrate
it. The next diff will fix it.

Reviewed By: sfilipco

Differential Revision: D23309612

fbshipit-source-id: 6fb9e4e65d3351fa29812fc75095d054465cfe13
2020-08-24 21:40:00 -07:00
Zeyi (Rice) Fan
50378e741a run edenfsctl redirect fixup after mout is done
Summary: Use `Subprocess` in `win/utils` to call `edenfsctl redirection fixup` after mount is done.

Reviewed By: wez

Differential Revision: D22958764

fbshipit-source-id: a485994a3816169299e8514a5c355f3d37edad99
2020-08-24 21:38:12 -07:00
Zeyi (Rice) Fan
4d21d2dd8a clean up fs/win/utils/Process.h
Summary: Some clean up to do. `Process` will crash the entire process if `Pipe` is ever `std::nullptr`. So let's not give it a default argument `std::nullptr`.

Reviewed By: xavierd

Differential Revision: D22958765

fbshipit-source-id: 0c35e805f24a0d572bbc08efc97e59a37d0cbf88
2020-08-24 21:38:12 -07:00
Zeyi (Rice) Fan
17d2c95a18 enable mkscratch on Windows
Summary: With D22956659, we can now use mkscratch on Windows with EdenFS.

Reviewed By: xavierd

Differential Revision: D22956983

fbshipit-source-id: 995073cbc89d5cb23dbb9c1a58926f8c51f0a896
2020-08-24 21:38:12 -07:00
Zeyi (Rice) Fan
7f0f310af3 handle extended-length on Windows
Summary:
On Windows, Rust's `std::fs::canonicalize` [1] will generate extended-length path that will include a `\\?\` prefix [2]. This has subsequently cause `encode` to generate a path that contains a question mark, which is an invalid path on Windows.

This diff teaches `encode` to handle extended-length path on Windows. It essentially converts the path back so it no longer contains the prefix.

[1] http://doc.rust-lang.org/1.45.2/std/fs/fn.canonicalize.html
[2] https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation

Reviewed By: wez

Differential Revision: D22956659

fbshipit-source-id: 54691e204d7cb481bdb40f62c6520c0f70c3f648
2020-08-24 21:38:12 -07:00
svcscm
381f1333cd Updating submodules
Summary:
GitHub commits:

e56907dbd1

Reviewed By: bigfootjon

fbshipit-source-id: 58e966ebf06139aa51e761a8401a411379b909a3
2020-08-24 20:44:31 -07:00
Durham Goode
4a8a5290e8 curses: eat curses error for weird inputs
Summary:
In python 3 curses sometimes throws an error when weird keys are
pressed. I'm not certain exactly what key causes the problem, but let's just
prevent all such errors from crashing the process.

Reviewed By: quark-zju

Differential Revision: D23310301

fbshipit-source-id: a9684ce6f690d0753ff9956ef9f13c330eb0a77b
2020-08-24 20:16:41 -07:00
svcscm
9e9d4a5b2b Updating submodules
Summary:
GitHub commits:

8235f4cb96
1370bc3e20

Reviewed By: bigfootjon

fbshipit-source-id: f07c063bfd34e8deb48e74db51b0561786413fd4
2020-08-24 20:16:41 -07:00
svcscm
7bbd7c0c47 Updating submodules
Summary:
GitHub commits:

e5ff57259a
b7e1c5213f
e106f78a08

Reviewed By: bigfootjon

fbshipit-source-id: eadeb82ed165dec3ed4d1ce2150db61bd28ec742
2020-08-24 17:10:23 -07:00
Xavier Deguillard
111d960ccb win: move some code between the dispatcher and the channel
Summary:
By making the EdenDispatcher less Windows dependant, we can more easily move it
into a non-Windows specific location later.

Reviewed By: chadaustin

Differential Revision: D23298028

fbshipit-source-id: 21726677808a9b8ce3d3e211dd65d9e47caad569
2020-08-24 16:49:12 -07:00
Mateusz Kwapich
1b00df7887 add a way to exclude a commit and its ancestor from path history
Summary: We need this functionality for scmquery replacement.

Reviewed By: krallin

Differential Revision: D22999141

fbshipit-source-id: e2e4177e56db85f65930b67a9e927a5c93b652df
2020-08-24 13:03:05 -07:00
Mateusz Kwapich
a3f8760fbc add a way to exclude a commit and its ancestor from path history
Summary: We need this functionality for scmquery replacement.

Reviewed By: krallin

Differential Revision: D22999142

fbshipit-source-id: 04cea361ea6270626e7ff77255e3dc75875ece97
2020-08-24 13:03:04 -07:00
Mateusz Kwapich
e7daab0dfb change the path history options to struct
Summary:
Rust doesn't have named arguments as with positional it's hard to keep track
of all of them if there're many. I'm planning to add one more so let's switc to
struct.

Reviewed By: krallin

Differential Revision: D22999143

fbshipit-source-id: 54dade05f860b41d18bebb52317586015a893919
2020-08-24 13:03:04 -07:00
svcscm
0bd2b1fe28 Updating submodules
Summary:
GitHub commits:

89fe569d1f
964b04930b
316dfde976
5d56fd62bb
cd45ed2c5a
68394eda3d
a8b3261586

Reviewed By: bigfootjon

fbshipit-source-id: 737310b399f5f60b5b04a1347d3d76c2580f6f52
2020-08-24 12:55:58 -07:00
Jun Wu
7872c44fdf configparser: stabilize tests
Summary:
Add locking for tests reading / mutating global env vars.
Restore HG_TEST_REMOTE_CONFIG after testing.

Reviewed By: DurhamG

Differential Revision: D23269862

fbshipit-source-id: d61141b25c923a059de07c3dc8479f3bee06dce7
2020-08-24 12:36:09 -07:00
svcscm
97766088ae Updating submodules
Summary:
GitHub commits:

7790dc2a34
bf6c2202c7
68048d3954
1fe8bf7682
4aee5e0c05
329fcf639a
21ce018a32
93df74630b
a76dabea88

Reviewed By: bigfootjon

fbshipit-source-id: 7f54fbb000baa4e3b7972dd6b625bae2d79b0ec6
2020-08-24 12:33:20 -07:00