Skip to content

Commit

Permalink
Add Remote Tracking Branch to the diff summary area
Browse files Browse the repository at this point in the history
Summary: For the case that `remote_tracking_branch` of that specific diff is not empty, and is also not `master`; we would display that on the diff summary.

Reviewed By: evangrayk

Differential Revision: D62051002

fbshipit-source-id: 9a0b03230c33ede41365c2c9ca970af792d5817f
  • Loading branch information
Sittiphol Phanvilai authored and facebook-github-bot committed Sep 4, 2024
1 parent 70fad6c commit 7ec0bf5
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions addons/isl/src/CommitInfoView/CommitInfoView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,12 @@ export function CommitInfoDetails({commit}: {commit: CommitInfo}) {
previousFieldsBeingEdited,
);

const diffSummaries = useAtomValue(allDiffSummaries);
const remoteTrackingBranch = provider?.getRemoteTrackingBranch(
diffSummaries?.value ?? null,
commit.diffId ?? null,
);

const isSplitSuggestionSupported = provider?.isSplitSuggestionSupported() ?? false;
const selectedFiles = uncommittedChanges.filter(f =>
selection.isFullyOrPartiallySelected(f.path),
Expand Down Expand Up @@ -344,6 +350,17 @@ export function CommitInfoDetails({commit}: {commit: CommitInfo}) {
/>
);
})}
{remoteTrackingBranch !== null ? (
<Section>
<SmallCapsTitle>
<Icon icon="source-control"></Icon>
<T>Remote Tracking Branch</T>
</SmallCapsTitle>
<div className="commit-info-tokenized-field">
<span className="token">{remoteTrackingBranch}</span>
</div>
</Section>
) : null}
<Divider />
{commit.isDot && !isAmendDisabled ? (
<Section data-testid="changes-to-amend">
Expand Down
7 changes: 7 additions & 0 deletions addons/isl/src/codeReview/UICodeReviewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ export interface UICodeReviewProvider {

RepoInfo(): JSX.Element | null;

getRemoteTrackingBranch(
allDiffSummaries: Map<string, DiffSummary> | null,
diffId: DiffId | null,
): string | null;

getRemoteTrackingBranchFromDiffSummary(diff: DiffSummary | undefined | null): string | null;

isDiffClosed(summary: DiffSummary): boolean;

isDiffEligibleForCleanup(summary: DiffSummary): boolean;
Expand Down
9 changes: 9 additions & 0 deletions addons/isl/src/codeReview/github/github.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ export class GithubUICodeReviewProvider implements UICodeReviewProvider {
</span>
);
};

getRemoteTrackingBranch(): string | null {
return null;
}

getRemoteTrackingBranchFromDiffSummary(): string | null {
return null;
}

isSplitSuggestionSupported(): boolean {
return false;
}
Expand Down

0 comments on commit 7ec0bf5

Please sign in to comment.