Skip to content

Commit

Permalink
newadmin: only allow bonsay hg mapping overrides when necessary
Browse files Browse the repository at this point in the history
Summary:
This fixes a regression introduced with the port of the `derived-data` subcommand to `newadmin` (D49774292).

The old implementation that was deleted in D49779178 had the same behaviour as the code does after this change:
* Always override the lease for the derive subcommand
* Only override the bonsai hg mapping if `rederive` is passed

Reviewed By: YousefSalama

Differential Revision: D50735685

fbshipit-source-id: 4193c880bbd8d988e6292ca939cbdc6636041d68
  • Loading branch information
Pierre Chevalier authored and facebook-github-bot committed Oct 27, 2023
1 parent 9256504 commit 8c503a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,16 @@
$ mononoke_newadmin convert -R repo --from bonsai --to hg 1213979c6023f23e70dbe8845d773078ac1e0506bc2ab98382a329da0cb379a7 --derive
52aee0f873361473bbb29cbce0c1ba5d0c1a2c5e

# Now rederive HG_SET_COMMITTER_EXTRA=true. This changes hg hash, so let's run it with --rederive and make sure
# Now rederive HG_SET_COMMITTER_EXTRA=true. This changes hg hash, so we need to run with --rederive and make sure
# hg hash was overwritten.
$ HG_SET_COMMITTER_EXTRA=true ENABLED_DERIVED_DATA='["git_trees", "filenodes", "hgchangesets"]' setup_common_config
$ mononoke_newadmin derived-data -R repo derive -T hgchangesets -i 1213979c6023f23e70dbe8845d773078ac1e0506bc2ab98382a329da0cb379a7 --rederive

# Check hg hash after overwriting
# If we call derive without the rederive flag, we have the same hg hash as before
$ mononoke_newadmin derived-data -R repo derive -T hgchangesets -i 1213979c6023f23e70dbe8845d773078ac1e0506bc2ab98382a329da0cb379a7
$ mononoke_newadmin convert -R repo --from bonsai --to hg 1213979c6023f23e70dbe8845d773078ac1e0506bc2ab98382a329da0cb379a7
52aee0f873361473bbb29cbce0c1ba5d0c1a2c5e

# With rederive, we can see that the hash is now different as expected
$ mononoke_newadmin derived-data -R repo derive -T hgchangesets -i 1213979c6023f23e70dbe8845d773078ac1e0506bc2ab98382a329da0cb379a7 --rederive
$ mononoke_newadmin convert -R repo --from bonsai --to hg 1213979c6023f23e70dbe8845d773078ac1e0506bc2ab98382a329da0cb379a7
c4c28fe2943cad9b4fed5a6982d3ffc0a83b4e7e
4 changes: 1 addition & 3 deletions eden/mononoke/tools/admin/src/commands/derived_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ pub async fn run(app: MononokeApp, args: CommandArgs) -> Result<()> {
.await
} else {
app.open_repo_with_factory_customization(&args.repo, |repo_factory| {
repo_factory
.with_lease_override(|_| Arc::new(DummyLease {}))
.with_bonsai_hg_mapping_override()
repo_factory.with_lease_override(|_| Arc::new(DummyLease {}))
})
.await
}
Expand Down

0 comments on commit 8c503a2

Please sign in to comment.