Skip to content

Commit

Permalink
Release 1.27.0 package & documentation changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mhutchie committed Nov 1, 2020
1 parent 112e494 commit 2b88194
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 22 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Change Log

## 1.27.0 - 2020-11-01
* #281 For the Repository Settings Widget, read values defined in additional Git config files when they're included via [include directives](https://git-scm.com/docs/git-config#_includes) in local or global Git config files.
* #364 Parse and render a frequently used subset of inline Markdown formatting rules in commit messages and tag details (bold, italics, bold & italics, and inline code blocks). Markdown parsing can be disabled using the extension setting `git-graph.markdown`.
* #381 New Commit Details View File Context Menu, which is an alternative method to run any available actions on a file ("View Diff", "View File at this Revision", "Open File", and "Copy File Path to the Clipboard").
* #383 When the Commit Details View is open, the `CTRL/CMD + Up` / `CTRL/CMD + Down` keystrokes may be used to navigate topologically to the child / parent on the same branch (the existing behaviour). Now there is a new Shift Key Modifier, that when pressed in combination with the existing keystrokes (i.e. `CTRL/CMD + SHIFT + Up` / `CTRL/CMD + SHIFT + Down`), will follow the alternative branch when a branch or a merge is encountered.
* #385 Push branches or tags to multiple remotes from their respective dialogs.
* #386 Detect commit hashes in the body of the commit that's displayed in the Commit Details View, and make them clickable links that open the Commit Details View for the referenced commit.
* #389 Use the Visual Studio Code Color Theme's text selection background colour (set by some themes and users) in the Git Graph View.
* #392 Support Visual Studio Code's `git.path` Setting containing an array of possible Git executable paths (introduced in Visual Studio Code 1.50.0).
* #393 New display option for the Uncommitted Changes in the graph. This is controlled by the new extension setting `git-graph.graph.uncommittedChanges`.
* Open Circle at the Uncommitted Changes: Display the Uncommitted Changes as a grey open circle, connected to the commit referenced by HEAD with a solid grey line. The current file system's state is therefore always displayed as an open circle in the graph. *(the existing behaviour)*
* Open Circle at the Checked Out Commit: Display the Uncommitted Changes as a grey closed circle, connected to the commit referenced by HEAD with a dotted grey line. The commit referenced by HEAD is therefore always displayed as an open circle in the graph. *(the new option)*
* #398 New command "Git Graph: Get Version Information", that displays basic version information of the Git Graph installation, and allows it to be easily copied to the clipboard.
* Various code improvements.

## 1.26.0 - 2020-09-13
* #318 Customise the branches that are initially shown when the Git Graph View is first opened. Each repository can have it's initial branches configured from the Repository Settings Widget on the Git Graph View, or they may inherit the global configuration set by the extension settings `git-graph.repository.onLoad.showCheckedOutBranch` & `git-graph.repository.onLoad.showSpecificBranches`.
* #341 Added a new extension setting `git-graph.repository.showRemoteBranches`, to set the default value of the "Show Remote Branches" repository setting.
Expand Down Expand Up @@ -44,7 +59,7 @@
* #279 Support Chinese / Japanese / Korean IME Keyboard Enter Events on Mac's for dialog submission. Thanks [Kazuma Ebina (@kazuma1989)](https://github.com/kazuma1989)!
* #283 After the Keyboard Shortcut `CTRL + H` is run in the Git Graph View to scroll to the HEAD commit, the commit now momentarily flashes to draw attention to it.
* #285 Added a new extension setting `git-graph.repository.showUntrackedFiles`, that controls whether untracked files are included in the uncommitted changes on the Git Graph View. Default: true (enabled)
* #286 Added a "View File at Revision" button for each file displayed in the Commit Details / Comparison Views.
* #286 Added a "View File at this Revision" button for each file displayed in the Commit Details / Comparison Views.
* #287 Added a new "Only follow the first parent of commits" option to the Git Graph View's Repository Settings Widget. The default value can be defined globally for all repositories using the new extension setting `git-graph.repository.onlyFollowFirstParent`. Default: false (disabled)
* #292 Create a *.tar or *.zip archive of the repository at any branch or tag from the corresponding context menu.
* #299 Previously when the Commit Details View was open on a commit, `Up` / `Down` keystrokes would open the Commit Details View on the commit directly above or below it on the Git Graph View. This is now augmented with `CTRL/CMD + Up` / `CTRL/CMD + Down` keystrokes, that open the Commit Details View on its child or parent commit on the same branch.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ View a Git Graph of your repository, and easily perform Git actions from the gra
* When the Commit Details View is open on a commit:
* `Up` / `Down`: The Commit Details View will be opened on the commit directly above or below it on the Git Graph View.
* `CTRL/CMD + Up` / `CTRL/CMD + Down`: The Commit Details View will be opened on its child or parent commit on the same branch.
* If the Shift Key is also pressed (i.e. `CTRL/CMD + SHIFT + Up` / `CTRL/CMD + SHIFT + Down`), when branches or merges are encountered the alternative branch is followed.
* `Enter`: If a dialog is open, pressing enter submits the dialog, taking the primary (left) action.
* `Escape`: Closes the active dialog, context menu or the Commit Details View.
* Resize the width of each column, and show/hide the Date, Author & Commit columns.
Expand Down Expand Up @@ -91,7 +92,9 @@ A summary of the Git Graph extension settings are:
* **Graph**:
* **Colours**: Specifies the colours used on the graph.
* **Style**: Specifies the style of the graph.
* **Uncommitted Changes**: Specifies how the Uncommitted Changes are displayed on the graph.
* **Integrated Terminal Shell**: Specifies the path and filename of the Shell executable to be used by the Visual Studio Code Integrated Terminal, when it is opened by Git Graph.
* **Markdown**: Parse and render a frequently used subset of inline Markdown formatting rules in commit messages and tag details (bold, italics, bold & italics, and inline code blocks).
* **Max Depth Of Repo Search**: Specifies the maximum depth of subfolders to search when discovering repositories in the workspace.
* **Open New Tab Editor Group**: Specifies the Editor Group where Git Graph should open new tabs, when performing the following actions from the Git Graph View: Viewing the Visual Studio Code Diff View, Opening a File, Viewing a File at a Specific Revision.
* **Open to the Repo of the Active Text Editor Document**: Open the Git Graph View to the repository containing the active Text Editor document.
Expand Down Expand Up @@ -144,6 +147,7 @@ This extension contributes the following commands:
* `git-graph.endSpecificWorkspaceCodeReview`: Git Graph: End a specific Code Review in Workspace... _(used to end a specific Code Review without having to first open it in the Git Graph View)_
* `git-graph.removeGitRepository`: Git Graph: Remove Git Repository... _(used to remove repositories from Git Graph)_
* `git-graph.resumeWorkspaceCodeReview`: Git Graph: Resume a specific Code Review in Workspace... _(used to open the Git Graph View to a Code Review that is already in progress)_
* `git-graph.version`: Git Graph: Get Version Information

## Release Notes

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "git-graph",
"displayName": "Git Graph",
"version": "1.26.0",
"version": "1.27.0",
"publisher": "mhutchie",
"author": {
"name": "Michael Hutchison",
Expand Down
42 changes: 41 additions & 1 deletion tests/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import * as fs from 'fs';
const mockedFileSystemModule: any = {
access: jest.fn(),
constants: fs.constants,
readFile: jest.fn(),
realpath: jest.fn(),
stat: jest.fn()
};
Expand All @@ -23,7 +24,7 @@ import { DataSource } from '../src/dataSource';
import { ExtensionState } from '../src/extensionState';
import { Logger } from '../src/logger';
import { GitFileStatus, PullRequestProvider } from '../src/types';
import { GitExecutable, UNCOMMITTED, abbrevCommit, abbrevText, archive, constructIncompatibleGitVersionMessage, copyFilePathToClipboard, copyToClipboard, createPullRequest, evalPromises, findGit, getGitExecutable, getGitExecutableFromPaths, getNonce, getPathFromStr, getPathFromUri, getRelativeTimeDiff, getRepoName, isGitAtLeastVersion, isPathInWorkspace, openExtensionSettings, openFile, openGitTerminal, pathWithTrailingSlash, realpath, resolveSpawnOutput, resolveToSymbolicPath, showErrorMessage, showInformationMessage, viewDiff, viewFileAtRevision, viewScm } from '../src/utils';
import { GitExecutable, UNCOMMITTED, abbrevCommit, abbrevText, archive, constructIncompatibleGitVersionMessage, copyFilePathToClipboard, copyToClipboard, createPullRequest, evalPromises, findGit, getExtensionVersion, getGitExecutable, getGitExecutableFromPaths, getNonce, getPathFromStr, getPathFromUri, getRelativeTimeDiff, getRepoName, isGitAtLeastVersion, isPathInWorkspace, openExtensionSettings, openFile, openGitTerminal, pathWithTrailingSlash, realpath, resolveSpawnOutput, resolveToSymbolicPath, showErrorMessage, showInformationMessage, viewDiff, viewFileAtRevision, viewScm } from '../src/utils';
import { EventEmitter } from '../src/utils/event';

let extensionContext = vscode.mocks.extensionContext;
Expand Down Expand Up @@ -471,6 +472,45 @@ describe('getRelativeTimeDiff', () => {
});
});

describe('getExtensionVersion', () => {
it('Should return the extension\'s version number', async () => {
// Setup
mockedFileSystemModule.readFile.mockImplementationOnce((_: fs.PathLike, callback: (err: NodeJS.ErrnoException | null, data: string) => void) => callback(null, '{"version":"1.2.3"}'));

// Run
const version = await getExtensionVersion(vscode.mocks.extensionContext);

// Assert
expect(version).toBe('1.2.3');
const [path] = mockedFileSystemModule.readFile.mock.calls[0];
expect(getPathFromStr(path)).toBe('/path/to/extension/package.json');
});

it('Should reject if unable to read package.json file', async () => {
// Setup
let rejected = false;
mockedFileSystemModule.readFile.mockImplementationOnce((_: fs.PathLike, callback: (err: NodeJS.ErrnoException | null, data: string) => void) => callback(new Error(), ''));

// Run
await getExtensionVersion(vscode.mocks.extensionContext).catch(() => rejected = true);

// Assert
expect(rejected).toBe(true);
});

it('Should reject if unable to parse package.json file', async () => {
// Setup
let rejected = false;
mockedFileSystemModule.readFile.mockImplementationOnce((_: fs.PathLike, callback: (err: NodeJS.ErrnoException | null, data: string) => void) => callback(null, '{"version":"1.2.3"'));

// Run
await getExtensionVersion(vscode.mocks.extensionContext).catch(() => rejected = true);

// Assert
expect(rejected).toBe(true);
});
});

describe('getNonce', () => {
it('Should generate a nonce 32 characters long', () => {
// Run
Expand Down
8 changes: 4 additions & 4 deletions web/contextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ class ContextMenu {
const menuBounds = menu.getBoundingClientRect(), frameBounds = frameElem.getBoundingClientRect();
const relativeX = event.pageX + menuBounds.width < frameBounds.right
? -2 // context menu fits to the right
: event.pageX - menuBounds.width > 0
: event.pageX - menuBounds.width > frameBounds.left
? 2 - menuBounds.width // context menu fits to the left
: -2 - (menuBounds.width - (frameBounds.width - event.pageX)); // Overlap the context menu horizontally with the cursor
: -2 - (menuBounds.width - (frameBounds.width - (event.pageX - frameBounds.left))); // Overlap the context menu horizontally with the cursor
const relativeY = event.pageY + menuBounds.height < frameBounds.bottom
? -2 // context menu fits below
: event.pageY - menuBounds.height > 0
: event.pageY - menuBounds.height > frameBounds.top
? 2 - menuBounds.height // context menu fits above
: -2 - (menuBounds.height - (frameBounds.height - event.pageY)); // Overlap the context menu vertically with the cursor
: -2 - (menuBounds.height - (frameBounds.height - (event.pageY - frameBounds.top))); // Overlap the context menu vertically with the cursor
menu.style.left = (frameElem.scrollLeft + Math.max(event.pageX - frameBounds.left + relativeX, 2)) + 'px';
menu.style.top = (frameElem.scrollTop + Math.max(event.pageY - frameBounds.top + relativeY, 2)) + 'px';
menu.style.opacity = '1';
Expand Down
6 changes: 1 addition & 5 deletions web/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2693,7 +2693,6 @@ class GitGraphView {
const isUncommitted = commitOrder.to === UNCOMMITTED;

expandedCommit.fileContextMenuOpen = parseInt(fileElem.dataset.index!);
this.saveState();

const target: ContextMenuTarget & CommitTarget = {
type: TargetType.CommitDetailsView,
Expand Down Expand Up @@ -2729,10 +2728,7 @@ class GitGraphView {
}
]
], false, target, <MouseEvent>e, this.isCdvDocked() ? document.body : this.viewElem, filesElem, () => {
if (expandedCommit.fileContextMenuOpen > -1) {
expandedCommit.fileContextMenuOpen = -1;
this.saveState();
}
expandedCommit.fileContextMenuOpen = -1;
});
});
}
Expand Down
19 changes: 9 additions & 10 deletions web/textFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,22 +142,22 @@ class TextFormatter {

public format(input: string) {
if (this.config.multiline) {
let htmlLines = [], lines = input.split('\n'), i, j, match;
let html = [], lines = input.split('\n'), i, j, match;
for (i = 0; i < lines.length; i++) {
if (i > 0) {
htmlLines.push('<br/>');
html.push('<br/>');
}

j = 0;
if (match = lines[i].match(TextFormatter.INDENT_REGEXP)) {
for (j = 0; j < match[0].length; j++) {
htmlLines.push(match[0][j] === '\t' ? '&nbsp;&nbsp;&nbsp;&nbsp;' : '&nbsp;');
html.push(match[0][j] === '\t' ? '&nbsp;&nbsp;&nbsp;&nbsp;' : '&nbsp;');
}
}

htmlLines.push(this.formatLine(j > 0 ? lines[i].substring(j) : lines[i]));
html.push(this.formatLine(j > 0 ? lines[i].substring(j) : lines[i]));
}
return htmlLines.join('');
return html.join('');
} else {
return this.formatLine(input);
}
Expand Down Expand Up @@ -369,7 +369,8 @@ class TextFormatter {
const emphasisStack: TF.EmphasisDelimiter[] = [];
let stackMatch: number;
for (let i = 0; i < emphasisTokens.length; i++) {
const delimiter = emphasisTokens[i], run = emphasisRuns[delimiter.run];
const delimiter = emphasisTokens[i];
const run = emphasisRuns[delimiter.run];
if (run.close && (stackMatch = TextFormatter.findOpenEmphasis(delimiter, run, emphasisRuns, emphasisStack)) > -1) {
TextFormatter.insertIntoTree(tree, {
type: emphasisRuns[emphasisStack[stackMatch].run].type === TF.EmphasisDelimiterType.Asterisk ? TF.NodeType.Asterisk : TF.NodeType.Underscore,
Expand Down Expand Up @@ -472,10 +473,8 @@ class TextFormatter {
let firstChildIndexOfNode = -1, lastChildIndexOfNode = -1, curNode;
for (let i = 0; i < tree.contains.length; i++) {
curNode = tree.contains[i];
if (node.start < curNode.start) {
if (firstChildIndexOfNode === -1) {
firstChildIndexOfNode = i;
}
if (node.start < curNode.start && firstChildIndexOfNode === -1) {
firstChildIndexOfNode = i;
}
if (curNode.end < node.end) {
lastChildIndexOfNode = i;
Expand Down

0 comments on commit 2b88194

Please sign in to comment.