add descendants_of argument to commit_path_history

Differential Revision: D22502592

fbshipit-source-id: 8e3acf00a6c4dc9b651551a6723b582d9bcaca39
This commit is contained in:
Mateusz Kwapich 2020-07-23 07:31:40 -07:00 committed by Facebook GitHub Bot
parent 3b36868c5c
commit 2bf5cf7ca1
2 changed files with 40 additions and 2 deletions

View File

@ -202,8 +202,13 @@ impl SourceControlServiceImpl {
commit_path: thrift::CommitPathSpecifier,
params: thrift::CommitPathHistoryParams,
) -> Result<thrift::CommitPathHistoryResponse, errors::ServiceError> {
let (_repo, changeset) = self.repo_changeset(ctx, &commit_path.commit).await?;
let (repo, changeset) = self.repo_changeset(ctx, &commit_path.commit).await?;
let path = changeset.path(&commit_path.path)?;
let descendants_of = if let Some(descendants_of) = params.descendants_of {
Some(self.changeset_id(&repo, &descendants_of).await?)
} else {
None
};
let limit: usize = check_range_and_convert("limit", params.limit, 0..)?;
let skip: usize = check_range_and_convert("skip", params.skip, 0..)?;
@ -233,7 +238,7 @@ impl SourceControlServiceImpl {
let history_stream = path
.history(
after_timestamp.clone(),
None,
descendants_of,
params.follow_history_across_deletions,
)
.await?;

View File

@ -305,3 +305,36 @@ Test full log
Author: test
Summary: E
Test log with path and limited to descendants of
$ scsc log --repo repo -i "$COMMIT_I" -i "$COMMIT_C" --path b --limit 10 --history-across-deletions
Commit: 4eddc88ca261a8115dd01c3af50a17aad50287de
Date: 2020-01-03 00:00:00 +00:00
Author: test
Summary: I
Commit: 159ed529f60d23c614fe315d46a4b2eb5d27b569
Date: 2020-01-03 00:00:00 +00:00
Author: test
Summary: H
Commit: 3a61e10442a9b76f8826b05e7ef1a60d33c3bc2d
Date: 2020-01-01 00:00:00 +00:00
Author: test
Summary: F
Commit: ecbf21bc13d7ec53c820078066ca1dfeb1e8191d
Date: 2019-01-01 00:00:00 +00:00
Author: test
Summary: E
Commit: dba4093ee164cd983101ff9e37751e2a5465c6a9
Date: 2017-01-01 00:00:00 +00:00
Author: test
Summary: C