7A3NMQ6QLJBGUXO4YWSBSDLP6MBZXBRCMMLO72R5HLCYOAYF7TYQC
GGYUCHWQNTSJYIZQA2B7QFVESTKXN4DOCN5A3OGY34PDL3NSYCUQC
GVFKCLQHMYB5NIF5CQMJAJUMUIQJ5KWJP64RCE3YNRKME367R6EQC
5P6DJRJQB37DE5ZUIDZ6D4QPNZEVVEYBXBWJWM4JZ5RT7A7XOG2AC
L3VOQYAF3HCAFWJ7QFULL54WUZ35B4K3MWU5YDRW7R4VTXSDWJUQC
GNQD74OZ56J2R23GVUGFP3G5KVML2KDZ4OUZK6SVLSM7HVO2WOCAC
HF3NERPZP7TS7STG3WGVSPAYTVYR6IYQ3ZLYZ6EGCDRKNTSHJ2LAC
WCQM6IOKVTDHAVVFMQKGILO4TMKC5L636AR2Q7IT5UXUHUI7XG5AC
H3GAPFUC4TCMSLC3O4LUNQNHRANRNVIOQJRTZT4XQ3AUXFHTW4CAC
ZGMIJNFVDK7R6AF56FNCA23W5KV3HVBUBPTWMLQADCEPB3MOPELQC
getTreeItem (element: PijulChange): TreeItem | Thenable<TreeItem> {
const resourceUri = Uri.parse('pijul-change:' + element.hash);
getTreeItem (element: PijulChange | string): TreeItem | Thenable<TreeItem> {
if (element instanceof PijulChange) {
const resourceUri = Uri.parse('pijul-change:' + element.hash);
return {
// id: element.hash,
label: element.message,
description: `${element.author.name}, ${element.date.toISOString()}`,
collapsibleState: TreeItemCollapsibleState.Collapsed,
contextValue: 'pijulChange',
tooltip: `${element.hash}\nRecorded by ${element.author.fullName ?? element.author.name} at ${element.date.toISOString()}\n\n\t${element.message}\n`,
command: {
command: 'vscode.open',
title: 'Open Change TOML',
arguments: [resourceUri]
}
};
return {
label: element.message,
description: `${element.author.name}, ${element.date.toISOString()}`,
collapsibleState: TreeItemCollapsibleState.Collapsed,
contextValue: 'pijulChange',
tooltip: `${element.hash}\nRecorded by ${element.author.fullName ?? element.author.name} at ${element.date.toISOString()}\n\n\t${element.message}\n`,
command: {
command: 'vscode.open',
title: 'Open Change TOML',
arguments: [resourceUri]
}
};
} else {
// It's a string, representing a file path
// TODO: Use URIs instead of strings
// TODO: Customize appearance depending on file action (Edit, Replacement, Deletion, etc.)
const sections = element.split(/\\|\//);
return {
label: sections[sections.length - 1],
description: sections.slice(0, -1).join('/'),
collapsibleState: TreeItemCollapsibleState.None,
contextValue: 'pijulChangedFile'
// TODO: Command and Tooltip
};
}
// Show changes which the current one depends on
return await this.repository.getChangeDependencies(element);
if (element instanceof PijulChange) {
// Show the paths of the files altered by the parent change
return await this.repository.getChangeFiles(element);
} else {
// Paths have no children
return null;
}
}
/**
* Gets a list of the files which were altered in a change
* @param change The change to retrieve the altered files for
*/
async getChangeFiles (change: PijulChange): Promise<string[]> {
const changeToml = await this.getChangeToml(change.hash);
const changePattern = /\d\.\s([A-Za-z]+)\sin\s(.*):/g;
const files: Set<string> = new Set();
let match = changePattern.exec(changeToml);
while (match) {
files.add(match[2]);
match = changePattern.exec(changeToml);
}
return [...files];