-
Notifications
You must be signed in to change notification settings - Fork 293
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
List mutable renames by dst changeset
Summary: This option prints out all renames of a given dst commit Reviewed By: markbt Differential Revision: D69530922 fbshipit-source-id: d8576b440992efe8d6a32b62c354d83eaf4f2846
- Loading branch information
1 parent
54ff777
commit 47c207a
Showing
5 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
eden/mononoke/tools/admin/src/commands/mutable_renames/list.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This software may be used and distributed according to the terms of the | ||
* GNU General Public License version 2. | ||
*/ | ||
|
||
use anyhow::Result; | ||
use clap::Args; | ||
use commit_id::parse_commit_id; | ||
use context::CoreContext; | ||
use mutable_renames::MutableRenamesRef; | ||
|
||
use super::Repo; | ||
|
||
#[derive(Args)] | ||
pub struct ListArgs { | ||
/// Commit ID to fetch renames from | ||
/// | ||
/// This can be any commit id type. Specify 'scheme=id' to disambiguate | ||
/// commit identity scheme (e.g. 'hg=HASH', 'globalrev=REV'). | ||
commit_id: String, | ||
} | ||
|
||
pub async fn list(ctx: &CoreContext, repo: &Repo, list_args: ListArgs) -> Result<()> { | ||
let target_commit = parse_commit_id(ctx, repo, &list_args.commit_id).await?; | ||
|
||
let entries = repo | ||
.mutable_renames() | ||
.list_renames_by_dst_cs_uncached(ctx, target_commit) | ||
.await?; | ||
|
||
if entries.is_empty() { | ||
println!("No mutable renames associated with this commit"); | ||
} else { | ||
for entry in entries { | ||
println!( | ||
"Destination path {:?}, destination bonsai CS {}, source path {:?}, source bonsai CS {}, source unode {:?}", | ||
entry.dst_path(), | ||
target_commit, | ||
entry.src_path(), | ||
entry.src_cs_id(), | ||
entry.src_unode() | ||
); | ||
} | ||
} | ||
Ok(()) | ||
} |