Commit Graph

14 Commits

Author SHA1 Message Date
Viet Hung Nguyen
f267bec3f7 mononoke/repo_import: add merge functionality
Summary:
Once we have revealed the commits to the user (D22864223 (578207d0dc), D22762800 (f1ef619284)), we need to merge the imported branch into the destination branch (specified by dest-bookmark). To do this, we extract the latest commit of the destination branch, then compare the two commits, if we have merge conflicts. If we have merge conflicts, we inform the user, so they can resolve it. Otherwise, we create a new bonsai having the two commits as parents.

Next step: pushrebase the merge commit

Minor refactor: moved app setup to a separate file for better readability.

Reviewed By: StanislavGlebik

Differential Revision: D23028163

fbshipit-source-id: 7f3e2a67dc089e6bbacbe71b5e4ef5f6eed2a9e1
2020-08-11 03:26:57 -07:00
Viet Hung Nguyen
f2ee103884 mononoke/repo_import: add more meaningful print outs and save hashes
Summary:
Added more logs when running the binary to be able to track the progress more easily.
Saved bonsai hashes into a file. In case we fail at deriving data types, we can still try to derive them manually with the saves hashes and avoid running the whole tool again.

Reviewed By: StanislavGlebik

Differential Revision: D22943309

fbshipit-source-id: e03a74207d76823f6a2a3d92a1e31929a39f39a5
2020-08-05 12:46:14 -07:00
Viet Hung Nguyen
578207d0dc mononoke/repo_import: add hg sync checker
Summary:
Related diff: D22816538 (3abc4312af)

In repo_import tool once we move a bookmark to reveal commits to users, we want to check if hg_sync has received the commits. To do this, we extract the largest log id from bookmarks_update_log to compare it with the mutable_counter value related to hg_sync. If the counter value is larger or equal to the log id, we can move the bookmark to the next batch of commits. Otherwise, we sleep, retry fetching the mutable_counter value and compare the two again.
mutable_counters is an sql table that can track bookmarks log update instances with a counter.
This diff adds the functionality to extract the mutable_counters value for hg_sync.

======================
SQL query fix:
In the previous diff (D22816538 (3abc4312af)) we didn't cover the case where we might not get an ID which should return None. This diff fixes this error.

Reviewed By: StanislavGlebik

Differential Revision: D22864223

fbshipit-source-id: f3690263b4eebfe151e50b01a13b0193009e3bfa
2020-08-03 04:01:27 -07:00
Viet Hung Nguyen
f1ef619284 mononoke/repo_import: add phabricator lag checker
Summary:
Once we start moving the bookmark across the imported commits (D22598159 (c5e880c239)), we need to check dependent systems to avoid overloading them when parsing the commits. In this diff we added the functionality to check Phabricator. We use an external service (jf graphql - find discussion here: https://fburl.com/nr1f19gs) to fetch commits from Phabricator. Each commit id starts with "r", followed by a call sign (e.g FBS for fbsource) and the commit hash (https://fburl.com/qa/9pf0vtkk). If we try to fetch an invalid commit id (e.g not having a call sign), we should receive an error. Otherwise, we should receive a JSON.
An imported commit should have the following query result: https://fburl.com/graphiql/20txxvsn - nodes has one result with the imported field true.
If the commit hasn't been recognised by Phabricator yet, the nodes array will be empty.
If the commit has been recognised, but not yet parsed, the imported field will be false.
If we haven't parsed the batch, we will try to check Phabricator again after sleeping for a couple of seconds.
If it has parsed the batch of commits, we move the bookmark to the next batch.

Reviewed By: krallin

Differential Revision: D22762800

fbshipit-source-id: 5c02262923524793f364743e3e1b3f46c921db8d
2020-07-28 08:09:21 -07:00
Viet Hung Nguyen
c5e880c239 mononoke/repo_import: Add bookmark moving functionality
Summary: After we derived the bonsaichangesets (D22455297 (c315c56c05)), we want to move a bookmark in small increments to reveal the commits to the users (https://fburl.com/wiki/zp9hgd7z step 8). This diff adds this functionality to repo_import and automate this step.

Reviewed By: StanislavGlebik

Differential Revision: D22598159

fbshipit-source-id: 01db898f07a0b7be50c3f595e78931204f33bb46
2020-07-21 06:47:51 -07:00
Viet Hung Nguyen
9fc9cf9d1c mononoke/repo_import: update packman binary path, move package building
Summary:
Fixed the path to generate the binary in order to able to use repo_import as command.
Changed contbuild location for publishing repo_import packman : mononoke contbuild uses the binary for testing, so it would be cheaper to just build there.

Reviewed By: StanislavGlebik

Differential Revision: D22526542

fbshipit-source-id: 926f8ed08169c34833ccc5711ec3fa26c3784615
2020-07-14 10:19:20 -07:00
Viet Hung Nguyen
78e3864869 xdiff: renamed third-party xdiff functions
Summary:
Follow up on this diff: D22432330 (b7817ffbd8)

Renamed xdiff functions to avoid linking issues when using both libgit2-sys and xdiff.

Reviewed By: farnz

Differential Revision: D22511368

fbshipit-source-id: e4be20e3112a8e8829298d5748657e9bdbde8588
2020-07-14 03:46:04 -07:00
Viet Hung Nguyen
c315c56c05 mononoke/repo_import: add deriving data functionality
Summary: After we shifted the bonsaichangesets (D22307039 (f5db2fdcdc)), we want to derive all the data types available in the target repo. Previously, we used a script to specify what we want to derive (https://fburl.com/wiki/ivk76muf step 4). This diff adds this functionality to repo_import and automate this step.

Reviewed By: StanislavGlebik

Differential Revision: D22455297

fbshipit-source-id: b38ac68606687350ace57d68464e68ca8229f7a5
2020-07-13 03:28:33 -07:00
Arun Kulshreshtha
5f0181f48c Regenerate all Cargo.tomls after upgrade to futures 0.3.5
Summary: D22381744 updated the version of `futures` in third-party/rust to 0.3.5, but did not regenerate the autocargo-managed Cargo.toml files in the repo. Although this is a semver-compatible change (and therefore should not break anything), it means that affected projects would see changes to all of their Cargo.toml files the next time they ran `cargo autocargo`.

Reviewed By: dtolnay

Differential Revision: D22403809

fbshipit-source-id: eb1fdbaf69c99549309da0f67c9bebcb69c1131b
2020-07-06 20:49:43 -07:00
Viet Hung Nguyen
5f43a49743 mononoke/repo_import: add a packman config
Summary: A tool to automate repo imports (intern project: https://fburl.com/hlq6cyma)

Reviewed By: krallin

Differential Revision: D22334417

fbshipit-source-id: 21125a73afede5cf555fc66294d8b02c619c6bba
2020-07-01 11:26:31 -07:00
Viet Hung Nguyen
f5db2fdcdc mononoke/repo_import: add rewrite_commit functionality
Summary:
Previous commit: D22233127 (fa1caa8c4e)

In this diff, I added rewrite commit path functionality using Mover https://fburl.com/diffusion/6rnf9q2f to repo_import.
Given a prefix (e.g. new_repo), we prepend the paths of the files extracted from the bonsaichangesets given by gitimport (e.g. folder1/file1 => new_repo/folder1/file1). Previously, we did this manually when importing a git repo (https://www.internalfb.com/intern/wiki/Mercurial/Admin/ImportingRepos/) using convert extension.

Reviewed By: StanislavGlebik

Differential Revision: D22307039

fbshipit-source-id: 322533e5d6cbaf5d7eec589c8cba0c1b9c79d7af
2020-06-30 11:39:35 -07:00
Viet Hung Nguyen
fa1caa8c4e mononoke/repo_import: Add gitimport functionality and integration test
Summary: I have previously moved the gitimport functionality (D22159880 (2cf5388835)) into a separate library, since repo_import shares similar behaviours. In this diff, I setup repo_import to be able to call gitimport to get the commits and changes. (Next steps include using Mover to set the paths of the files in the commits given by gitimport)

Reviewed By: StanislavGlebik

Differential Revision: D22233127

fbshipit-source-id: 4680c518943936f3e29d21c91a2bad60108e49dd
2020-06-25 19:54:38 -07:00
Jeremy Fitzhardinge
1b4edb5567 eden: remove unused Rust dependencies
Summary:
Remove unused dependencies for Rust targets.

This failed to remove the dependencies in eden/scm/edenscmnative/bindings
because of the extra macro layer.

Manual edits (named_deps) and misc output in P133451794

Reviewed By: dtolnay

Differential Revision: D22083498

fbshipit-source-id: 170bbaf3c6d767e52e86152d0f34bf6daa198283
2020-06-17 17:55:03 -07:00
Viet Hung Nguyen
afb08f814a mononoke/repo_import: created initial main and target files
Summary: Added basic main and target files for the repo import tool

Reviewed By: StanislavGlebik

Differential Revision: D22067642

fbshipit-source-id: 5ed97e3f2446c86314918f57103c2ecb911e30b0
2020-06-17 03:22:16 -07:00