Skip to content

Commit 41cc8ee

Browse files
navn-rfcollonval
andcommitted
Apply suggestions from code review
Rename widget accessor + Update doc Co-authored-by: Frédéric Collonval <[email protected]>
1 parent 2966786 commit 41cc8ee

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

src/commandsAndMenu.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,7 @@ export function addCommands(
484484
)
485485
});
486486

487+
// Bail early if the user wants to finish resolving conflicts
487488
if (!result.button.accept) {
488489
return;
489490
}

src/components/diff/NotebookDiff.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const createNotebookDiff = async (
9999

100100
if (model.hasConflict) {
101101
// FIXME: Merge view breaks when moving checkboxes to the toolbar
102-
// toolbar.addItem('clear-outputs', diffWidget.nbdWidget.widgets[0])
102+
// toolbar.addItem('clear-outputs', diffWidget.nbdimeWidget.widgets[0])
103103
}
104104

105105
// Connect toolbar checkbox and notebook diff widget
@@ -162,7 +162,10 @@ export class NotebookDiff extends Panel implements Git.Diff.IDiffWidget {
162162
return this._model.hasConflict;
163163
}
164164

165-
get nbdWidget(): NotebookDiffWidget | NotebookMergeWidget {
165+
/**
166+
* Nbdime notebook widget.
167+
*/
168+
get nbdimeWidget(): NotebookDiffWidget | NotebookMergeWidget {
166169
return this._nbdWidget;
167170
}
168171

@@ -174,10 +177,12 @@ export class NotebookDiff extends Panel implements Git.Diff.IDiffWidget {
174177
}
175178

176179
/**
177-
* Checks if the conflicted file has been resolved.
180+
* Checks if all conflicts have been resolved.
181+
*
182+
* @see https://github.com/jupyter/nbdime/blob/a74b538386d05e3e9c26753ad21faf9ff4d269d7/packages/webapp/src/app/save.ts#L2
178183
*/
179184
get isFileResolved(): boolean {
180-
const widget = this.nbdWidget as NotebookMergeWidget;
185+
const widget = this.nbdimeWidget as NotebookMergeWidget;
181186
this._lastSerializeModel = widget.model.serialize();
182187
const validated = widget.validateMerged(this._lastSerializeModel);
183188
return (
@@ -186,18 +191,19 @@ export class NotebookDiff extends Panel implements Git.Diff.IDiffWidget {
186191
}
187192

188193
/**
189-
* Gets the file contents of a resolved merge conflict,
194+
* Gets the file model of a resolved merge conflict,
190195
* and rejects if unable to retrieve.
191196
*
192-
* @see https://github.com/jupyter/nbdime/blob/a74b538386d05e3e9c26753ad21faf9ff4d269d7/packages/webapp/src/app/save.ts#L20
197+
* Note: `isFileResolved` is assumed to not have been called,
198+
* or to have been called just before calling this method for caching purposes.
193199
*/
194200
async getResolvedFile(): Promise<Partial<Contents.IModel>> {
195201
return Promise.resolve({
196202
format: 'json',
197203
type: 'notebook',
198204
content:
199205
this._lastSerializeModel ??
200-
(this.nbdWidget as NotebookMergeWidget).model.serialize()
206+
(this.nbdimeWidget as NotebookMergeWidget).model.serialize()
201207
});
202208
}
203209

src/components/diff/PlainTextDiff.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class PlainTextDiff extends Widget implements Git.Diff.IDiffWidget {
8181
}
8282

8383
/**
84-
* Gets the file contents of a resolved merge conflict,
84+
* Gets the file model of a resolved merge conflict,
8585
* and rejects if unable to retrieve.
8686
*/
8787
getResolvedFile(): Promise<Partial<Contents.IModel>> {

src/tokens.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ export namespace Git {
481481
*/
482482
isFileResolved: boolean;
483483
/**
484-
* Gets the file contents of a resolved merge conflict,
484+
* Gets the file model of a resolved merge conflict,
485485
* and rejects if unable to retrieve
486486
*/
487487
getResolvedFile(): Promise<Partial<Contents.IModel>>;
@@ -943,12 +943,6 @@ export namespace Git {
943943
super('Not in a Git Repository');
944944
}
945945
}
946-
947-
export class ConflictedFile extends Error {
948-
constructor(message: string) {
949-
super(message);
950-
}
951-
}
952946
}
953947

954948
/**

0 commit comments

Comments
 (0)