Skip to content

Commit

Permalink
refactor: remove unresolvedCount - was never set
Browse files Browse the repository at this point in the history
  • Loading branch information
senyai committed May 28, 2023
1 parent ae684c6 commit 4d0a7ef
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 59 deletions.
6 changes: 2 additions & 4 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1258,12 +1258,10 @@ export class CommandCenter {
otherRevision: FossilCheckin,
mergeAction: MergeAction
) {
const result = await repository.merge(otherRevision, mergeAction);
await repository.merge(otherRevision, mergeAction);
const { currentBranch } = repository;

if (result.unresolvedCount > 0) {
interaction.warnUnresolvedFiles(result.unresolvedCount);
} else if (currentBranch) {
if (currentBranch) {
const defaultMergeMessage = humanise.describeMerge(
currentBranch,
otherRevision
Expand Down
15 changes: 0 additions & 15 deletions src/interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1119,21 +1119,6 @@ export async function pickLogSource(
// return;
// }

export function warnUnresolvedFiles(unresolvedCount: number): void {
const fileOrFiles =
unresolvedCount === 1
? localize('file', 'file')
: localize('files', 'files');
window.showWarningMessage(
localize(
'unresolved files',
'Merge leaves {0} {1} unresolved.',
unresolvedCount,
fileOrFiles
)
);
}

export function warnUnsavedChanges(msg: string): void {
window.showWarningMessage(localize('unsaved changes', `Fossil: ${msg}`));
}
Expand Down
45 changes: 11 additions & 34 deletions src/openedRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ export interface PullOptions {
readonly autoUpdate: boolean; // run an update after the pull?
}

export interface IMergeResult {
readonly unresolvedCount: number;
}

export const enum ResourceStatus {
MODIFIED,
ADDED,
Expand Down Expand Up @@ -515,37 +511,18 @@ export class OpenedRepository {
}
}

async merge(
checkin: FossilCheckin,
integrate: MergeAction
): Promise<IMergeResult> {
try {
const extraArgs = (() => {
switch (integrate) {
case MergeAction.Cherrypick:
return ['--cherrypick'];
case MergeAction.Integrate:
return ['--integrate'];
default:
return [];
}
})();
await this.exec(['merge', checkin, ...extraArgs]);
return {
unresolvedCount: 0,
};
} catch (e) {
if (e instanceof FossilError && e.exitCode === 1) {
const match = e.stdout.match(/(\d+) files unresolved/);
if (match) {
return {
unresolvedCount: parseInt(match[1]),
};
}
async merge(checkin: FossilCheckin, integrate: MergeAction): Promise<void> {
const extraArgs = (() => {
switch (integrate) {
case MergeAction.Cherrypick:
return ['--cherrypick'];
case MergeAction.Integrate:
return ['--integrate'];
default:
return [];
}

throw e;
}
})();
await this.exec(['merge', checkin, ...extraArgs]);
}

async patchCreate(path: string): Promise<void> {
Expand Down
7 changes: 1 addition & 6 deletions src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
OpenedRepository,
Commit,
PullOptions,
IMergeResult,
CommitDetails,
TimelineOptions,
FossilRoot,
Expand Down Expand Up @@ -239,7 +238,6 @@ export const enum Operation {
Stage,
Revert,
Resolve,
Unresolve,
Parents,
Remove,
Rename,
Expand Down Expand Up @@ -912,10 +910,7 @@ export class Repository implements IDisposable, InteractionAPI {
}

@throttle
merge(
checkin: FossilCheckin,
mergeAction: MergeAction
): Promise<IMergeResult> {
merge(checkin: FossilCheckin, mergeAction: MergeAction): Promise<void> {
return this.runWithProgress(Operation.Merge, async () => {
return this.repository.merge(checkin, mergeAction);
});
Expand Down

0 comments on commit 4d0a7ef

Please sign in to comment.