Skip to content

Commit 8b058bb

Browse files
author
Miguel Solorio
authored
Merge branch 'master' into misolori/fold-icon-themeable
2 parents a01fee4 + ec41f20 commit 8b058bb

125 files changed

Lines changed: 2577 additions & 1307 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/launch.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,24 @@
7979
"order": 6
8080
}
8181
},
82+
{
83+
"type": "extensionHost",
84+
"request": "launch",
85+
"name": "VS Code Git Tests",
86+
"runtimeExecutable": "${execPath}",
87+
"args": [
88+
"/tmp/my4g9l",
89+
"--extensionDevelopmentPath=${workspaceFolder}/extensions/git",
90+
"--extensionTestsPath=${workspaceFolder}/extensions/git/out/test"
91+
],
92+
"outFiles": [
93+
"${workspaceFolder}/extensions/git/out/**/*.js"
94+
],
95+
"presentation": {
96+
"group": "5_tests",
97+
"order": 6
98+
}
99+
},
82100
{
83101
"type": "extensionHost",
84102
"request": "launch",
@@ -167,7 +185,9 @@
167185
"webRoot": "${workspaceFolder}",
168186
// Settings for js-debug:
169187
"pauseForSourceMap": false,
170-
"outFiles": ["${workspaceFolder}/out/**/*.js"],
188+
"outFiles": [
189+
"${workspaceFolder}/out/**/*.js"
190+
],
171191
},
172192
{
173193
"type": "node",

extensions/configuration-editing/schemas/devContainer.schema.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
"type": "array",
3030
"description": "Ports that are forwarded from the container to the local machine.",
3131
"items": {
32-
"type": "integer"
32+
"type": "integer",
33+
"maximum": 65535,
34+
"minimum": 0
3335
}
3436
},
3537
"remoteEnv": {

extensions/git/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1780,6 +1780,9 @@
17801780
"@types/mocha": "2.2.43",
17811781
"@types/node": "^12.11.7",
17821782
"@types/which": "^1.0.28",
1783-
"mocha": "^3.2.0"
1783+
"mocha": "^3.2.0",
1784+
"mocha-junit-reporter": "^1.23.3",
1785+
"mocha-multi-reporters": "^1.1.7",
1786+
"vscode": "^1.1.36"
17841787
}
17851788
}

extensions/git/src/api/api1.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import { Model } from '../model';
77
import { Repository as BaseRepository, Resource } from '../repository';
8-
import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, Ref, Submodule, Commit, Change, RepositoryUIState, Status, LogOptions, APIState } from './git';
8+
import { InputBox, Git, API, Repository, Remote, RepositoryState, Branch, Ref, Submodule, Commit, Change, RepositoryUIState, Status, LogOptions, APIState, CommitOptions } from './git';
99
import { Event, SourceControlInputBox, Uri, SourceControl } from 'vscode';
1010
import { mapEvent } from '../util';
1111
import { toGitUri } from '../uri';
@@ -202,6 +202,10 @@ export class ApiRepository implements Repository {
202202
log(options?: LogOptions): Promise<Commit[]> {
203203
return this._repository.log(options);
204204
}
205+
206+
commit(message: string, opts?: CommitOptions): Promise<void> {
207+
return this._repository.commit(message, opts);
208+
}
205209
}
206210

207211
export class ApiGit implements Git {

extensions/git/src/api/git.d.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ export interface LogOptions {
121121
readonly maxEntries?: number;
122122
}
123123

124+
export interface CommitOptions {
125+
all?: boolean | 'tracked';
126+
amend?: boolean;
127+
signoff?: boolean;
128+
signCommit?: boolean;
129+
empty?: boolean;
130+
}
131+
124132
export interface Repository {
125133

126134
readonly rootUri: Uri;
@@ -176,6 +184,8 @@ export interface Repository {
176184

177185
blame(path: string): Promise<string>;
178186
log(options?: LogOptions): Promise<Commit[]>;
187+
188+
commit(message: string, opts?: CommitOptions): Promise<void>;
179189
}
180190

181191
export type APIState = 'uninitialized' | 'initialized';

extensions/git/src/commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import * as path from 'path';
99
import { commands, Disposable, LineChange, MessageOptions, OutputChannel, Position, ProgressLocation, QuickPickItem, Range, SourceControlResourceState, TextDocumentShowOptions, TextEditor, Uri, ViewColumn, window, workspace, WorkspaceEdit, WorkspaceFolder } from 'vscode';
1010
import TelemetryReporter from 'vscode-extension-telemetry';
1111
import * as nls from 'vscode-nls';
12-
import { Branch, GitErrorCodes, Ref, RefType, Status } from './api/git';
13-
import { CommitOptions, ForcePushMode, Git, Stash } from './git';
12+
import { Branch, GitErrorCodes, Ref, RefType, Status, CommitOptions } from './api/git';
13+
import { ForcePushMode, Git, Stash } from './git';
1414
import { Model } from './model';
1515
import { Repository, Resource, ResourceGroupType } from './repository';
1616
import { applyLineChanges, getModifiedRange, intersectDiffWithRange, invertLineChange, toLineRanges } from './staging';

extensions/git/src/git.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { assign, groupBy, IDisposable, toDisposable, dispose, mkdirp, readBytes,
1515
import { CancellationToken, Progress, Uri } from 'vscode';
1616
import { URI } from 'vscode-uri';
1717
import { detectEncoding } from './encoding';
18-
import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status } from './api/git';
18+
import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status, CommitOptions } from './api/git';
1919
import * as byline from 'byline';
2020
import { StringDecoder } from 'string_decoder';
2121

@@ -725,14 +725,6 @@ export function parseLsFiles(raw: string): LsFilesElement[] {
725725
.map(([, mode, object, stage, file]) => ({ mode, object, stage, file }));
726726
}
727727

728-
export interface CommitOptions {
729-
all?: boolean | 'tracked';
730-
amend?: boolean;
731-
signoff?: boolean;
732-
signCommit?: boolean;
733-
empty?: boolean;
734-
}
735-
736728
export interface PullOptions {
737729
unshallow?: boolean;
738730
tags?: boolean;

extensions/git/src/repository.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import * as fs from 'fs';
77
import * as path from 'path';
88
import { CancellationToken, Command, Disposable, Event, EventEmitter, Memento, OutputChannel, ProgressLocation, ProgressOptions, scm, SourceControl, SourceControlInputBox, SourceControlInputBoxValidation, SourceControlInputBoxValidationType, SourceControlResourceDecorations, SourceControlResourceGroup, SourceControlResourceState, ThemeColor, Uri, window, workspace, WorkspaceEdit, Decoration } from 'vscode';
99
import * as nls from 'vscode-nls';
10-
import { Branch, Change, GitErrorCodes, LogOptions, Ref, RefType, Remote, Status } from './api/git';
10+
import { Branch, Change, GitErrorCodes, LogOptions, Ref, RefType, Remote, Status, CommitOptions } from './api/git';
1111
import { AutoFetcher } from './autofetch';
1212
import { debounce, memoize, throttle } from './decorators';
13-
import { Commit, CommitOptions, ForcePushMode, GitError, Repository as BaseRepository, Stash, Submodule, LogFileOptions } from './git';
13+
import { Commit, ForcePushMode, GitError, Repository as BaseRepository, Stash, Submodule, LogFileOptions } from './git';
1414
import { StatusBarCommands } from './statusbar';
1515
import { toGitUri } from './uri';
1616
import { anyEvent, combinedDisposable, debounceEvent, dispose, EmptyDisposable, eventToPromise, filterEvent, find, IDisposable, isDescendant, onceEvent } from './util';

extensions/git/src/test/git.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,42 +189,54 @@ suite('git', () => {
189189
suite('parseGitCommit', () => {
190190
test('single parent commit', function () {
191191
const GIT_OUTPUT_SINGLE_PARENT = `52c293a05038d865604c2284aa8698bd087915a1
192+
John Doe
192193
john.doe@mail.com
194+
1580811030
193195
8e5a374372b8393906c7e380dbb09349c5385554
194196
This is a commit message.\x00`;
195197

196198
assert.deepEqual(parseGitCommits(GIT_OUTPUT_SINGLE_PARENT), [{
197199
hash: '52c293a05038d865604c2284aa8698bd087915a1',
198200
message: 'This is a commit message.',
199201
parents: ['8e5a374372b8393906c7e380dbb09349c5385554'],
202+
authorDate: new Date(1580811030000),
203+
authorName: 'John Doe',
200204
authorEmail: 'john.doe@mail.com',
201205
}]);
202206
});
203207

204208
test('multiple parent commits', function () {
205209
const GIT_OUTPUT_MULTIPLE_PARENTS = `52c293a05038d865604c2284aa8698bd087915a1
210+
John Doe
206211
john.doe@mail.com
212+
1580811030
207213
8e5a374372b8393906c7e380dbb09349c5385554 df27d8c75b129ab9b178b386077da2822101b217
208214
This is a commit message.\x00`;
209215

210216
assert.deepEqual(parseGitCommits(GIT_OUTPUT_MULTIPLE_PARENTS), [{
211217
hash: '52c293a05038d865604c2284aa8698bd087915a1',
212218
message: 'This is a commit message.',
213219
parents: ['8e5a374372b8393906c7e380dbb09349c5385554', 'df27d8c75b129ab9b178b386077da2822101b217'],
220+
authorDate: new Date(1580811030000),
221+
authorName: 'John Doe',
214222
authorEmail: 'john.doe@mail.com',
215223
}]);
216224
});
217225

218226
test('no parent commits', function () {
219227
const GIT_OUTPUT_NO_PARENTS = `52c293a05038d865604c2284aa8698bd087915a1
228+
John Doe
220229
john.doe@mail.com
230+
1580811030
221231
222232
This is a commit message.\x00`;
223233

224234
assert.deepEqual(parseGitCommits(GIT_OUTPUT_NO_PARENTS), [{
225235
hash: '52c293a05038d865604c2284aa8698bd087915a1',
226236
message: 'This is a commit message.',
227237
parents: [],
238+
authorDate: new Date(1580811030000),
239+
authorName: 'John Doe',
228240
authorEmail: 'john.doe@mail.com',
229241
}]);
230242
});

extensions/git/src/test/index.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) Microsoft Corporation. All rights reserved.
3+
* Licensed under the MIT License. See License.txt in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
const path = require('path');
7+
const testRunner = require('vscode/lib/testrunner');
8+
9+
const suite = 'Integration Git Tests';
10+
11+
const options: any = {
12+
ui: 'tdd',
13+
useColors: (!process.env.BUILD_ARTIFACTSTAGINGDIRECTORY && process.platform !== 'win32'),
14+
timeout: 60000
15+
};
16+
17+
if (process.env.BUILD_ARTIFACTSTAGINGDIRECTORY) {
18+
options.reporter = 'mocha-multi-reporters';
19+
options.reporterOptions = {
20+
reporterEnabled: 'spec, mocha-junit-reporter',
21+
mochaJunitReporterReporterOptions: {
22+
testsuitesTitle: `${suite} ${process.platform}`,
23+
mochaFile: path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${suite.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`)
24+
}
25+
};
26+
}
27+
28+
testRunner.configure(options);
29+
30+
export = testRunner;

0 commit comments

Comments
 (0)