simple git installed

This commit is contained in:
Luis Fernando Molina committed 2021-01-05 10:10:30 +01:00
1 parent e2a8f4be8e
commit f2e744cb7e
276 files changed
+11110 -1

No files matched your search

@@ -0,0 +1,12 @@
import { BranchMultiDeleteResult, BranchSingleDeleteFailure, BranchSingleDeleteResult, BranchSingleDeleteSuccess } from '../../../typings';
export declare class BranchDeletionBatch implements BranchMultiDeleteResult {
all: BranchSingleDeleteResult[];
branches: {
[branchName: string]: BranchSingleDeleteResult;
};
errors: BranchSingleDeleteResult[];
get success(): boolean;
}
export declare function branchDeletionSuccess(branch: string, hash: string): BranchSingleDeleteSuccess;
export declare function branchDeletionFailure(branch: string): BranchSingleDeleteFailure;
export declare function isSingleBranchDeleteFailure(test: BranchSingleDeleteResult): test is BranchSingleDeleteSuccess;
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSingleBranchDeleteFailure = exports.branchDeletionFailure = exports.branchDeletionSuccess = exports.BranchDeletionBatch = void 0;
class BranchDeletionBatch {
constructor() {
this.all = [];
this.branches = {};
this.errors = [];
}
get success() {
return !this.errors.length;
}
}
exports.BranchDeletionBatch = BranchDeletionBatch;
function branchDeletionSuccess(branch, hash) {
return {
branch, hash, success: true,
};
}
exports.branchDeletionSuccess = branchDeletionSuccess;
function branchDeletionFailure(branch) {
return {
branch, hash: null, success: false,
};
}
exports.branchDeletionFailure = branchDeletionFailure;
function isSingleBranchDeleteFailure(test) {
return test.success;
}
exports.isSingleBranchDeleteFailure = isSingleBranchDeleteFailure;
//# sourceMappingURL=BranchDeleteSummary.js.map
@@ -0,0 +1 @@
{"version":3,"file":"BranchDeleteSummary.js","sourceRoot":"","sources":["BranchDeleteSummary.ts"],"names":[],"mappings":";;;AAOA,MAAa,mBAAmB;IAAhC;QACG,QAAG,GAA+B,EAAE,CAAC;QACrC,aAAQ,GAAuD,EAAE,CAAC;QAClE,WAAM,GAA+B,EAAE,CAAC;IAK3C,CAAC;IAHE,IAAI,OAAO;QACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC9B,CAAC;CACH;AARD,kDAQC;AAED,SAAgB,qBAAqB,CAAE,MAAc,EAAE,IAAY;IAChE,OAAO;QACJ,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI;KAC7B,CAAC;AACL,CAAC;AAJD,sDAIC;AAED,SAAgB,qBAAqB,CAAE,MAAc;IAClD,OAAO;QACJ,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK;KACpC,CAAC;AACL,CAAC;AAJD,sDAIC;AAED,SAAgB,2BAA2B,CAAE,IAA8B;IACxE,OAAO,IAAI,CAAC,OAAO,CAAC;AACvB,CAAC;AAFD,kEAEC"}
+10
View File
@@ -0,0 +1,10 @@
import { BranchSummary, BranchSummaryBranch } from '../../../typings';
export declare class BranchSummaryResult implements BranchSummary {
all: string[];
branches: {
[p: string]: BranchSummaryBranch;
};
current: string;
detached: boolean;
push(current: boolean, detached: boolean, name: string, commit: string, label: string): void;
}
+26
View File
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BranchSummaryResult = void 0;
class BranchSummaryResult {
constructor() {
this.all = [];
this.branches = {};
this.current = '';
this.detached = false;
}
push(current, detached, name, commit, label) {
if (current) {
this.detached = detached;
this.current = name;
}
this.all.push(name);
this.branches[name] = {
current: current,
name: name,
commit: commit,
label: label
};
}
}
exports.BranchSummaryResult = BranchSummaryResult;
//# sourceMappingURL=BranchSummary.js.map
@@ -0,0 +1 @@
{"version":3,"file":"BranchSummary.js","sourceRoot":"","sources":["BranchSummary.ts"],"names":[],"mappings":";;;AAEA,MAAa,mBAAmB;IAAhC;QACU,QAAG,GAAa,EAAE,CAAC;QACnB,aAAQ,GAAyC,EAAE,CAAC;QACpD,YAAO,GAAW,EAAE,CAAC;QACrB,aAAQ,GAAY,KAAK,CAAC;IAgBpC,CAAC;IAdE,IAAI,CAAC,OAAgB,EAAE,QAAiB,EAAE,IAAY,EAAE,MAAc,EAAE,KAAa;QAClF,IAAI,OAAO,EAAE;YACV,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;SACtB;QAED,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG;YACnB,OAAO,EAAE,OAAO;YAChB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,KAAK;SACd,CAAC;IACL,CAAC;CACH;AApBD,kDAoBC"}
+4
View File
@@ -0,0 +1,4 @@
/**
* Parser for the `check-ignore` command - returns each file as a string array
*/
export declare const parseCheckIgnore: (text: string) => string[];
+13
View File
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseCheckIgnore = void 0;
/**
* Parser for the `check-ignore` command - returns each file as a string array
*/
const parseCheckIgnore = (text) => {
return text.split(/\n/g)
.map(line => line.trim())
.filter(file => !!file);
};
exports.parseCheckIgnore = parseCheckIgnore;
//# sourceMappingURL=CheckIgnore.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"CheckIgnore.js","sourceRoot":"","sources":["CheckIgnore.ts"],"names":[],"mappings":";;;AACA;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAY,EAAE;IACxD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;SACpB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;SACxB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC9B,CAAC,CAAC;AAJW,QAAA,gBAAgB,oBAI3B"}
+9
View File
@@ -0,0 +1,9 @@
import { CleanSummary } from '../../../typings';
export declare class CleanResponse implements CleanSummary {
readonly dryRun: boolean;
paths: string[];
files: string[];
folders: string[];
constructor(dryRun: boolean);
}
export declare function cleanSummaryParser(dryRun: boolean, text: string): CleanSummary;
+28
View File
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cleanSummaryParser = exports.CleanResponse = void 0;
const utils_1 = require("../utils");
class CleanResponse {
constructor(dryRun) {
this.dryRun = dryRun;
this.paths = [];
this.files = [];
this.folders = [];
}
}
exports.CleanResponse = CleanResponse;
const removalRegexp = /^[a-z]+\s*/i;
const dryRunRemovalRegexp = /^[a-z]+\s+[a-z]+\s*/i;
const isFolderRegexp = /\/$/;
function cleanSummaryParser(dryRun, text) {
const summary = new CleanResponse(dryRun);
const regexp = dryRun ? dryRunRemovalRegexp : removalRegexp;
utils_1.toLinesWithContent(text).forEach(line => {
const removed = line.replace(regexp, '');
summary.paths.push(removed);
(isFolderRegexp.test(removed) ? summary.folders : summary.files).push(removed);
});
return summary;
}
exports.cleanSummaryParser = cleanSummaryParser;
//# sourceMappingURL=CleanSummary.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"CleanSummary.js","sourceRoot":"","sources":["CleanSummary.ts"],"names":[],"mappings":";;;AACA,oCAA8C;AAE9C,MAAa,aAAa;IAMvB,YACmB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;QAL3B,UAAK,GAAa,EAAE,CAAC;QACrB,UAAK,GAAa,EAAE,CAAC;QACrB,YAAO,GAAa,EAAE,CAAC;IAI3B,CAAC;CAEN;AAVD,sCAUC;AAED,MAAM,aAAa,GAAG,aAAa,CAAC;AACpC,MAAM,mBAAmB,GAAG,sBAAsB,CAAC;AACnD,MAAM,cAAc,GAAG,KAAK,CAAC;AAE7B,SAAgB,kBAAkB,CAAE,MAAe,EAAE,IAAY;IAC9D,MAAM,OAAO,GAAG,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,aAAa,CAAC;IAE5D,0BAAkB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAEzC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AAClB,CAAC;AAZD,gDAYC"}
+12
View File
@@ -0,0 +1,12 @@
import { ConfigListSummary, ConfigValues } from '../../../typings';
export declare class ConfigList implements ConfigListSummary {
files: string[];
values: {
[fileName: string]: ConfigValues;
};
private _all;
get all(): ConfigValues;
addFile(file: string): ConfigValues;
addValue(file: string, key: string, value: string): void;
}
export declare function configListParser(text: string): ConfigList;
+55
View File
@@ -0,0 +1,55 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.configListParser = exports.ConfigList = void 0;
const utils_1 = require("../utils");
class ConfigList {
constructor() {
this.files = [];
this.values = Object.create(null);
}
get all() {
if (!this._all) {
this._all = this.files.reduce((all, file) => {
return Object.assign(all, this.values[file]);
}, {});
}
return this._all;
}
addFile(file) {
if (!(file in this.values)) {
const latest = utils_1.last(this.files);
this.values[file] = latest ? Object.create(this.values[latest]) : {};
this.files.push(file);
}
return this.values[file];
}
addValue(file, key, value) {
const values = this.addFile(file);
if (!values.hasOwnProperty(key)) {
values[key] = value;
}
else if (Array.isArray(values[key])) {
values[key].push(value);
}
else {
values[key] = [values[key], value];
}
this._all = undefined;
}
}
exports.ConfigList = ConfigList;
function configListParser(text) {
const config = new ConfigList();
const lines = text.split('\0');
for (let i = 0, max = lines.length - 1; i < max;) {
const file = configFilePath(lines[i++]);
const [key, value] = utils_1.splitOn(lines[i++], '\n');
config.addValue(file, key, value);
}
return config;
}
exports.configListParser = configListParser;
function configFilePath(filePath) {
return filePath.replace(/^(file):/, '');
}
//# sourceMappingURL=ConfigList.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"ConfigList.js","sourceRoot":"","sources":["ConfigList.ts"],"names":[],"mappings":";;;AACA,oCAAyC;AAEzC,MAAa,UAAU;IAAvB;QAEU,UAAK,GAAa,EAAE,CAAC;QACrB,WAAM,GAAyC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAuC7E,CAAC;IAnCE,IAAW,GAAG;QACX,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;YACb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,GAAiB,EAAE,IAAY,EAAE,EAAE;gBAC/D,OAAO,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;YAChD,CAAC,EAAE,EAAE,CAAC,CAAC;SACT;QAED,OAAO,IAAI,CAAC,IAAI,CAAC;IACpB,CAAC;IAEM,OAAO,CAAC,IAAY;QACxB,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,EAAE;YACzB,MAAM,MAAM,GAAG,YAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;YAEpE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACxB;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAEM,QAAQ,CAAC,IAAY,EAAE,GAAW,EAAE,KAAa;QACrD,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, DiffResultBinaryFile, DiffResultTextFile } from '../../../typings';
/***
* The DiffSummary is returned as a response to getting `git().status()`
*/
export declare class DiffSummary implements DiffResult {
changed: number;
deletions: number;
insertions: number;
files: Array<DiffResultTextFile | DiffResultBinaryFile>;
}
+16
View File
@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DiffSummary = void 0;
/***
* The DiffSummary is returned as a response to getting `git().status()`
*/
class DiffSummary {
constructor() {
this.changed = 0;
this.deletions = 0;
this.insertions = 0;
this.files = [];
}
}
exports.DiffSummary = DiffSummary;
//# sourceMappingURL=DiffSummary.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"DiffSummary.js","sourceRoot":"","sources":["DiffSummary.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,MAAa,WAAW;IAAxB;QACG,YAAO,GAAG,CAAC,CAAA;QACX,cAAS,GAAG,CAAC,CAAC;QACd,eAAU,GAAG,CAAC,CAAC;QAEf,UAAK,GAAqD,EAAE,CAAC;IAChE,CAAC;CAAA;AAND,kCAMC"}
@@ -0,0 +1,9 @@
import { FileStatusResult } from '../../../typings/response';
export declare const fromPathRegex: RegExp;
export declare class FileStatusSummary implements FileStatusResult {
path: string;
index: string;
working_dir: string;
readonly from: string | undefined;
constructor(path: string, index: string, working_dir: string);
}
+18
View File
@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FileStatusSummary = exports.fromPathRegex = void 0;
exports.fromPathRegex = /^(.+) -> (.+)$/;
class FileStatusSummary {
constructor(path, index, working_dir) {
this.path = path;
this.index = index;
this.working_dir = working_dir;
if ('R' === (index + working_dir)) {
const detail = exports.fromPathRegex.exec(path) || [null, path, path];
this.from = detail[1] || '';
this.path = detail[2] || '';
}
}
}
exports.FileStatusSummary = FileStatusSummary;
//# sourceMappingURL=FileStatusSummary.js.map
@@ -0,0 +1 @@
{"version":3,"file":"FileStatusSummary.js","sourceRoot":"","sources":["FileStatusSummary.ts"],"names":[],"mappings":";;;AAEa,QAAA,aAAa,GAAG,gBAAgB,CAAC;AAE9C,MAAa,iBAAiB;IAI3B,YACU,IAAY,EACZ,KAAa,EACb,WAAmB;QAFnB,SAAI,GAAJ,IAAI,CAAQ;QACZ,UAAK,GAAL,KAAK,CAAQ;QACb,gBAAW,GAAX,WAAW,CAAQ;QAE1B,IAAI,GAAG,KAAK,CAAC,KAAK,GAAG,WAAW,CAAC,EAAE;YAChC,MAAM,MAAM,GAAG,qBAAa,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAC9D,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC5B,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SAC9B;IACJ,CAAC;CACH;AAfD,8CAeC"}
+11
View File
@@ -0,0 +1,11 @@
export interface RemoteWithoutRefs {
name: string;
}
export interface RemoteWithRefs extends RemoteWithoutRefs {
refs: {
fetch: string;
push: string;
};
}
export declare function parseGetRemotes(text: string): RemoteWithoutRefs[];
export declare function parseGetRemotesVerbose(text: string): RemoteWithRefs[];
+30
View File
@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseGetRemotesVerbose = exports.parseGetRemotes = void 0;
const utils_1 = require("../utils");
function parseGetRemotes(text) {
const remotes = {};
forEach(text, ([name]) => remotes[name] = { name });
return Object.values(remotes);
}
exports.parseGetRemotes = parseGetRemotes;
function parseGetRemotesVerbose(text) {
const remotes = {};
forEach(text, ([name, url, purpose]) => {
if (!remotes.hasOwnProperty(name)) {
remotes[name] = {
name: name,
refs: { fetch: '', push: '' },
};
}
if (purpose && url) {
remotes[name].refs[purpose.replace(/[^a-z]/g, '')] = url;
}
});
return Object.values(remotes);
}
exports.parseGetRemotesVerbose = parseGetRemotesVerbose;
function forEach(text, handler) {
utils_1.forEachLineWithContent(text, (line) => handler(line.split(/\s+/)));
}
//# sourceMappingURL=GetRemoteSummary.js.map
@@ -0,0 +1 @@
{"version":3,"file":"GetRemoteSummary.js","sourceRoot":"","sources":["GetRemoteSummary.ts"],"names":[],"mappings":";;;AAAA,oCAAkD;AAalD,SAAgB,eAAe,CAAE,IAAY;IAC1C,MAAM,OAAO,GAAwC,EAAE,CAAC;IAExD,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;IAEpD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAND,0CAMC;AAED,SAAgB,sBAAsB,CAAE,IAAY;IACjD,MAAM,OAAO,GAAqC,EAAE,CAAC;IAErD,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE;QACpC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;YAChC,OAAO,CAAC,IAAI,CAAC,GAAG;gBACb,IAAI,EAAE,IAAI;gBACV,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;aAC/B,CAAC;SACJ;QAED,IAAI,OAAO,IAAI,GAAG,EAAE;YACjB,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAiC,CAAC,GAAG,GAAG,CAAC;SAC3F;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAjBD,wDAiBC;AAED,SAAS,OAAO,CAAC,IAAY,EAAE,OAAiC;IAC7D,8BAAsB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC"}
+9
View File
@@ -0,0 +1,9 @@
import { InitResult } from '../../../typings';
export declare class InitSummary implements InitResult {
readonly bare: boolean;
readonly path: string;
readonly existing: boolean;
readonly gitDir: string;
constructor(bare: boolean, path: string, existing: boolean, gitDir: string);
}
export declare function parseInit(bare: boolean, path: string, text: string): InitSummary;
+36
View File
@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseInit = exports.InitSummary = void 0;
class InitSummary {
constructor(bare, path, existing, gitDir) {
this.bare = bare;
this.path = path;
this.existing = existing;
this.gitDir = gitDir;
}
}
exports.InitSummary = InitSummary;
const initResponseRegex = /^Init.+ repository in (.+)$/;
const reInitResponseRegex = /^Rein.+ in (.+)$/;
function parseInit(bare, path, text) {
const response = String(text).trim();
let result;
if ((result = initResponseRegex.exec(response))) {
return new InitSummary(bare, path, false, result[1]);
}
if ((result = reInitResponseRegex.exec(response))) {
return new InitSummary(bare, path, true, result[1]);
}
let gitDir = '';
const tokens = response.split(' ');
while (tokens.length) {
const token = tokens.shift();
if (token === 'in') {
gitDir = tokens.join(' ');
break;
}
}
return new InitSummary(bare, path, /^re/i.test(response), gitDir);
}
exports.parseInit = parseInit;
//# sourceMappingURL=InitSummary.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"InitSummary.js","sourceRoot":"","sources":["InitSummary.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IACrB,YACmB,IAAa,EACb,IAAY,EACZ,QAAiB,EACjB,MAAc;QAHd,SAAI,GAAJ,IAAI,CAAS;QACb,SAAI,GAAJ,IAAI,CAAQ;QACZ,aAAQ,GAAR,QAAQ,CAAS;QACjB,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;CACN;AAPD,kCAOC;AAED,MAAM,iBAAiB,GAAG,6BAA6B,CAAC;AACxD,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAE/C,SAAgB,SAAS,CAAC,IAAa,EAAE,IAAY,EAAE,IAAY;IAChE,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IACrC,IAAI,MAAM,CAAC;IAEX,IAAI,CAAC,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE;QAC9C,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACvD;IAED,IAAI,CAAC,MAAM,GAAG,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE;QAChD,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;KACtD;IAED,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnC,OAAO,MAAM,CAAC,MAAM,EAAE;QACnB,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,KAAK,KAAK,IAAI,EAAE;YACjB,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC1B,MAAM;SACR;KACH;IAED,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AACrE,CAAC;AAvBD,8BAuBC"}
+16
View File
@@ -0,0 +1,16 @@
import { MergeConflict, MergeConflictDeletion, MergeDetail, MergeResultStatus } from '../../../typings';
export declare class MergeSummaryConflict implements MergeConflict {
readonly reason: string;
readonly file: string | null;
readonly meta?: MergeConflictDeletion | undefined;
constructor(reason: string, file?: string | null, meta?: MergeConflictDeletion | undefined);
toString(): string;
}
export declare class MergeSummaryDetail implements MergeDetail {
conflicts: MergeConflict[];
merges: string[];
result: MergeResultStatus;
get failed(): boolean;
get reason(): string;
toString(): string;
}
+35
View File
@@ -0,0 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MergeSummaryDetail = exports.MergeSummaryConflict = void 0;
class MergeSummaryConflict {
constructor(reason, file = null, meta) {
this.reason = reason;
this.file = file;
this.meta = meta;
}
toString() {
return `${this.file}:${this.reason}`;
}
}
exports.MergeSummaryConflict = MergeSummaryConflict;
class MergeSummaryDetail {
constructor() {
this.conflicts = [];
this.merges = [];
this.result = 'success';
}
get failed() {
return this.conflicts.length > 0;
}
get reason() {
return this.result;
}
toString() {
if (this.conflicts.length) {
return `CONFLICTS: ${this.conflicts.join(', ')}`;
}
return 'OK';
}
}
exports.MergeSummaryDetail = MergeSummaryDetail;
//# sourceMappingURL=MergeSummary.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"MergeSummary.js","sourceRoot":"","sources":["MergeSummary.ts"],"names":[],"mappings":";;;AAEA,MAAa,oBAAoB;IAC9B,YACmB,MAAc,EACd,OAAsB,IAAI,EAC1B,IAA4B;QAF5B,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAsB;QAC1B,SAAI,GAAJ,IAAI,CAAwB;IAE/C,CAAC;IAED,QAAQ;QACL,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;IACxC,CAAC;CACH;AAXD,oDAWC;AAED,MAAa,kBAAkB;IAA/B;QACU,cAAS,GAAoB,EAAE,CAAC;QAChC,WAAM,GAAa,EAAE,CAAC;QACtB,WAAM,GAAsB,SAAS,CAAC;IAiBhD,CAAC;IAfE,IAAI,MAAM;QACP,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;IACpC,CAAC;IAED,IAAI,MAAM;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACtB,CAAC;IAED,QAAQ;QACL,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE;YACxB,OAAO,cAAc,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;SACnD;QAED,OAAO,IAAI,CAAC;IACf,CAAC;CACH;AApBD,gDAoBC"}
+12
View File
@@ -0,0 +1,12 @@
import { PullDetailFileChanges, PullDetailSummary, PullResult } from '../../../typings';
export declare class PullSummary implements PullResult {
remoteMessages: {
all: never[];
};
created: never[];
deleted: string[];
files: string[];
deletions: PullDetailFileChanges;
insertions: PullDetailFileChanges;
summary: PullDetailSummary;
}
+22
View File
@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PullSummary = void 0;
class PullSummary {
constructor() {
this.remoteMessages = {
all: [],
};
this.created = [];
this.deleted = [];
this.files = [];
this.deletions = {};
this.insertions = {};
this.summary = {
changes: 0,
deletions: 0,
insertions: 0,
};
}
}
exports.PullSummary = PullSummary;
//# sourceMappingURL=PullSummary.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"PullSummary.js","sourceRoot":"","sources":["PullSummary.ts"],"names":[],"mappings":";;;AAEA,MAAa,WAAW;IAAxB;QACU,mBAAc,GAAG;YACrB,GAAG,EAAE,EAAE;SACT,CAAC;QACK,YAAO,GAAG,EAAE,CAAC;QACb,YAAO,GAAa,EAAE,CAAC;QACvB,UAAK,GAAa,EAAE,CAAC;QACrB,cAAS,GAA0B,EAAE,CAAC;QACtC,eAAU,GAA0B,EAAE,CAAC;QACvC,YAAO,GAAsB;YACjC,OAAO,EAAE,CAAC;YACV,SAAS,EAAE,CAAC;YACZ,UAAU,EAAE,CAAC;SACf,CAAC;IACL,CAAC;CAAA;AAdD,kCAcC"}
+39
View File
@@ -0,0 +1,39 @@
import { FileStatusResult, StatusResult, StatusResultRenamed } from '../../../typings';
/**
* The StatusSummary is returned as a response to getting `git().status()`
*/
export declare class StatusSummary implements StatusResult {
not_added: string[];
conflicted: string[];
created: string[];
deleted: string[];
modified: string[];
renamed: StatusResultRenamed[];
/**
* All files represented as an array of objects containing the `path` and status in `index` and
* in the `working_dir`.
*/
files: FileStatusResult[];
staged: string[];
/**
* Number of commits ahead of the tracked branch
*/
ahead: number;
/**
*Number of commits behind the tracked branch
*/
behind: number;
/**
* Name of the current branch
*/
current: string | null;
/**
* Name of the branch being tracked
*/
tracking: string | null;
/**
* Gets whether this StatusSummary represents a clean working branch.
*/
isClean(): boolean;
}
export declare const parseStatusSummary: (text: string) => StatusResult;
+148
View File
@@ -0,0 +1,148 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseStatusSummary = exports.StatusSummary = void 0;
const utils_1 = require("../utils");
const FileStatusSummary_1 = require("./FileStatusSummary");
/**
* The StatusSummary is returned as a response to getting `git().status()`
*/
class StatusSummary {
constructor() {
this.not_added = [];
this.conflicted = [];
this.created = [];
this.deleted = [];
this.modified = [];
this.renamed = [];
/**
* All files represented as an array of objects containing the `path` and status in `index` and
* in the `working_dir`.
*/
this.files = [];
this.staged = [];
/**
* Number of commits ahead of the tracked branch
*/
this.ahead = 0;
/**
*Number of commits behind the tracked branch
*/
this.behind = 0;
/**
* Name of the current branch
*/
this.current = null;
/**
* Name of the branch being tracked
*/
this.tracking = null;
}
/**
* Gets whether this StatusSummary represents a clean working branch.
*/
isClean() {
return !this.files.length;
}
}
exports.StatusSummary = StatusSummary;
var PorcelainFileStatus;
(function (PorcelainFileStatus) {
PorcelainFileStatus["ADDED"] = "A";
PorcelainFileStatus["DELETED"] = "D";
PorcelainFileStatus["MODIFIED"] = "M";
PorcelainFileStatus["RENAMED"] = "R";
PorcelainFileStatus["COPIED"] = "C";
PorcelainFileStatus["UNMERGED"] = "U";
PorcelainFileStatus["UNTRACKED"] = "?";
PorcelainFileStatus["IGNORED"] = "!";
PorcelainFileStatus["NONE"] = " ";
})(PorcelainFileStatus || (PorcelainFileStatus = {}));
function renamedFile(line) {
const detail = /^(.+) -> (.+)$/.exec(line);
if (!detail) {
return {
from: line, to: line
};
}
return {
from: String(detail[1]),
to: String(detail[2]),
};
}
function parser(indexX, indexY, handler) {
return [`${indexX}${indexY}`, handler];
}
function conflicts(indexX, ...indexY) {
return indexY.map(y => parser(indexX, y, (result, file) => utils_1.append(result.conflicted, file)));
}
const parsers = new Map([
parser(PorcelainFileStatus.NONE, PorcelainFileStatus.ADDED, (result, file) => utils_1.append(result.created, file)),
parser(PorcelainFileStatus.NONE, PorcelainFileStatus.DELETED, (result, file) => utils_1.append(result.deleted, file)),
parser(PorcelainFileStatus.NONE, PorcelainFileStatus.MODIFIED, (result, file) => utils_1.append(result.modified, file)),
parser(PorcelainFileStatus.ADDED, PorcelainFileStatus.NONE, (result, file) => utils_1.append(result.created, file) && utils_1.append(result.staged, file)),
parser(PorcelainFileStatus.ADDED, PorcelainFileStatus.MODIFIED, (result, file) => utils_1.append(result.created, file) && utils_1.append(result.staged, file) && utils_1.append(result.modified, file)),
parser(PorcelainFileStatus.DELETED, PorcelainFileStatus.NONE, (result, file) => utils_1.append(result.deleted, file) && utils_1.append(result.staged, file)),
parser(PorcelainFileStatus.MODIFIED, PorcelainFileStatus.NONE, (result, file) => utils_1.append(result.modified, file) && utils_1.append(result.staged, file)),
parser(PorcelainFileStatus.MODIFIED, PorcelainFileStatus.MODIFIED, (result, file) => utils_1.append(result.modified, file) && utils_1.append(result.staged, file)),
parser(PorcelainFileStatus.RENAMED, PorcelainFileStatus.NONE, (result, file) => {
utils_1.append(result.renamed, renamedFile(file));
}),
parser(PorcelainFileStatus.RENAMED, PorcelainFileStatus.MODIFIED, (result, file) => {
const renamed = renamedFile(file);
utils_1.append(result.renamed, renamed);
utils_1.append(result.modified, renamed.to);
}),
parser(PorcelainFileStatus.UNTRACKED, PorcelainFileStatus.UNTRACKED, (result, file) => utils_1.append(result.not_added, file)),
...conflicts(PorcelainFileStatus.ADDED, PorcelainFileStatus.ADDED, PorcelainFileStatus.UNMERGED),
...conflicts(PorcelainFileStatus.DELETED, PorcelainFileStatus.DELETED, PorcelainFileStatus.UNMERGED),
...conflicts(PorcelainFileStatus.UNMERGED, PorcelainFileStatus.ADDED, PorcelainFileStatus.DELETED, PorcelainFileStatus.UNMERGED),
['##', (result, line) => {
const aheadReg = /ahead (\d+)/;
const behindReg = /behind (\d+)/;
const currentReg = /^(.+?(?=(?:\.{3}|\s|$)))/;
const trackingReg = /\.{3}(\S*)/;
const onEmptyBranchReg = /\son\s([\S]+)$/;
let regexResult;
regexResult = aheadReg.exec(line);
result.ahead = regexResult && +regexResult[1] || 0;
regexResult = behindReg.exec(line);
result.behind = regexResult && +regexResult[1] || 0;
regexResult = currentReg.exec(line);
result.current = regexResult && regexResult[1];
regexResult = trackingReg.exec(line);
result.tracking = regexResult && regexResult[1];
regexResult = onEmptyBranchReg.exec(line);
result.current = regexResult && regexResult[1] || result.current;
}]
]);
const parseStatusSummary = function (text) {
const lines = text.trim().split('\n');
const status = new StatusSummary();
for (let i = 0, l = lines.length; i < l; i++) {
splitLine(status, lines[i]);
}
return status;
};
exports.parseStatusSummary = parseStatusSummary;
function splitLine(result, lineStr) {
const trimmed = lineStr.trim();
switch (' ') {
case trimmed.charAt(2):
return data(trimmed.charAt(0), trimmed.charAt(1), trimmed.substr(3));
case trimmed.charAt(1):
return data(PorcelainFileStatus.NONE, trimmed.charAt(0), trimmed.substr(2));
default:
return;
}
function data(index, workingDir, path) {
const raw = `${index}${workingDir}`;
const handler = parsers.get(raw);
if (handler) {
handler(result, path);
}
if (raw !== '##') {
result.files.push(new FileStatusSummary_1.FileStatusSummary(path, index, workingDir));
}
}
}
//# sourceMappingURL=StatusSummary.js.map
@@ -0,0 +1 @@
{"version":3,"file":"StatusSummary.js","sourceRoot":"","sources":["StatusSummary.ts"],"names":[],"mappings":";;;AACA,oCAAkC;AAClC,2DAAwD;AAExD;;GAEG;AACH,MAAa,aAAa;IAA1B;QACU,cAAS,GAAa,EAAE,CAAC;QACzB,eAAU,GAAa,EAAE,CAAC;QAC1B,YAAO,GAAa,EAAE,CAAC;QAC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,WAAW,CAAC,CAAC,CAAC,CAAC;YAE/C,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrC,MAAM,CAAC,QAAQ,GAAG,WAAW,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;YAEhD,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,CAAC,OAAO,GAAG,WAAW,IAAI,WAAW,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC;QACpE,CAAC,CAAC;CACJ,CAAC,CAAC;AAEI,MAAM,kBAAkB,GAAG,UAAU,IAAY;IACrD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;IAEnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QAC3C,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KAC9B;IAED,OAAO,MAAM,Line truncated
+7
View File
@@ -0,0 +1,7 @@
import { TagResult } from '../../../typings';
export declare class TagList implements TagResult {
readonly all: string[];
readonly latest: string | undefined;
constructor(all: string[], latest: string | undefined);
}
export declare const parseTagList: (data: string, customSort?: boolean) => TagList;
+56
View File
@@ -0,0 +1,56 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseTagList = exports.TagList = void 0;
class TagList {
constructor(all, latest) {
this.all = all;
this.latest = latest;
}
}
exports.TagList = TagList;
const parseTagList = function (data, customSort = false) {
const tags = data
.split('\n')
.map(trimmed)
.filter(Boolean);
if (!customSort) {
tags.sort(function (tagA, tagB) {
const partsA = tagA.split('.');
const partsB = tagB.split('.');
if (partsA.length === 1 || partsB.length === 1) {
return singleSorted(toNumber(partsA[0]), toNumber(partsB[0]));
}
for (let i = 0, l = Math.max(partsA.length, partsB.length); i < l; i++) {
const diff = sorted(toNumber(partsA[i]), toNumber(partsB[i]));
if (diff) {
return diff;
}
}
return 0;
});
}
const latest = customSort ? tags[0] : [...tags].reverse().find((tag) => tag.indexOf('.') >= 0);
return new TagList(tags, latest);
};
exports.parseTagList = parseTagList;
function singleSorted(a, b) {
const aIsNum = isNaN(a);
const bIsNum = isNaN(b);
if (aIsNum !== bIsNum) {
return aIsNum ? 1 : -1;
}
return aIsNum ? sorted(a, b) : 0;
}
function sorted(a, b) {
return a === b ? 0 : a > b ? 1 : -1;
}
function trimmed(input) {
return input.trim();
}
function toNumber(input) {
if (typeof input === 'string') {
return parseInt(input.replace(/^\D+/g, ''), 10) || 0;
}
return 0;
}
//# sourceMappingURL=TagList.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"TagList.js","sourceRoot":"","sources":["TagList.ts"],"names":[],"mappings":";;;AAEA,MAAa,OAAO;IACjB,YACmB,GAAa,EACb,MAA0B;QAD1B,QAAG,GAAH,GAAG,CAAU;QACb,WAAM,GAAN,MAAM,CAAoB;IAE7C,CAAC;CACH;AAND,0BAMC;AAEM,MAAM,YAAY,GAAG,UAAU,IAAY,EAAE,UAAU,GAAG,KAAK;IACnE,MAAM,IAAI,GAAG,IAAI;SACb,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,OAAO,CAAC;SACZ,MAAM,CAAC,OAAO,CAAC,CAAC;IAEpB,IAAI,CAAC,UAAU,EAAE;QACd,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,IAAI;YAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAE/B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC7C,OAA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