simple git installed
This commit is contained in:
1 parent
e2a8f4be8e
commit
f2e744cb7e
276 files changed
+11110
-1
No files matched your search
+46
@@ -0,0 +1,46 @@
|
||||
const Git = require('./git');
|
||||
const {GitConstructError} = require('./lib/api');
|
||||
const {createInstanceConfig, folderExists} = require('./lib/utils');
|
||||
|
||||
const api = Object.create(null);
|
||||
for (let imported = require('./lib/api'), keys = Object.keys(imported), i = 0; i < keys.length; i++) {
|
||||
const name = keys[i];
|
||||
if (/^[A-Z]/.test(name)) {
|
||||
api[name] = imported[name];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the necessary properties to the supplied object to enable it for use as
|
||||
* the default export of a module.
|
||||
*
|
||||
* Eg: `module.exports = esModuleFactory({ something () {} })`
|
||||
*/
|
||||
module.exports.esModuleFactory = function esModuleFactory (defaultExport) {
|
||||
return Object.defineProperties(defaultExport, {
|
||||
__esModule: {value: true},
|
||||
default: {value: defaultExport},
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.gitExportFactory = function gitExportFactory (factory, extra) {
|
||||
return Object.assign(function () {
|
||||
return factory.apply(null, arguments);
|
||||
},
|
||||
api,
|
||||
extra || {},
|
||||
);
|
||||
};
|
||||
|
||||
module.exports.gitInstanceFactory = function gitInstanceFactory (baseDir, options) {
|
||||
const config = createInstanceConfig(
|
||||
baseDir && (typeof baseDir === 'string' ? {baseDir} : baseDir),
|
||||
options
|
||||
);
|
||||
|
||||
if (!folderExists(config.baseDir)) {
|
||||
throw new GitConstructError(config, `Cannot use simple-git on a directory that does not exist`);
|
||||
}
|
||||
|
||||
return new Git(config);
|
||||
};
|
||||
+985
@@ -0,0 +1,985 @@
|
||||
const {GitExecutor} = require('./lib/runners/git-executor');
|
||||
|
||||
const {Scheduler} = require('./lib/runners/scheduler');
|
||||
const {GitLogger} = require('./lib/git-logger');
|
||||
const {adhocExecTask, configurationErrorTask} = require('./lib/tasks/task');
|
||||
const {NOOP, appendTaskOptions, asArray, filterArray, filterPrimitives, filterString, filterStringOrStringArray, filterType, folderExists, getTrailingOptions, trailingFunctionArgument, trailingOptionsArgument} = require('./lib/utils');
|
||||
const {applyPatchTask} = require('./lib/tasks/apply-patch')
|
||||
const {branchTask, branchLocalTask, deleteBranchesTask, deleteBranchTask} = require('./lib/tasks/branch');
|
||||
const {taskCallback} = require('./lib/task-callback');
|
||||
const {checkIsRepoTask} = require('./lib/tasks/check-is-repo');
|
||||
const {cloneTask, cloneMirrorTask} = require('./lib/tasks/clone');
|
||||
const {addConfigTask, listConfigTask} = require('./lib/tasks/config');
|
||||
const {cleanWithOptionsTask, isCleanOptionsArray} = require('./lib/tasks/clean');
|
||||
const {commitTask} = require('./lib/tasks/commit');
|
||||
const {diffSummaryTask} = require('./lib/tasks/diff');
|
||||
const {fetchTask} = require('./lib/tasks/fetch');
|
||||
const {hashObjectTask} = require('./lib/tasks/hash-object');
|
||||
const {initTask} = require('./lib/tasks/init');
|
||||
const {logTask, parseLogOptions} = require('./lib/tasks/log');
|
||||
const {mergeTask} = require('./lib/tasks/merge');
|
||||
const {moveTask} = require("./lib/tasks/move");
|
||||
const {pullTask} = require('./lib/tasks/pull');
|
||||
const {pushTagsTask, pushTask} = require('./lib/tasks/push');
|
||||
const {addRemoteTask, getRemotesTask, listRemotesTask, remoteTask, removeRemoteTask} = require('./lib/tasks/remote');
|
||||
const {getResetMode, resetTask} = require('./lib/tasks/reset');
|
||||
const {stashListTask} = require('./lib/tasks/stash-list');
|
||||
const {statusTask} = require('./lib/tasks/status');
|
||||
const {addSubModuleTask, initSubModuleTask, subModuleTask, updateSubModuleTask} = require('./lib/tasks/sub-module');
|
||||
const {addAnnotatedTagTask, addTagTask, tagListTask} = require('./lib/tasks/tag');
|
||||
const {straightThroughStringTask} = require('./lib/tasks/task');
|
||||
const {parseCheckIgnore} = require('./lib/responses/CheckIgnore');
|
||||
|
||||
const ChainedExecutor = Symbol('ChainedExecutor');
|
||||
|
||||
/**
|
||||
* Git handling for node. All public functions can be chained and all `then` handlers are optional.
|
||||
*
|
||||
* @param {SimpleGitOptions} options Configuration settings for this instance
|
||||
*
|
||||
* @constructor
|
||||
*/
|
||||
function Git (options) {
|
||||
this._executor = new GitExecutor(
|
||||
options.binary, options.baseDir,
|
||||
new Scheduler(options.maxConcurrentProcesses)
|
||||
);
|
||||
this._logger = new GitLogger();
|
||||
}
|
||||
|
||||
/**
|
||||
* The executor that runs each of the added commands
|
||||
* @type {GitExecutor}
|
||||
* @private
|
||||
*/
|
||||
Git.prototype._executor = null;
|
||||
|
||||
/**
|
||||
* Logging utility for printing out info or error messages to the user
|
||||
* @type {GitLogger}
|
||||
* @private
|
||||
*/
|
||||
Git.prototype._logger = null;
|
||||
|
||||
/**
|
||||
* Sets the path to a custom git binary, should either be `git` when there is an installation of git available on
|
||||
* the system path, or a fully qualified path to the executable.
|
||||
*
|
||||
* @param {string} command
|
||||
* @returns {Git}
|
||||
*/
|
||||
Git.prototype.customBinary = function (command) {
|
||||
this._executor.binary = command;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets an environment variable for the spawned child process, either supply both a name and value as strings or
|
||||
* a single object to entirely replace the current environment variables.
|
||||
*
|
||||
* @param {string|Object} name
|
||||
* @param {string} [value]
|
||||
* @returns {Git}
|
||||
*/
|
||||
Git.prototype.env = function (name, value) {
|
||||
if (arguments.length === 1 && typeof name === 'object') {
|
||||
this._executor.env = name;
|
||||
} else {
|
||||
(this._executor.env = this._executor.env || {})[name] = value;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the working directory of the subsequent commands.
|
||||
*/
|
||||
Git.prototype.cwd = function (workingDirectory) {
|
||||
const task = (typeof workingDirectory !== 'string')
|
||||
? configurationErrorTask('Git.cwd: workingDirectory must be supplied as a string')
|
||||
: adhocExecTask(() => {
|
||||
if (!folderExists(workingDirectory)) {
|
||||
throw new Error(`Git.cwd: cannot change to non-directory "${ workingDirectory }"`);
|
||||
}
|
||||
|
||||
return (this._executor.cwd = workingDirectory);
|
||||
});
|
||||
|
||||
return this._runTask(task, trailingFunctionArgument(arguments) || NOOP);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets a handler function to be called whenever a new child process is created, the handler function will be called
|
||||
* with the name of the command being run and the stdout & stderr streams used by the ChildProcess.
|
||||
*
|
||||
* @example
|
||||
* require('simple-git')
|
||||
* .outputHandler(function (command, stdout, stderr) {
|
||||
* stdout.pipe(process.stdout);
|
||||
* })
|
||||
* .checkout('https://github.com/user/repo.git');
|
||||
*
|
||||
* @see https://nodejs.org/api/child_process.html#child_process_class_childprocess
|
||||
* @see https://nodejs.org/api/stream.html#stream_class_stream_readable
|
||||
* @param {Function} outputHandler
|
||||
* @returns {Git}
|
||||
*/
|
||||
Git.prototype.outputHandler = function (outputHandler) {
|
||||
this._executor.outputHandler = outputHandler;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize a git repo
|
||||
*
|
||||
* @param {Boolean} [bare=false]
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.init = function (bare, then) {
|
||||
return this._runTask(
|
||||
initTask(bare === true, this._executor.cwd, getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check the status of the local repo
|
||||
*/
|
||||
Git.prototype.status = function () {
|
||||
return this._runTask(
|
||||
statusTask(getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* List the stash(s) of the local repo
|
||||
*/
|
||||
Git.prototype.stashList = function (options) {
|
||||
return this._runTask(
|
||||
stashListTask(
|
||||
trailingOptionsArgument(arguments) || {},
|
||||
filterArray(options) && options || []
|
||||
),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Stash the local repo
|
||||
*
|
||||
* @param {Object|Array} [options]
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.stash = function (options, then) {
|
||||
return this._runTask(
|
||||
straightThroughStringTask(['stash', ...getTrailingOptions(arguments)]),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
function createCloneTask (api, task, repoPath, localPath) {
|
||||
if (typeof repoPath !== 'string') {
|
||||
return configurationErrorTask(`git.${ api }() requires a string 'repoPath'`);
|
||||
}
|
||||
|
||||
return task(repoPath, filterType(localPath, filterString), getTrailingOptions(arguments));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clone a git repo
|
||||
*/
|
||||
Git.prototype.clone = function () {
|
||||
return this._runTask(
|
||||
createCloneTask('clone', cloneTask, ...arguments),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Mirror a git repo
|
||||
*/
|
||||
Git.prototype.mirror = function () {
|
||||
return this._runTask(
|
||||
createCloneTask('mirror', cloneMirrorTask, ...arguments),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Moves one or more files to a new destination.
|
||||
*
|
||||
* @see https://git-scm.com/docs/git-mv
|
||||
*
|
||||
* @param {string|string[]} from
|
||||
* @param {string} to
|
||||
*/
|
||||
Git.prototype.mv = function (from, to) {
|
||||
return this._runTask(moveTask(from, to), trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Internally uses pull and tags to get the list of tags then checks out the latest tag.
|
||||
*
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.checkoutLatestTag = function (then) {
|
||||
var git = this;
|
||||
return this.pull(function () {
|
||||
git.tags(function (err, tags) {
|
||||
git.checkout(tags.latest, then);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds one or more files to source control
|
||||
*/
|
||||
Git.prototype.add = function (files) {
|
||||
return this._run(
|
||||
['add'].concat(files),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Commits changes in the current working directory - when specific file paths are supplied, only changes on those
|
||||
* files will be committed.
|
||||
*
|
||||
* @param {string|string[]} message
|
||||
* @param {string|string[]} [files]
|
||||
* @param {Object} [options]
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.commit = function (message, files, options, then) {
|
||||
const next = trailingFunctionArgument(arguments);
|
||||
const messages = [];
|
||||
|
||||
if (filterStringOrStringArray(message)) {
|
||||
messages.push(...asArray(message));
|
||||
}
|
||||
else {
|
||||
console.warn('simple-git deprecation notice: git.commit: requires the commit message to be supplied as a string/string[], this will be an error in version 3');
|
||||
}
|
||||
|
||||
return this._runTask(
|
||||
commitTask(
|
||||
messages,
|
||||
asArray(filterType(files, filterStringOrStringArray, [])),
|
||||
[...filterType(options, filterArray, []), ...getTrailingOptions(arguments, 0, true)]
|
||||
),
|
||||
next
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Pull the updated contents of the current repo
|
||||
*/
|
||||
Git.prototype.pull = function (remote, branch, options, then) {
|
||||
return this._runTask(
|
||||
pullTask(filterType(remote, filterString), filterType(branch, filterString), getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetch the updated contents of the current repo.
|
||||
*
|
||||
* @example
|
||||
* .fetch('upstream', 'master') // fetches from master on remote named upstream
|
||||
* .fetch(function () {}) // runs fetch against default remote and branch and calls function
|
||||
*
|
||||
* @param {string} [remote]
|
||||
* @param {string} [branch]
|
||||
*/
|
||||
Git.prototype.fetch = function (remote, branch) {
|
||||
return this._runTask(
|
||||
fetchTask(filterType(remote, filterString), filterType(branch, filterString), getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Disables/enables the use of the console for printing warnings and errors, by default messages are not shown in
|
||||
* a production environment.
|
||||
*
|
||||
* @param {boolean} silence
|
||||
* @returns {Git}
|
||||
*/
|
||||
Git.prototype.silent = function (silence) {
|
||||
this._logger.silent(!!silence);
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* List all tags. When using git 2.7.0 or above, include an options object with `"--sort": "property-name"` to
|
||||
* sort the tags by that property instead of using the default semantic versioning sort.
|
||||
*
|
||||
* Note, supplying this option when it is not supported by your Git version will cause the operation to fail.
|
||||
*
|
||||
* @param {Object} [options]
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.tags = function (options, then) {
|
||||
return this._runTask(
|
||||
tagListTask(getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Rebases the current working copy. Options can be supplied either as an array of string parameters
|
||||
* to be sent to the `git rebase` command, or a standard options object.
|
||||
*/
|
||||
Git.prototype.rebase = function () {
|
||||
return this._run(
|
||||
['rebase'].concat(getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Reset a repo
|
||||
*
|
||||
* @param {string|string[]} [mode=soft] Either an array of arguments supported by the 'git reset' command, or the
|
||||
* string value 'soft' or 'hard' to set the reset mode.
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.reset = function (mode, then) {
|
||||
return this._runTask(
|
||||
resetTask(getResetMode(mode), getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Revert one or more commits in the local working copy
|
||||
*/
|
||||
Git.prototype.revert = function (commit) {
|
||||
const next = trailingFunctionArgument(arguments);
|
||||
|
||||
if (typeof commit !== 'string') {
|
||||
return this._runTask(
|
||||
configurationErrorTask('Commit must be a string'),
|
||||
next,
|
||||
);
|
||||
}
|
||||
|
||||
return this._run([
|
||||
'revert',
|
||||
...getTrailingOptions(arguments, 0, true),
|
||||
commit
|
||||
], next);
|
||||
};
|
||||
|
||||
/**
|
||||
* Add a lightweight tag to the head of the current branch
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.addTag = function (name, then) {
|
||||
const task = (typeof name === 'string')
|
||||
? addTagTask(name)
|
||||
: configurationErrorTask('Git.addTag requires a tag name');
|
||||
|
||||
return this._runTask(task, trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Add an annotated tag to the head of the current branch
|
||||
*
|
||||
* @param {string} tagName
|
||||
* @param {string} tagMessage
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.addAnnotatedTag = function (tagName, tagMessage, then) {
|
||||
return this._runTask(
|
||||
addAnnotatedTagTask(tagName, tagMessage),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check out a tag or revision, any number of additional arguments can be passed to the `git checkout` command
|
||||
* by supplying either a string or array of strings as the `what` parameter.
|
||||
*
|
||||
* @param {string|string[]} what One or more commands to pass to `git checkout`
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.checkout = function (what, then) {
|
||||
const commands = ['checkout', ...getTrailingOptions(arguments, true)];
|
||||
return this._runTask(
|
||||
straightThroughStringTask(commands),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check out a remote branch
|
||||
*
|
||||
* @param {string} branchName name of branch
|
||||
* @param {string} startPoint (e.g origin/development)
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.checkoutBranch = function (branchName, startPoint, then) {
|
||||
return this.checkout(['-b', branchName, startPoint], trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Check out a local branch
|
||||
*/
|
||||
Git.prototype.checkoutLocalBranch = function (branchName, then) {
|
||||
return this.checkout(['-b', branchName], trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete a local branch
|
||||
*/
|
||||
Git.prototype.deleteLocalBranch = function (branchName, forceDelete, then) {
|
||||
return this._runTask(
|
||||
deleteBranchTask(branchName, typeof forceDelete === "boolean" ? forceDelete : false),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Delete one or more local branches
|
||||
*/
|
||||
Git.prototype.deleteLocalBranches = function (branchNames, forceDelete, then) {
|
||||
return this._runTask(
|
||||
deleteBranchesTask(branchNames, typeof forceDelete === "boolean" ? forceDelete : false),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* List all branches
|
||||
*
|
||||
* @param {Object | string[]} [options]
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.branch = function (options, then) {
|
||||
return this._runTask(
|
||||
branchTask(getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Return list of local branches
|
||||
*
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.branchLocal = function (then) {
|
||||
return this._runTask(
|
||||
branchLocalTask(),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Add config to local git instance
|
||||
*
|
||||
* @param {string} key configuration key (e.g user.name)
|
||||
* @param {string} value for the given key (e.g your name)
|
||||
* @param {boolean} [append=false] optionally append the key/value pair (equivalent of passing `--add` option).
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.addConfig = function (key, value, append, then) {
|
||||
return this._runTask(
|
||||
addConfigTask(key, value, typeof append === "boolean" ? append : false),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
Git.prototype.listConfig = function () {
|
||||
return this._runTask(listConfigTask(), trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Executes any command against the git binary.
|
||||
*/
|
||||
Git.prototype.raw = function (commands) {
|
||||
const createRestCommands = !Array.isArray(commands);
|
||||
const command = [].slice.call(createRestCommands ? arguments : commands, 0);
|
||||
|
||||
for (let i = 0; i < command.length && createRestCommands; i++) {
|
||||
if (!filterPrimitives(command[i])) {
|
||||
command.splice(i, command.length - i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
command.push(
|
||||
...getTrailingOptions(arguments, 0, true),
|
||||
);
|
||||
|
||||
var next = trailingFunctionArgument(arguments);
|
||||
|
||||
if (!command.length) {
|
||||
return this._runTask(
|
||||
configurationErrorTask('Raw: must supply one or more command to execute'),
|
||||
next,
|
||||
);
|
||||
}
|
||||
|
||||
return this._run(command, next);
|
||||
};
|
||||
|
||||
Git.prototype.submoduleAdd = function (repo, path, then) {
|
||||
return this._runTask(
|
||||
addSubModuleTask(repo, path),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
Git.prototype.submoduleUpdate = function (args, then) {
|
||||
return this._runTask(
|
||||
updateSubModuleTask(getTrailingOptions(arguments, true)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
Git.prototype.submoduleInit = function (args, then) {
|
||||
return this._runTask(
|
||||
initSubModuleTask(getTrailingOptions(arguments, true)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
Git.prototype.subModule = function (options, then) {
|
||||
return this._runTask(
|
||||
subModuleTask(getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
Git.prototype.listRemote = function () {
|
||||
return this._runTask(
|
||||
listRemotesTask(getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds a remote to the list of remotes.
|
||||
*/
|
||||
Git.prototype.addRemote = function (remoteName, remoteRepo, then) {
|
||||
return this._runTask(
|
||||
addRemoteTask(remoteName, remoteRepo, getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes an entry by name from the list of remotes.
|
||||
*/
|
||||
Git.prototype.removeRemote = function (remoteName, then) {
|
||||
return this._runTask(
|
||||
removeRemoteTask(remoteName),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets the currently available remotes, setting the optional verbose argument to true includes additional
|
||||
* detail on the remotes themselves.
|
||||
*/
|
||||
Git.prototype.getRemotes = function (verbose, then) {
|
||||
return this._runTask(
|
||||
getRemotesTask(verbose === true),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Compute object ID from a file
|
||||
*/
|
||||
Git.prototype.hashObject = function (path, write) {
|
||||
return this._runTask(
|
||||
hashObjectTask(path, write === true),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Call any `git remote` function with arguments passed as an array of strings.
|
||||
*
|
||||
* @param {string[]} options
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.remote = function (options, then) {
|
||||
return this._runTask(
|
||||
remoteTask(getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Merges from one branch to another, equivalent to running `git merge ${from} $[to}`, the `options` argument can
|
||||
* either be an array of additional parameters to pass to the command or null / omitted to be ignored.
|
||||
*
|
||||
* @param {string} from
|
||||
* @param {string} to
|
||||
*/
|
||||
Git.prototype.mergeFromTo = function (from, to) {
|
||||
if (!(filterString(from) && filterString(to))) {
|
||||
return this._runTask(configurationErrorTask(
|
||||
`Git.mergeFromTo requires that the 'from' and 'to' arguments are supplied as strings`
|
||||
));
|
||||
}
|
||||
|
||||
return this._runTask(
|
||||
mergeTask([from, to, ...getTrailingOptions(arguments)]),
|
||||
trailingFunctionArgument(arguments, false),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Runs a merge, `options` can be either an array of arguments
|
||||
* supported by the [`git merge`](https://git-scm.com/docs/git-merge)
|
||||
* or an options object.
|
||||
*
|
||||
* Conflicts during the merge result in an error response,
|
||||
* the response type whether it was an error or success will be a MergeSummary instance.
|
||||
* When successful, the MergeSummary has all detail from a the PullSummary
|
||||
*
|
||||
* @param {Object | string[]} [options]
|
||||
* @param {Function} [then]
|
||||
* @returns {*}
|
||||
*
|
||||
* @see ./responses/MergeSummary.js
|
||||
* @see ./responses/PullSummary.js
|
||||
*/
|
||||
Git.prototype.merge = function () {
|
||||
return this._runTask(
|
||||
mergeTask(getTrailingOptions(arguments)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Call any `git tag` function with arguments passed as an array of strings.
|
||||
*
|
||||
* @param {string[]} options
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.tag = function (options, then) {
|
||||
const command = getTrailingOptions(arguments);
|
||||
|
||||
if (command[0] !== 'tag') {
|
||||
command.unshift('tag');
|
||||
}
|
||||
|
||||
return this._run(command, trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates repository server info
|
||||
*
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.updateServerInfo = function (then) {
|
||||
return this._run(["update-server-info"], trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Pushes the current committed changes to a remote, optionally specify the names of the remote and branch to use
|
||||
* when pushing. Supply multiple options as an array of strings in the first argument - see examples below.
|
||||
*/
|
||||
Git.prototype.push = function (remote, branch, then) {
|
||||
const task = pushTask(
|
||||
{remote: filterType(remote, filterString), branch: filterType(branch, filterString)},
|
||||
getTrailingOptions(arguments),
|
||||
);
|
||||
return this._runTask(task, trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Pushes the current tag changes to a remote which can be either a URL or named remote. When not specified uses the
|
||||
* default configured remote spec.
|
||||
*
|
||||
* @param {string} [remote]
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.pushTags = function (remote, then) {
|
||||
const task = pushTagsTask({remote: filterType(remote, filterString)}, getTrailingOptions(arguments));
|
||||
|
||||
return this._runTask(task, trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the named files from source control.
|
||||
*
|
||||
* @param {string|string[]} files
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.rm = function (files, then) {
|
||||
return this._rm(files, '-f', then);
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the named files from source control but keeps them on disk rather than deleting them entirely. To
|
||||
* completely remove the files, use `rm`.
|
||||
*
|
||||
* @param {string|string[]} files
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.rmKeepLocal = function (files, then) {
|
||||
return this._rm(files, '--cached', then);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a list of objects in a tree based on commit hash. Passing in an object hash returns the object's content,
|
||||
* size, and type.
|
||||
*
|
||||
* Passing "-p" will instruct cat-file to determine the object type, and display its formatted contents.
|
||||
*
|
||||
* @param {string[]} [options]
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.catFile = function (options, then) {
|
||||
return this._catFile('utf-8', arguments);
|
||||
};
|
||||
|
||||
/**
|
||||
* Equivalent to `catFile` but will return the native `Buffer` of content from the git command's stdout.
|
||||
*
|
||||
* @param {string[]} options
|
||||
* @param then
|
||||
*/
|
||||
Git.prototype.binaryCatFile = function (options, then) {
|
||||
return this._catFile('buffer', arguments);
|
||||
};
|
||||
|
||||
Git.prototype._catFile = function (format, args) {
|
||||
var handler = trailingFunctionArgument(args);
|
||||
var command = ['cat-file'];
|
||||
var options = args[0];
|
||||
|
||||
if (typeof options === 'string') {
|
||||
return this._runTask(
|
||||
configurationErrorTask('Git#catFile: options must be supplied as an array of strings'),
|
||||
handler,
|
||||
);
|
||||
}
|
||||
|
||||
if (Array.isArray(options)) {
|
||||
command.push.apply(command, options);
|
||||
}
|
||||
|
||||
return this._run(command, handler, {
|
||||
format: format
|
||||
});
|
||||
};
|
||||
|
||||
Git.prototype.diff = function (options, then) {
|
||||
const command = ['diff', ...getTrailingOptions(arguments)];
|
||||
|
||||
if (typeof options === 'string') {
|
||||
command.splice(1, 0, options);
|
||||
this._logger.warn('Git#diff: supplying options as a single string is now deprecated, switch to an array of strings');
|
||||
}
|
||||
|
||||
return this._runTask(
|
||||
straightThroughStringTask(command),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
Git.prototype.diffSummary = function () {
|
||||
return this._runTask(
|
||||
diffSummaryTask(getTrailingOptions(arguments, 1)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
Git.prototype.applyPatch = function(patches) {
|
||||
const task = !filterStringOrStringArray(patches)
|
||||
? configurationErrorTask(`git.applyPatch requires one or more string patches as the first argument`)
|
||||
: applyPatchTask(asArray(patches), getTrailingOptions([].slice.call(arguments, 1)));
|
||||
|
||||
return this._runTask(
|
||||
task,
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
}
|
||||
|
||||
Git.prototype.revparse = function () {
|
||||
const commands = ['rev-parse', ...getTrailingOptions(arguments, true)];
|
||||
return this._runTask(
|
||||
straightThroughStringTask(commands, true),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Show various types of objects, for example the file at a certain commit
|
||||
*
|
||||
* @param {string[]} [options]
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.show = function (options, then) {
|
||||
return this._runTask(
|
||||
straightThroughStringTask(['show', ...getTrailingOptions(arguments, 1)]),
|
||||
trailingFunctionArgument(arguments)
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
*/
|
||||
Git.prototype.clean = function (mode, options, then) {
|
||||
const usingCleanOptionsArray = isCleanOptionsArray(mode);
|
||||
const cleanMode = usingCleanOptionsArray && mode.join('') || filterType(mode, filterString) || '';
|
||||
const customArgs = getTrailingOptions([].slice.call(arguments, usingCleanOptionsArray ? 1 : 0));
|
||||
|
||||
return this._runTask(
|
||||
cleanWithOptionsTask(cleanMode, customArgs),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Call a simple function at the next step in the chain.
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.exec = function (then) {
|
||||
const task = {
|
||||
commands: [],
|
||||
format: 'utf-8',
|
||||
parser () {
|
||||
if (typeof then === 'function') {
|
||||
then();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return this._runTask(task);
|
||||
};
|
||||
|
||||
/**
|
||||
* Show commit logs from `HEAD` to the first commit.
|
||||
* If provided between `options.from` and `options.to` tags or branch.
|
||||
*
|
||||
* Additionally you can provide options.file, which is the path to a file in your repository. Then only this file will be considered.
|
||||
*
|
||||
* To use a custom splitter in the log format, set `options.splitter` to be the string the log should be split on.
|
||||
*
|
||||
* Options can also be supplied as a standard options object for adding custom properties supported by the git log command.
|
||||
* For any other set of options, supply options as an array of strings to be appended to the git log command.
|
||||
*/
|
||||
Git.prototype.log = function (options) {
|
||||
const next = trailingFunctionArgument(arguments);
|
||||
|
||||
if (filterString(arguments[0]) && filterString(arguments[1])) {
|
||||
return this._runTask(
|
||||
configurationErrorTask(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`),
|
||||
next
|
||||
);
|
||||
}
|
||||
|
||||
const parsedOptions = parseLogOptions(
|
||||
trailingOptionsArgument(arguments) || {},
|
||||
filterArray(options) && options || []
|
||||
);
|
||||
|
||||
return this._runTask(
|
||||
logTask(parsedOptions.splitter, parsedOptions.fields, parsedOptions.commands),
|
||||
next,
|
||||
)
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the queue of pending commands and returns the wrapper instance for chaining.
|
||||
*
|
||||
* @returns {Git}
|
||||
*/
|
||||
Git.prototype.clearQueue = function () {
|
||||
// TODO:
|
||||
// this._executor.clear();
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if a pathname or pathnames are excluded by .gitignore
|
||||
*
|
||||
* @param {string|string[]} pathnames
|
||||
* @param {Function} [then]
|
||||
*/
|
||||
Git.prototype.checkIgnore = function (pathnames, then) {
|
||||
return this._run(
|
||||
["check-ignore", ...asArray((filterType(pathnames, filterStringOrStringArray, [])))],
|
||||
trailingFunctionArgument(arguments),
|
||||
{
|
||||
parser: parseCheckIgnore
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
Git.prototype.checkIsRepo = function (checkType, then) {
|
||||
return this._runTask(
|
||||
checkIsRepoTask(filterType(checkType, filterString)),
|
||||
trailingFunctionArgument(arguments),
|
||||
);
|
||||
};
|
||||
|
||||
Git.prototype._rm = function (_files, options, then) {
|
||||
var files = [].concat(_files);
|
||||
var args = ['rm', options];
|
||||
args.push.apply(args, files);
|
||||
|
||||
return this._run(args, trailingFunctionArgument(arguments));
|
||||
};
|
||||
|
||||
/**
|
||||
* Schedules the supplied command to be run, the command should not include the name of the git binary and should
|
||||
* be an array of strings passed as the arguments to the git binary.
|
||||
*
|
||||
* @param {string[]} command
|
||||
* @param {Function} then
|
||||
* @param {Object} [opt]
|
||||
* @param {boolean} [opt.concatStdErr=false] Optionally concatenate stderr output into the stdout
|
||||
* @param {boolean} [opt.format="utf-8"] The format to use when reading the content of stdout
|
||||
* @param {Function} [opt.onError] Optional error handler for this command - can be used to allow non-clean exits
|
||||
* without killing the remaining stack of commands
|
||||
* @param {Function} [opt.parser] Optional parser function
|
||||
* @param {number} [opt.onError.exitCode]
|
||||
* @param {string} [opt.onError.stdErr]
|
||||
*
|
||||
* @returns {Git}
|
||||
*/
|
||||
Git.prototype._run = function (command, then, opt) {
|
||||
|
||||
const task = Object.assign({
|
||||
concatStdErr: false,
|
||||
onError: undefined,
|
||||
format: 'utf-8',
|
||||
parser (data) {
|
||||
return data;
|
||||
}
|
||||
}, opt || {}, {
|
||||
commands: command,
|
||||
});
|
||||
|
||||
return this._runTask(task, then);
|
||||
};
|
||||
|
||||
Git.prototype._runTask = function (task, then) {
|
||||
const executor = this[ChainedExecutor] || this._executor.chain();
|
||||
const promise = executor.push(task);
|
||||
|
||||
taskCallback(
|
||||
task,
|
||||
promise,
|
||||
then);
|
||||
|
||||
return Object.create(this, {
|
||||
then: {value: promise.then.bind(promise)},
|
||||
catch: {value: promise.catch.bind(promise)},
|
||||
[ChainedExecutor]: {value: executor},
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = Git;
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
|
||||
const {gitP} = require('./lib/runners/promise-wrapped');
|
||||
const {esModuleFactory, gitInstanceFactory, gitExportFactory} = require('./git-factory');
|
||||
|
||||
module.exports = esModuleFactory(
|
||||
gitExportFactory(gitInstanceFactory, {gitP})
|
||||
);
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
export { CleanOptions } from './tasks/clean';
|
||||
export { CheckRepoActions } from './tasks/check-is-repo';
|
||||
export { ResetMode } from './tasks/reset';
|
||||
export { GitConstructError } from './errors/git-construct-error';
|
||||
export { GitError } from './errors/git-error';
|
||||
export { GitResponseError } from './errors/git-response-error';
|
||||
export { TaskConfigurationError } from './errors/task-configuration-error';
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TaskConfigurationError = exports.GitResponseError = exports.GitError = exports.GitConstructError = exports.ResetMode = exports.CheckRepoActions = exports.CleanOptions = void 0;
|
||||
var clean_1 = require("./tasks/clean");
|
||||
Object.defineProperty(exports, "CleanOptions", { enumerable: true, get: function () { return clean_1.CleanOptions; } });
|
||||
var check_is_repo_1 = require("./tasks/check-is-repo");
|
||||
Object.defineProperty(exports, "CheckRepoActions", { enumerable: true, get: function () { return check_is_repo_1.CheckRepoActions; } });
|
||||
var reset_1 = require("./tasks/reset");
|
||||
Object.defineProperty(exports, "ResetMode", { enumerable: true, get: function () { return reset_1.ResetMode; } });
|
||||
var git_construct_error_1 = require("./errors/git-construct-error");
|
||||
Object.defineProperty(exports, "GitConstructError", { enumerable: true, get: function () { return git_construct_error_1.GitConstructError; } });
|
||||
var git_error_1 = require("./errors/git-error");
|
||||
Object.defineProperty(exports, "GitError", { enumerable: true, get: function () { return git_error_1.GitError; } });
|
||||
var git_response_error_1 = require("./errors/git-response-error");
|
||||
Object.defineProperty(exports, "GitResponseError", { enumerable: true, get: function () { return git_response_error_1.GitResponseError; } });
|
||||
var task_configuration_error_1 = require("./errors/task-configuration-error");
|
||||
Object.defineProperty(exports, "TaskConfigurationError", { enumerable: true, get: function () { return task_configuration_error_1.TaskConfigurationError; } });
|
||||
//# sourceMappingURL=api.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"api.js","sourceRoot":"","sources":["api.ts"],"names":[],"mappings":";;;AAAA,uCAA6C;AAApC,qGAAA,YAAY,OAAA;AACrB,uDAAyD;AAAhD,iHAAA,gBAAgB,OAAA;AACzB,uCAA0C;AAAjC,kGAAA,SAAS,OAAA;AAClB,oEAAiE;AAAxD,wHAAA,iBAAiB,OAAA;AAC1B,gDAA8C;AAArC,qGAAA,QAAQ,OAAA;AACjB,kEAA+D;AAAtD,sHAAA,gBAAgB,OAAA;AACzB,8EAA2E;AAAlE,kIAAA,sBAAsB,OAAA"}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
import { GitError } from './git-error';
|
||||
import { SimpleGitOptions } from '../types';
|
||||
/**
|
||||
* The `GitConstructError` is thrown when an error occurs in the constructor
|
||||
* of the `simple-git` instance itself. Most commonly as a result of using
|
||||
* a `baseDir` option that points to a folder that either does not exist,
|
||||
* or cannot be read by the user the node script is running as.
|
||||
*
|
||||
* Check the `.message` property for more detail including the properties
|
||||
* passed to the constructor.
|
||||
*/
|
||||
export declare class GitConstructError extends GitError {
|
||||
readonly config: SimpleGitOptions;
|
||||
constructor(config: SimpleGitOptions, message: string);
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GitConstructError = void 0;
|
||||
const git_error_1 = require("./git-error");
|
||||
/**
|
||||
* The `GitConstructError` is thrown when an error occurs in the constructor
|
||||
* of the `simple-git` instance itself. Most commonly as a result of using
|
||||
* a `baseDir` option that points to a folder that either does not exist,
|
||||
* or cannot be read by the user the node script is running as.
|
||||
*
|
||||
* Check the `.message` property for more detail including the properties
|
||||
* passed to the constructor.
|
||||
*/
|
||||
class GitConstructError extends git_error_1.GitError {
|
||||
constructor(config, message) {
|
||||
super(undefined, message);
|
||||
this.config = config;
|
||||
}
|
||||
}
|
||||
exports.GitConstructError = GitConstructError;
|
||||
//# sourceMappingURL=git-construct-error.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"git-construct-error.js","sourceRoot":"","sources":["git-construct-error.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAGvC;;;;;;;;GAQG;AACH,MAAa,iBAAkB,SAAQ,oBAAQ;IAE5C,YACmB,MAAwB,EACxC,OAAe;QAEf,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAHV,WAAM,GAAN,MAAM,CAAkB;IAI3C,CAAC;CAEH;AATD,8CASC"}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* The `GitError` is thrown when the underlying `git` process throws a
|
||||
* fatal exception (eg an `ENOENT` exception when attempting to use a
|
||||
* non-writable directory as the root for your repo), and acts as the
|
||||
* base class for more specific errors thrown by the parsing of the
|
||||
* git response or errors in the configuration of the task about to
|
||||
* be run.
|
||||
*
|
||||
* When an exception is thrown, pending tasks in the same instance will
|
||||
* not be executed. The recommended way to run a series of tasks that
|
||||
* can independently fail without needing to prevent future tasks from
|
||||
* running is to catch them individually:
|
||||
*
|
||||
* ```typescript
|
||||
import { gitP, SimpleGit, GitError, PullResult } from 'simple-git';
|
||||
|
||||
function catchTask (e: GitError) {
|
||||
return e.
|
||||
}
|
||||
|
||||
const git = gitP(repoWorkingDir);
|
||||
const pulled: PullResult | GitError = await git.pull().catch(catchTask);
|
||||
const pushed: string | GitError = await git.pushTags().catch(catchTask);
|
||||
```
|
||||
*/
|
||||
export declare class GitError extends Error {
|
||||
task?: import("../tasks/task").EmptyTask<void> | import("../types").StringTask<any> | import("../types").BufferTask<any> | undefined;
|
||||
constructor(task?: import("../tasks/task").EmptyTask<void> | import("../types").StringTask<any> | import("../types").BufferTask<any> | undefined, message?: string);
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GitError = void 0;
|
||||
/**
|
||||
* The `GitError` is thrown when the underlying `git` process throws a
|
||||
* fatal exception (eg an `ENOENT` exception when attempting to use a
|
||||
* non-writable directory as the root for your repo), and acts as the
|
||||
* base class for more specific errors thrown by the parsing of the
|
||||
* git response or errors in the configuration of the task about to
|
||||
* be run.
|
||||
*
|
||||
* When an exception is thrown, pending tasks in the same instance will
|
||||
* not be executed. The recommended way to run a series of tasks that
|
||||
* can independently fail without needing to prevent future tasks from
|
||||
* running is to catch them individually:
|
||||
*
|
||||
* ```typescript
|
||||
import { gitP, SimpleGit, GitError, PullResult } from 'simple-git';
|
||||
|
||||
function catchTask (e: GitError) {
|
||||
return e.
|
||||
}
|
||||
|
||||
const git = gitP(repoWorkingDir);
|
||||
const pulled: PullResult | GitError = await git.pull().catch(catchTask);
|
||||
const pushed: string | GitError = await git.pushTags().catch(catchTask);
|
||||
```
|
||||
*/
|
||||
class GitError extends Error {
|
||||
constructor(task, message) {
|
||||
super(message);
|
||||
this.task = task;
|
||||
Object.setPrototypeOf(this, new.target.prototype);
|
||||
}
|
||||
}
|
||||
exports.GitError = GitError;
|
||||
//# sourceMappingURL=git-error.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"git-error.js","sourceRoot":"","sources":["git-error.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,QAAS,SAAQ,KAAK;IAEhC,YACU,IAAyB,EAChC,OAAgB;QAEhB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHR,SAAI,GAAJ,IAAI,CAAqB;QAIhC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACrD,CAAC;CAEH;AAVD,4BAUC"}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
import { GitError } from './git-error';
|
||||
/**
|
||||
* The `GitResponseError` is the wrapper for a parsed response that is treated as
|
||||
* a fatal error, for example attempting a `merge` can leave the repo in a corrupted
|
||||
* state when there are conflicts so the task will reject rather than resolve.
|
||||
*
|
||||
* For example, catching the merge conflict exception:
|
||||
*
|
||||
* ```typescript
|
||||
import { gitP, SimpleGit, GitResponseError, MergeSummary } from 'simple-git';
|
||||
|
||||
const git = gitP(repoRoot);
|
||||
const mergeOptions: string[] = ['--no-ff', 'other-branch'];
|
||||
const mergeSummary: MergeSummary = await git.merge(mergeOptions)
|
||||
.catch((e: GitResponseError<MergeSummary>) => e.git);
|
||||
|
||||
if (mergeSummary.failed) {
|
||||
// deal with the error
|
||||
}
|
||||
```
|
||||
*/
|
||||
export declare class GitResponseError<T = any> extends GitError {
|
||||
/**
|
||||
* `.git` access the parsed response that is treated as being an error
|
||||
*/
|
||||
readonly git: T;
|
||||
constructor(
|
||||
/**
|
||||
* `.git` access the parsed response that is treated as being an error
|
||||
*/
|
||||
git: T, message?: string);
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GitResponseError = void 0;
|
||||
const git_error_1 = require("./git-error");
|
||||
/**
|
||||
* The `GitResponseError` is the wrapper for a parsed response that is treated as
|
||||
* a fatal error, for example attempting a `merge` can leave the repo in a corrupted
|
||||
* state when there are conflicts so the task will reject rather than resolve.
|
||||
*
|
||||
* For example, catching the merge conflict exception:
|
||||
*
|
||||
* ```typescript
|
||||
import { gitP, SimpleGit, GitResponseError, MergeSummary } from 'simple-git';
|
||||
|
||||
const git = gitP(repoRoot);
|
||||
const mergeOptions: string[] = ['--no-ff', 'other-branch'];
|
||||
const mergeSummary: MergeSummary = await git.merge(mergeOptions)
|
||||
.catch((e: GitResponseError<MergeSummary>) => e.git);
|
||||
|
||||
if (mergeSummary.failed) {
|
||||
// deal with the error
|
||||
}
|
||||
```
|
||||
*/
|
||||
class GitResponseError extends git_error_1.GitError {
|
||||
constructor(
|
||||
/**
|
||||
* `.git` access the parsed response that is treated as being an error
|
||||
*/
|
||||
git, message) {
|
||||
super(undefined, message || String(git));
|
||||
this.git = git;
|
||||
}
|
||||
}
|
||||
exports.GitResponseError = GitResponseError;
|
||||
//# sourceMappingURL=git-response-error.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"git-response-error.js","sourceRoot":"","sources":["git-response-error.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAEvC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,gBAA0B,SAAQ,oBAAQ;IAEpD;IACG;;OAEG;IACa,GAAM,EACtB,OAAgB;QAEhB,KAAK,CAAC,SAAS,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAHzB,QAAG,GAAH,GAAG,CAAG;IAIzB,CAAC;CAEH;AAZD,4CAYC"}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
import { GitError } from './git-error';
|
||||
/**
|
||||
* The `TaskConfigurationError` is thrown when a command was incorrectly
|
||||
* configured. An error of this kind means that no attempt was made to
|
||||
* run your command through the underlying `git` binary.
|
||||
*
|
||||
* Check the `.message` property for more detail on why your configuration
|
||||
* resulted in an error.
|
||||
*/
|
||||
export declare class TaskConfigurationError extends GitError {
|
||||
constructor(message?: string);
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TaskConfigurationError = void 0;
|
||||
const git_error_1 = require("./git-error");
|
||||
/**
|
||||
* The `TaskConfigurationError` is thrown when a command was incorrectly
|
||||
* configured. An error of this kind means that no attempt was made to
|
||||
* run your command through the underlying `git` binary.
|
||||
*
|
||||
* Check the `.message` property for more detail on why your configuration
|
||||
* resulted in an error.
|
||||
*/
|
||||
class TaskConfigurationError extends git_error_1.GitError {
|
||||
constructor(message) {
|
||||
super(undefined, message);
|
||||
}
|
||||
}
|
||||
exports.TaskConfigurationError = TaskConfigurationError;
|
||||
//# sourceMappingURL=task-configuration-error.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"task-configuration-error.js","sourceRoot":"","sources":["task-configuration-error.ts"],"names":[],"mappings":";;;AAAA,2CAAuC;AAEvC;;;;;;;GAOG;AACH,MAAa,sBAAuB,SAAQ,oBAAQ;IAEjD,YACG,OAAgB;QAEhB,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7B,CAAC;CAEH;AARD,wDAQC"}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
import { Debugger } from 'debug';
|
||||
/**
|
||||
* The shared debug logging instance
|
||||
*/
|
||||
export declare const log: Debugger;
|
||||
declare type OutputLoggingHandler = (message: string, ...args: any[]) => void;
|
||||
export interface OutputLogger extends OutputLoggingHandler {
|
||||
readonly key: string;
|
||||
readonly label: string;
|
||||
debug: OutputLoggingHandler;
|
||||
info: OutputLoggingHandler;
|
||||
step(nextStep?: string): OutputLogger;
|
||||
child(name: string): OutputLogger;
|
||||
sibling(name: string): OutputLogger;
|
||||
destroy(): void;
|
||||
}
|
||||
export declare function createLogger(label: string, verbose?: string | Debugger, initialStep?: string, infoDebugger?: Debugger): OutputLogger;
|
||||
/**
|
||||
* The `GitLogger` is used by the main `SimpleGit` runner to handle logging
|
||||
* any warnings or errors.
|
||||
*/
|
||||
export declare class GitLogger {
|
||||
private _out;
|
||||
error: OutputLoggingHandler;
|
||||
warn: OutputLoggingHandler;
|
||||
constructor(_out?: Debugger);
|
||||
silent(silence?: boolean): void;
|
||||
}
|
||||
export {};
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GitLogger = exports.createLogger = exports.log = void 0;
|
||||
const debug_1 = require("debug");
|
||||
const utils_1 = require("./utils");
|
||||
debug_1.default.formatters.L = (value) => String(utils_1.filterHasLength(value) ? value.length : '-');
|
||||
debug_1.default.formatters.B = (value) => {
|
||||
if (Buffer.isBuffer(value)) {
|
||||
return value.toString('utf8');
|
||||
}
|
||||
return utils_1.objectToString(value);
|
||||
};
|
||||
/**
|
||||
* The shared debug logging instance
|
||||
*/
|
||||
exports.log = debug_1.default('simple-git');
|
||||
function prefixedLogger(to, prefix, forward) {
|
||||
if (!prefix || !String(prefix).replace(/\s*/, '')) {
|
||||
return !forward ? to : (message, ...args) => {
|
||||
to(message, ...args);
|
||||
forward(message, ...args);
|
||||
};
|
||||
}
|
||||
return (message, ...args) => {
|
||||
to(`%s ${message}`, prefix, ...args);
|
||||
if (forward) {
|
||||
forward(message, ...args);
|
||||
}
|
||||
};
|
||||
}
|
||||
function childLoggerName(name, childDebugger, { namespace: parentNamespace }) {
|
||||
if (typeof name === 'string') {
|
||||
return name;
|
||||
}
|
||||
const childNamespace = childDebugger && childDebugger.namespace || '';
|
||||
if (childNamespace.startsWith(parentNamespace)) {
|
||||
return childNamespace.substr(parentNamespace.length + 1);
|
||||
}
|
||||
return childNamespace || parentNamespace;
|
||||
}
|
||||
function createLogger(label, verbose, initialStep, infoDebugger = exports.log) {
|
||||
const labelPrefix = label && `[${label}]` || '';
|
||||
const spawned = [];
|
||||
const debugDebugger = (typeof verbose === 'string') ? infoDebugger.extend(verbose) : verbose;
|
||||
const key = childLoggerName(utils_1.filterType(verbose, utils_1.filterString), debugDebugger, infoDebugger);
|
||||
return step(initialStep);
|
||||
function destroy() {
|
||||
spawned.forEach(logger => logger.destroy());
|
||||
spawned.length = 0;
|
||||
}
|
||||
function child(name) {
|
||||
return utils_1.append(spawned, createLogger(label, debugDebugger && debugDebugger.extend(name) || name));
|
||||
}
|
||||
function sibling(name, initial) {
|
||||
return utils_1.append(spawned, createLogger(label, key.replace(/^[^:]+/, name), initial, infoDebugger));
|
||||
}
|
||||
function step(phase) {
|
||||
const stepPrefix = phase && `[${phase}]` || '';
|
||||
const debug = debugDebugger && prefixedLogger(debugDebugger, stepPrefix) || utils_1.NOOP;
|
||||
const info = prefixedLogger(infoDebugger, `${labelPrefix} ${stepPrefix}`, debug);
|
||||
return Object.assign(debugDebugger ? debug : info, {
|
||||
key,
|
||||
label,
|
||||
child,
|
||||
sibling,
|
||||
debug,
|
||||
info,
|
||||
step,
|
||||
destroy,
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.createLogger = createLogger;
|
||||
/**
|
||||
* The `GitLogger` is used by the main `SimpleGit` runner to handle logging
|
||||
* any warnings or errors.
|
||||
*/
|
||||
class GitLogger {
|
||||
constructor(_out = exports.log) {
|
||||
this._out = _out;
|
||||
this.error = prefixedLogger(_out, '[ERROR]');
|
||||
this.warn = prefixedLogger(_out, '[WARN]');
|
||||
}
|
||||
silent(silence = false) {
|
||||
if (silence !== this._out.enabled) {
|
||||
return;
|
||||
}
|
||||
const { namespace } = this._out;
|
||||
const env = (process.env.DEBUG || '').split(',').filter(s => !!s);
|
||||
const hasOn = env.includes(namespace);
|
||||
const hasOff = env.includes(`-${namespace}`);
|
||||
// enabling the log
|
||||
if (!silence) {
|
||||
if (hasOff) {
|
||||
utils_1.remove(env, `-${namespace}`);
|
||||
}
|
||||
else {
|
||||
env.push(namespace);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (hasOn) {
|
||||
utils_1.remove(env, namespace);
|
||||
}
|
||||
else {
|
||||
env.push(`-${namespace}`);
|
||||
}
|
||||
}
|
||||
debug_1.default.enable(env.join(','));
|
||||
}
|
||||
}
|
||||
exports.GitLogger = GitLogger;
|
||||
//# sourceMappingURL=git-logger.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"git-logger.js","sourceRoot":"","sources":["git-logger.ts"],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AAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAClE,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;QAE7C,mBAAmB;QACnB,IAAI,CAAC,OAAO,EAAE;YACX,IAAI,MAAM,EAAE;gBACT,cAAM,CAAC,GAAG,EAAE,IAAI,SAAS,EAAE,CAAC,CAAC;aAC/B;iBACI;gBACF,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACtB;SACH;aACI;YACF,IAAI,KAAK,EAAE;gBACR,cAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;aACzB;iBACI;gBACF,GAAG,CAAC,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;aAC5B;SACH;QAED,eAAK,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,CAAC;CAEH;AA1CD,8BA0CC"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { BranchMultiDeleteResult } from '../../../typings';
|
||||
import { TaskParser } from '../types';
|
||||
import { ExitCodes } from '../utils';
|
||||
export declare const parseBranchDeletions: TaskParser<string, BranchMultiDeleteResult>;
|
||||
export declare function hasBranchDeletionError(data: string, processExitCode: ExitCodes): boolean;
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.hasBranchDeletionError = exports.parseBranchDeletions = void 0;
|
||||
const BranchDeleteSummary_1 = require("../responses/BranchDeleteSummary");
|
||||
const utils_1 = require("../utils");
|
||||
const deleteSuccessRegex = /(\S+)\s+\(\S+\s([^)]+)\)/;
|
||||
const deleteErrorRegex = /^error[^']+'([^']+)'/m;
|
||||
const parsers = [
|
||||
new utils_1.LineParser(deleteSuccessRegex, (result, [branch, hash]) => {
|
||||
const deletion = BranchDeleteSummary_1.branchDeletionSuccess(branch, hash);
|
||||
result.all.push(deletion);
|
||||
result.branches[branch] = deletion;
|
||||
}),
|
||||
new utils_1.LineParser(deleteErrorRegex, (result, [branch]) => {
|
||||
const deletion = BranchDeleteSummary_1.branchDeletionFailure(branch);
|
||||
result.errors.push(deletion);
|
||||
result.all.push(deletion);
|
||||
result.branches[branch] = deletion;
|
||||
}),
|
||||
];
|
||||
const parseBranchDeletions = (stdOut) => {
|
||||
return utils_1.parseStringResponse(new BranchDeleteSummary_1.BranchDeletionBatch(), parsers, stdOut);
|
||||
};
|
||||
exports.parseBranchDeletions = parseBranchDeletions;
|
||||
function hasBranchDeletionError(data, processExitCode) {
|
||||
return processExitCode === utils_1.ExitCodes.ERROR && deleteErrorRegex.test(data);
|
||||
}
|
||||
exports.hasBranchDeletionError = hasBranchDeletionError;
|
||||
//# sourceMappingURL=parse-branch-delete.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-branch-delete.js","sourceRoot":"","sources":["parse-branch-delete.ts"],"names":[],"mappings":";;;AACA,0EAAqH;AAErH,oCAAsE;AAEtE,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AACtD,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAEjD,MAAM,OAAO,GAA0C;IACpD,IAAI,kBAAU,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3D,MAAM,QAAQ,GAAG,2CAAqB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAErD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;IACtC,CAAC,CAAC;IACF,IAAI,kBAAU,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE;QACnD,MAAM,QAAQ,GAAG,2CAAqB,CAAC,MAAM,CAAC,CAAC;QAE/C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC1B,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;IACtC,CAAC,CAAC;CACJ,CAAC;AAEK,MAAM,oBAAoB,GAAgD,CAAC,MAAc,EAAE,EAAE;IACjG,OAAO,2BAAmB,CAAC,IAAI,yCAAmB,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC,CAAA;AAFY,QAAA,oBAAoB,wBAEhC;AAED,SAAgB,sBAAsB,CAAC,IAAY,EAAE,eAA0B;IAC5E,OAAO,eAAe,KAAK,iBAAS,CAAC,KAAK,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7E,CAAC;AAFD,wDAEC"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { BranchSummary } from '../../../typings';
|
||||
export declare function parseBranchSummary(stdOut: string): BranchSummary;
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseBranchSummary = void 0;
|
||||
const BranchSummary_1 = require("../responses/BranchSummary");
|
||||
const utils_1 = require("../utils");
|
||||
const parsers = [
|
||||
new utils_1.LineParser(/^(\*\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
|
||||
result.push(!!current, true, name, commit, label);
|
||||
}),
|
||||
new utils_1.LineParser(/^(\*\s)?(\S+)\s+([a-z0-9]+)\s(.*)$/, (result, [current, name, commit, label]) => {
|
||||
result.push(!!current, false, name, commit, label);
|
||||
})
|
||||
];
|
||||
function parseBranchSummary(stdOut) {
|
||||
return utils_1.parseStringResponse(new BranchSummary_1.BranchSummaryResult(), parsers, stdOut);
|
||||
}
|
||||
exports.parseBranchSummary = parseBranchSummary;
|
||||
//# sourceMappingURL=parse-branch.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-branch.js","sourceRoot":"","sources":["parse-branch.ts"],"names":[],"mappings":";;;AACA,8DAAiE;AACjE,oCAA2D;AAE3D,MAAM,OAAO,GAAsC;IAChD,IAAI,kBAAU,CAAC,uEAAuE,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE;QAChI,MAAM,CAAC,IAAI,CACR,CAAC,CAAC,OAAO,EACT,IAAI,EACJ,IAAI,EAAE,MAAM,EAAE,KAAK,CACrB,CAAC;IACL,CAAC,CAAC;IACF,IAAI,kBAAU,CAAC,oCAAoC,EAAE,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE;QAC7F,MAAM,CAAC,IAAI,CACR,CAAC,CAAC,OAAO,EACT,KAAK,EACL,IAAI,EAAE,MAAM,EAAE,KAAK,CACrB,CAAC;IACL,CAAC,CAAC;CACJ,CAAC;AAEF,SAAgB,kBAAkB,CAAE,MAAc;IAC/C,OAAO,2BAAmB,CAAC,IAAI,mCAAmB,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC;AAFD,gDAEC"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { CommitResult } from '../../../typings';
|
||||
export declare function parseCommitResult(stdOut: string): CommitResult;
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseCommitResult = void 0;
|
||||
const utils_1 = require("../utils");
|
||||
const parsers = [
|
||||
new utils_1.LineParser(/\[([^\s]+)( \([^)]+\))? ([^\]]+)/, (result, [branch, root, commit]) => {
|
||||
result.branch = branch;
|
||||
result.commit = commit;
|
||||
result.root = !!root;
|
||||
}),
|
||||
new utils_1.LineParser(/\s*Author:\s(.+)/i, (result, [author]) => {
|
||||
const parts = author.split('<');
|
||||
const email = parts.pop();
|
||||
if (!email || !email.includes('@')) {
|
||||
return;
|
||||
}
|
||||
result.author = {
|
||||
email: email.substr(0, email.length - 1),
|
||||
name: parts.join('<').trim()
|
||||
};
|
||||
}),
|
||||
new utils_1.LineParser(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g, (result, [changes, insertions, deletions]) => {
|
||||
result.summary.changes = parseInt(changes, 10) || 0;
|
||||
result.summary.insertions = parseInt(insertions, 10) || 0;
|
||||
result.summary.deletions = parseInt(deletions, 10) || 0;
|
||||
}),
|
||||
new utils_1.LineParser(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/, (result, [changes, lines, direction]) => {
|
||||
result.summary.changes = parseInt(changes, 10) || 0;
|
||||
const count = parseInt(lines, 10) || 0;
|
||||
if (direction === '-') {
|
||||
result.summary.deletions = count;
|
||||
}
|
||||
else if (direction === '+') {
|
||||
result.summary.insertions = count;
|
||||
}
|
||||
}),
|
||||
];
|
||||
function parseCommitResult(stdOut) {
|
||||
const result = {
|
||||
author: null,
|
||||
branch: '',
|
||||
commit: '',
|
||||
root: false,
|
||||
summary: {
|
||||
changes: 0,
|
||||
insertions: 0,
|
||||
deletions: 0,
|
||||
},
|
||||
};
|
||||
return utils_1.parseStringResponse(result, parsers, stdOut);
|
||||
}
|
||||
exports.parseCommitResult = parseCommitResult;
|
||||
//# sourceMappingURL=parse-commit.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-commit.js","sourceRoot":"","sources":["parse-commit.ts"],"names":[],"mappings":";;;AACA,oCAA2D;AAE3D,MAAM,OAAO,GAA+B;IACzC,IAAI,kBAAU,CAAC,kCAAkC,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,E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SAAS,CAAC,EAAE,EAAE;QAC9F,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,SAAS,KAAK,GAAG,EAAE;YACpB,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC;SACnC;aAAM,IAAI,SAAS,KAAK,GAAG,EAAE;YAC3B,MAAM,CAAC,OAAO,CAAC,UAAU,GAAG,KAAK,CAAC;SACpC;IACJ,CAAC,CAAC;CACJ,CAAC;AAEF,SAAgB,iBAAiB,CAAC,MAAc;IAC7C,MAAM,MAAM,GAAiB;QAC1B,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,KAAK;QACX,OAAO,EAAE;YACN,OAAO,EAAE,CAAC;YACV,UAAU,EAAE,CAAC;YACb,SAAS,EAAE,CAAC;SACd;KACH,CAAC;IACF,OAAO,2BAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC;AAbD,8CAaC"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { DiffResult } from '../../../typings';
|
||||
export declare function parseDiffResult(stdOut: string): DiffResult;
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseDiffResult = void 0;
|
||||
const DiffSummary_1 = require("../responses/DiffSummary");
|
||||
function parseDiffResult(stdOut) {
|
||||
const lines = stdOut.trim().split('\n');
|
||||
const status = new DiffSummary_1.DiffSummary();
|
||||
readSummaryLine(status, lines.pop());
|
||||
for (let i = 0, max = lines.length; i < max; i++) {
|
||||
const line = lines[i];
|
||||
textFileChange(line, status) || binaryFileChange(line, status);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
exports.parseDiffResult = parseDiffResult;
|
||||
function readSummaryLine(status, summary) {
|
||||
(summary || '')
|
||||
.trim()
|
||||
.split(', ')
|
||||
.forEach(function (text) {
|
||||
const summary = /(\d+)\s([a-z]+)/.exec(text);
|
||||
if (!summary) {
|
||||
return;
|
||||
}
|
||||
summaryType(status, summary[2], parseInt(summary[1], 10));
|
||||
});
|
||||
}
|
||||
function summaryType(status, key, value) {
|
||||
const match = (/([a-z]+?)s?\b/.exec(key));
|
||||
if (!match || !statusUpdate[match[1]]) {
|
||||
return;
|
||||
}
|
||||
statusUpdate[match[1]](status, value);
|
||||
}
|
||||
const statusUpdate = {
|
||||
file(status, value) {
|
||||
status.changed = value;
|
||||
},
|
||||
deletion(status, value) {
|
||||
status.deletions = value;
|
||||
},
|
||||
insertion(status, value) {
|
||||
status.insertions = value;
|
||||
}
|
||||
};
|
||||
function textFileChange(input, { files }) {
|
||||
const line = input.trim().match(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/);
|
||||
if (line) {
|
||||
var alterations = (line[3] || '').trim();
|
||||
files.push({
|
||||
file: line[1].trim(),
|
||||
changes: parseInt(line[2], 10),
|
||||
insertions: alterations.replace(/-/g, '').length,
|
||||
deletions: alterations.replace(/\+/g, '').length,
|
||||
binary: false
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function binaryFileChange(input, { files }) {
|
||||
const line = input.match(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)$/);
|
||||
if (line) {
|
||||
files.push({
|
||||
file: line[1].trim(),
|
||||
before: +line[2],
|
||||
after: +line[3],
|
||||
binary: true
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//# sourceMappingURL=parse-diff-summary.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-diff-summary.js","sourceRoot":"","sources":["parse-diff-summary.ts"],"names":[],"mappings":";;;AACA,0DAAuD;AAEvD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,CAAC,IAAI,CAAC;YACR,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;YACpB,MAAM,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YAChB,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;YACf,MAAM,EAAE,IAAI;SACd,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;KACd;IACD,OAAO,KAAK,CAAC;AAChB,CAAC"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { FetchResult } from '../../../typings';
|
||||
export declare function parseFetchResult(stdOut: string, stdErr: string): FetchResult;
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseFetchResult = void 0;
|
||||
const utils_1 = require("../utils");
|
||||
const parsers = [
|
||||
new utils_1.LineParser(/From (.+)$/, (result, [remote]) => {
|
||||
result.remote = remote;
|
||||
}),
|
||||
new utils_1.LineParser(/\* \[new branch]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
|
||||
result.branches.push({
|
||||
name,
|
||||
tracking,
|
||||
});
|
||||
}),
|
||||
new utils_1.LineParser(/\* \[new tag]\s+(\S+)\s*-> (.+)$/, (result, [name, tracking]) => {
|
||||
result.tags.push({
|
||||
name,
|
||||
tracking,
|
||||
});
|
||||
})
|
||||
];
|
||||
function parseFetchResult(stdOut, stdErr) {
|
||||
const result = {
|
||||
raw: stdOut,
|
||||
remote: null,
|
||||
branches: [],
|
||||
tags: [],
|
||||
};
|
||||
return utils_1.parseStringResponse(result, parsers, stdOut, stdErr);
|
||||
}
|
||||
exports.parseFetchResult = parseFetchResult;
|
||||
//# sourceMappingURL=parse-fetch.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-fetch.js","sourceRoot":"","sources":["parse-fetch.ts"],"names":[],"mappings":";;;AACA,oCAA2D;AAE3D,MAAM,OAAO,GAA8B;IACxC,IAAI,kBAAU,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE;QAC/C,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,CAAC,CAAC;IACF,IAAI,kBAAU,CAAC,qCAAqC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE;QAChF,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YAClB,IAAI;YACJ,QAAQ;SACV,CAAC,CAAC;IACN,CAAC,CAAC;IACF,IAAI,kBAAU,CAAC,kCAAkC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,EAAE;QAC7E,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;YACd,IAAI;YACJ,QAAQ;SACV,CAAC,CAAC;IACN,CAAC,CAAC;CACJ,CAAC;AAEF,SAAgB,gBAAgB,CAAE,MAAc,EAAE,MAAc;IAC7D,MAAM,MAAM,GAAgB;QACzB,GAAG,EAAE,MAAM;QACX,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,EAAE;KACV,CAAC;IACF,OAAO,2BAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC/D,CAAC;AARD,4CAQC"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { LogResult } from '../../../typings';
|
||||
export declare const START_BOUNDARY = "\u00F2\u00F2\u00F2\u00F2\u00F2\u00F2 ";
|
||||
export declare const COMMIT_BOUNDARY = " \u00F2\u00F2";
|
||||
export declare const SPLITTER = " \u00F2 ";
|
||||
export declare function createListLogSummaryParser<T = any>(splitter?: string, fields?: string[]): (stdOut: string) => LogResult<T>;
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.createListLogSummaryParser = exports.SPLITTER = exports.COMMIT_BOUNDARY = exports.START_BOUNDARY = void 0;
|
||||
const utils_1 = require("../utils");
|
||||
const parse_diff_summary_1 = require("./parse-diff-summary");
|
||||
exports.START_BOUNDARY = 'òòòòòò ';
|
||||
exports.COMMIT_BOUNDARY = ' òò';
|
||||
exports.SPLITTER = ' ò ';
|
||||
const defaultFieldNames = ['hash', 'date', 'message', 'refs', 'author_name', 'author_email'];
|
||||
function lineBuilder(tokens, fields) {
|
||||
return fields.reduce((line, field, index) => {
|
||||
line[field] = tokens[index] || '';
|
||||
return line;
|
||||
}, Object.create({ diff: null }));
|
||||
}
|
||||
function createListLogSummaryParser(splitter = exports.SPLITTER, fields = defaultFieldNames) {
|
||||
return function (stdOut) {
|
||||
const all = utils_1.toLinesWithContent(stdOut, true, exports.START_BOUNDARY)
|
||||
.map(function (item) {
|
||||
const lineDetail = item.trim().split(exports.COMMIT_BOUNDARY);
|
||||
const listLogLine = lineBuilder(lineDetail[0].trim().split(splitter), fields);
|
||||
if (lineDetail.length > 1 && !!lineDetail[1].trim()) {
|
||||
listLogLine.diff = parse_diff_summary_1.parseDiffResult(lineDetail[1]);
|
||||
}
|
||||
return listLogLine;
|
||||
});
|
||||
return {
|
||||
all,
|
||||
latest: all.length && all[0] || null,
|
||||
total: all.length,
|
||||
};
|
||||
};
|
||||
}
|
||||
exports.createListLogSummaryParser = createListLogSummaryParser;
|
||||
//# sourceMappingURL=parse-list-log-summary.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-list-log-summary.js","sourceRoot":"","sources":["parse-list-log-summary.ts"],"names":[],"mappings":";;;AACA,oCAA8C;AAC9C,6DAAuD;AAE1C,QAAA,cAAc,GAAG,SAAS,CAAC;AAE3B,QAAA,eAAe,GAAG,KAAK,CAAC;AAExB,QAAA,QAAQ,GAAG,KAAK,CAAC;AAE9B,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC;AAE7F,SA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eDetail, MergeResult } from '../../../typings';
|
||||
import { TaskParser } from '../types';
|
||||
/**
|
||||
* Parse the complete response from `git.merge`
|
||||
*/
|
||||
export declare const parseMergeResult: TaskParser<string, MergeResult>;
|
||||
/**
|
||||
* Parse the merge specific detail (ie: not the content also available in the pull detail) from `git.mnerge`
|
||||
* @param stdOut
|
||||
*/
|
||||
export declare const parseMergeDetail: TaskParser<string, MergeDetail>;
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseMergeDetail = exports.parseMergeResult = void 0;
|
||||
const MergeSummary_1 = require("../responses/MergeSummary");
|
||||
const utils_1 = require("../utils");
|
||||
const parse_pull_1 = require("./parse-pull");
|
||||
const parsers = [
|
||||
new utils_1.LineParser(/^Auto-merging\s+(.+)$/, (summary, [autoMerge]) => {
|
||||
summary.merges.push(autoMerge);
|
||||
}),
|
||||
new utils_1.LineParser(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/, (summary, [reason, file]) => {
|
||||
summary.conflicts.push(new MergeSummary_1.MergeSummaryConflict(reason, file));
|
||||
}),
|
||||
new utils_1.LineParser(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/, (summary, [reason, file, deleteRef]) => {
|
||||
summary.conflicts.push(new MergeSummary_1.MergeSummaryConflict(reason, file, { deleteRef }));
|
||||
}),
|
||||
new utils_1.LineParser(/^CONFLICT\s+\((.+)\):/, (summary, [reason]) => {
|
||||
summary.conflicts.push(new MergeSummary_1.MergeSummaryConflict(reason, null));
|
||||
}),
|
||||
new utils_1.LineParser(/^Automatic merge failed;\s+(.+)$/, (summary, [result]) => {
|
||||
summary.result = result;
|
||||
}),
|
||||
];
|
||||
/**
|
||||
* Parse the complete response from `git.merge`
|
||||
*/
|
||||
const parseMergeResult = (stdOut, stdErr) => {
|
||||
return Object.assign(exports.parseMergeDetail(stdOut, stdErr), parse_pull_1.parsePullResult(stdOut, stdErr));
|
||||
};
|
||||
exports.parseMergeResult = parseMergeResult;
|
||||
/**
|
||||
* Parse the merge specific detail (ie: not the content also available in the pull detail) from `git.mnerge`
|
||||
* @param stdOut
|
||||
*/
|
||||
const parseMergeDetail = (stdOut) => {
|
||||
return utils_1.parseStringResponse(new MergeSummary_1.MergeSummaryDetail(), parsers, stdOut);
|
||||
};
|
||||
exports.parseMergeDetail = parseMergeDetail;
|
||||
//# sourceMappingURL=parse-merge.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-merge.js","sourceRoot":"","sources":["parse-merge.ts"],"names":[],"mappings":";;;AACA,4DAAqF;AAErF,oCAA2D;AAC3D,6CAA+C;AAE/C,MAAM,OAAO,GAA8B;IACxC,IAAI,kBAAU,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE;QAC9D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC,CAAC;IACF,IAAI,kBAAU,CAAC,+CAA+C,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;QACzF,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,mCAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC;IACF,IAAI,kBAAU,CAAC,wDAAwD,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,EAAE;QAC7G,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,mCAAoB,CAAC,MAAM,EAAE,IAAI,EAAE,EAAC,SAAS,EAAC,CAAC,CAAC,CAAC;IAC/E,CAAC,CAAC;IACF,IAAI,kBAAU,CAAC,uBAAuB,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE;QAC3D,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,mCAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC;IACF,IAAI,kBAAU,CAAC,kCAAkC,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE;QACtE,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IAC3B,CAAC,CAAC;CACJ,CAAC;AAEF;;GAEG;AACI,MAAM,gBAAgB,GAAoC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;IACjF,OAAO,MAAM,CAAC,MAAM,CACjB,wBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,EAChC,4BAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CACjC,CAAC;AACL,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B;AAEF;;;GAGG;AACI,MAAM,gBAAgB,GAAoC,CAAC,MAAM,EAAE,EAAE;IACzE,OAAO,2BAAmB,CAAC,IAAI,iCAAkB,EAAE,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AACzE,CAAC,CAAA;AAFY,QAAA,gBAAgB,oBAE5B"}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
import { MoveResult } from '../../../typings';
|
||||
export declare function parseMoveResult(stdOut: string): MoveResult;
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parseMoveResult = void 0;
|
||||
const utils_1 = require("../utils");
|
||||
const parsers = [
|
||||
new utils_1.LineParser(/^Renaming (.+) to (.+)$/, (result, [from, to]) => {
|
||||
result.moves.push({ from, to });
|
||||
}),
|
||||
];
|
||||
function parseMoveResult(stdOut) {
|
||||
return utils_1.parseStringResponse({ moves: [] }, parsers, stdOut);
|
||||
}
|
||||
exports.parseMoveResult = parseMoveResult;
|
||||
//# sourceMappingURL=parse-move.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-move.js","sourceRoot":"","sources":["parse-move.ts"],"names":[],"mappings":";;;AACA,oCAA2D;AAE3D,MAAM,OAAO,GAA6B;IACvC,IAAI,kBAAU,CAAC,yBAAyB,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE;QAC9D,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,EAAE,EAAC,CAAC,CAAC;IACjC,CAAC,CAAC;CACJ,CAAC;AAEF,SAAgB,eAAe,CAAE,MAAc;IAC5C,OAAO,2BAAmB,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC;AAFD,0CAEC"}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import { PullDetail, PullResult } from '../../../typings';
|
||||
import { TaskParser } from '../types';
|
||||
export declare const parsePullDetail: TaskParser<string, PullDetail>;
|
||||
export declare const parsePullResult: TaskParser<string, PullResult>;
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parsePullResult = exports.parsePullDetail = void 0;
|
||||
const PullSummary_1 = require("../responses/PullSummary");
|
||||
const utils_1 = require("../utils");
|
||||
const parse_remote_messages_1 = require("./parse-remote-messages");
|
||||
const FILE_UPDATE_REGEX = /^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/;
|
||||
const SUMMARY_REGEX = /(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/;
|
||||
const ACTION_REGEX = /^(create|delete) mode \d+ (.+)/;
|
||||
const parsers = [
|
||||
new utils_1.LineParser(FILE_UPDATE_REGEX, (result, [file, insertions, deletions]) => {
|
||||
result.files.push(file);
|
||||
if (insertions) {
|
||||
result.insertions[file] = insertions.length;
|
||||
}
|
||||
if (deletions) {
|
||||
result.deletions[file] = deletions.length;
|
||||
}
|
||||
}),
|
||||
new utils_1.LineParser(SUMMARY_REGEX, (result, [changes, , insertions, , deletions]) => {
|
||||
if (insertions !== undefined || deletions !== undefined) {
|
||||
result.summary.changes = +changes || 0;
|
||||
result.summary.insertions = +insertions || 0;
|
||||
result.summary.deletions = +deletions || 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}),
|
||||
new utils_1.LineParser(ACTION_REGEX, (result, [action, file]) => {
|
||||
utils_1.append(result.files, file);
|
||||
utils_1.append((action === 'create') ? result.created : result.deleted, file);
|
||||
}),
|
||||
];
|
||||
const parsePullDetail = (stdOut, stdErr) => {
|
||||
return utils_1.parseStringResponse(new PullSummary_1.PullSummary(), parsers, stdOut, stdErr);
|
||||
};
|
||||
exports.parsePullDetail = parsePullDetail;
|
||||
const parsePullResult = (stdOut, stdErr) => {
|
||||
return Object.assign(new PullSummary_1.PullSummary(), exports.parsePullDetail(stdOut, stdErr), parse_remote_messages_1.parseRemoteMessages(stdOut, stdErr));
|
||||
};
|
||||
exports.parsePullResult = parsePullResult;
|
||||
//# sourceMappingURL=parse-pull.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-pull.js","sourceRoot":"","sources":["parse-pull.ts"],"names":[],"mappings":";;;AACA,0DAAuD;AAEvD,oCAAmE;AACnE,mEAA8D;AAE9D,MAAM,iBAAiB,GAAG,kCAAkC,CAAC;AAC7D,MAAM,aAAa,GAAG,8CAA8C,CAAC;AACrE,MAAM,YAAY,GAAG,gCAAgC,CAAC;AAEtD,MAAM,OAAO,GAA6B;IACvC,IAAI,kBAAU,CAAC,iBAAiB,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,EAAE;QACzE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAExB,IAAI,UAAU,EAAE;YACb,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC;SAC9C;QAED,IAAI,SAAS,EAAE;YACZ,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,SAAS,C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AmB,CAAiB,MAAM,EAAE,MAAM,CAAC,CACrD,CAAC;AACL,CAAC,CAAA;AANY,QAAA,eAAe,mBAM3B"}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
import { PushDetail, PushResult } from '../../../typings';
|
||||
import { TaskParser } from '../types';
|
||||
export declare const parsePushResult: TaskParser<string, PushResult>;
|
||||
export declare const parsePushDetail: TaskParser<string, PushDetail>;
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.parsePushDetail = exports.parsePushResult = void 0;
|
||||
const utils_1 = require("../utils");
|
||||
const parse_remote_messages_1 = require("./parse-remote-messages");
|
||||
function pushResultPushedItem(local, remote, status) {
|
||||
const deleted = status.includes('deleted');
|
||||
const tag = status.includes('tag') || /^refs\/tags/.test(local);
|
||||
const alreadyUpdated = !status.includes('new');
|
||||
return {
|
||||
deleted,
|
||||
tag,
|
||||
branch: !tag,
|
||||
new: !alreadyUpdated,
|
||||
alreadyUpdated,
|
||||
local,
|
||||
remote,
|
||||
};
|
||||
}
|
||||
const parsers = [
|
||||
new utils_1.LineParser(/^Pushing to (.+)$/, (result, [repo]) => {
|
||||
result.repo = repo;
|
||||
}),
|
||||
new utils_1.LineParser(/^updating local tracking ref '(.+)'/, (result, [local]) => {
|
||||
result.ref = Object.assign(Object.assign({}, (result.ref || {})), { local });
|
||||
}),
|
||||
new utils_1.LineParser(/^[*-=]\s+([^:]+):(\S+)\s+\[(.+)]$/, (result, [local, remote, type]) => {
|
||||
result.pushed.push(pushResultPushedItem(local, remote, type));
|
||||
}),
|
||||
new utils_1.LineParser(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/, (result, [local, remote, remoteName]) => {
|
||||
result.branch = Object.assign(Object.assign({}, (result.branch || {})), { local,
|
||||
remote,
|
||||
remoteName });
|
||||
}),
|
||||
new utils_1.LineParser(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/, (result, [local, remote, from, to]) => {
|
||||
result.update = {
|
||||
head: {
|
||||
local,
|
||||
remote,
|
||||
},
|
||||
hash: {
|
||||
from,
|
||||
to,
|
||||
},
|
||||
};
|
||||
}),
|
||||
];
|
||||
const parsePushResult = (stdOut, stdErr) => {
|
||||
const pushDetail = exports.parsePushDetail(stdOut, stdErr);
|
||||
const responseDetail = parse_remote_messages_1.parseRemoteMessages(stdOut, stdErr);
|
||||
return Object.assign(Object.assign({}, pushDetail), responseDetail);
|
||||
};
|
||||
exports.parsePushResult = parsePushResult;
|
||||
const parsePushDetail = (stdOut, stdErr) => {
|
||||
return utils_1.parseStringResponse({ pushed: [] }, parsers, stdOut, stdErr);
|
||||
};
|
||||
exports.parsePushDetail = parsePushDetail;
|
||||
//# sourceMappingURL=parse-push.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-push.js","sourceRoot":"","sources":["parse-push.ts"],"names":[],"mappings":";;;AAEA,oCAA2D;AAC3D,mEAA8D;AAE9D,SAAS,oBAAoB,CAAC,KAAa,EAAE,MAAc,EAAE,MAAc;IACxE,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,MAAM,cAAc,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE/C,OAAO;QACJ,OAAO;QACP,GAAG;QACH,MAAM,EAAE,CAAC,GAAG;QACZ,GAAG,EAAE,CAAC,cAAc;QACpB,cAAc;QACd,KAAK;QACL,MAAM;KACR,CAAC;AACL,CAAC;AAED,MAAM,OAAO,GAA6B;IACvC,IAAI,kBAAU,CAAC,mBAAmB,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE;QACpD,MAAM,CAAC,IAAI,GAAG,IAAI,CA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,CAAA;AARY,QAAA,eAAe,mBAQ3B;AAEM,MAAM,eAAe,GAAmC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;IAC/E,OAAO,2BAAmB,CAAC,EAAC,MAAM,EAAE,EAAE,EAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACrE,CAAC,CAAA;AAFY,QAAA,eAAe,mBAE3B"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { RemoteMessageResult, RemoteMessages } from '../../../typings';
|
||||
export declare function parseRemoteMessages<T extends RemoteMessages = RemoteMessages>(_stdOut: string, stdErr: string): RemoteMessageResult;
|
||||
export declare class RemoteMessageSummary implements RemoteMessages {
|
||||
readonly all: string[];
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.RemoteMessageSummary = exports.parseRemoteMessages = void 0;
|
||||
const utils_1 = require("../utils");
|
||||
const parse_remote_objects_1 = require("./parse-remote-objects");
|
||||
const parsers = [
|
||||
new utils_1.RemoteLineParser(/^remote:\s*(.+)$/, (result, [text]) => {
|
||||
result.remoteMessages.all.push(text.trim());
|
||||
return false;
|
||||
}),
|
||||
...parse_remote_objects_1.remoteMessagesObjectParsers,
|
||||
new utils_1.RemoteLineParser([/create a (?:pull|merge) request/i, /\s(https?:\/\/\S+)$/], (result, [pullRequestUrl]) => {
|
||||
result.remoteMessages.pullRequestUrl = pullRequestUrl;
|
||||
}),
|
||||
new utils_1.RemoteLineParser([/found (\d+) vulnerabilities.+\(([^)]+)\)/i, /\s(https?:\/\/\S+)$/], (result, [count, summary, url]) => {
|
||||
result.remoteMessages.vulnerabilities = {
|
||||
count: utils_1.asNumber(count),
|
||||
summary,
|
||||
url,
|
||||
};
|
||||
}),
|
||||
];
|
||||
function parseRemoteMessages(_stdOut, stdErr) {
|
||||
return utils_1.parseStringResponse({ remoteMessages: new RemoteMessageSummary() }, parsers, stdErr);
|
||||
}
|
||||
exports.parseRemoteMessages = parseRemoteMessages;
|
||||
class RemoteMessageSummary {
|
||||
constructor() {
|
||||
this.all = [];
|
||||
}
|
||||
}
|
||||
exports.RemoteMessageSummary = RemoteMessageSummary;
|
||||
//# sourceMappingURL=parse-remote-messages.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-remote-messages.js","sourceRoot":"","sources":["parse-remote-messages.ts"],"names":[],"mappings":";;;AACA,oCAA2E;AAC3E,iEAAqE;AAErE,MAAM,OAAO,GAAuF;IACjG,IAAI,wBAAgB,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE;QACzD,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC5C,OAAO,KAAK,CAAC;IAChB,CAAC,CAAC;IACF,GAAG,kDAA2B;IAC9B,IAAI,wBAAgB,CAAC,CAAC,kCAAkC,EAAE,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE;QAC3G,MAAM,CAAC,cAA2C,CAAC,cAAc,GAAG,cAAc,CAAC;IACvF,CAAC,CAAC;IACF,IAAI,wBAAgB,CAAC,CAAC,2CAA2C,EAAE,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE;QACzH,MAAM,CAAC,cAA2C,CAAC,eAAe,GAAG;YACnE,KAAK,EAAE,gBAAQ,CAAC,KAAK,CAAC;YACtB,OAAO;YACP,GAAG;SACL,CAAC;IACL,CAAC,CAAC;CACJ,CAAC;AAEF,SAAgB,mBAAmB,CAChC,OAAe,EAAE,MAAc;IAE/B,OAAO,2BAAmB,CAAC,EAAC,cAAc,EAAE,IAAI,oBAAoB,EAAO,EAAC,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAClG,CAAC;AAJD,kDAIC;AAED,MAAa,oBAAoB;IAAjC;QACmB,QAAG,GAAa,EAAE,CAAC;IACtC,CAAC;CAAA;AAFD,oDAEC"}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
import { RemoteMessageResult, RemoteMessages } from '../../../typings';
|
||||
import { RemoteLineParser } from '../utils';
|
||||
export declare const remoteMessagesObjectParsers: RemoteLineParser<RemoteMessageResult<RemoteMessages>>[];
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.remoteMessagesObjectParsers = void 0;
|
||||
const utils_1 = require("../utils");
|
||||
function objectEnumerationResult(remoteMessages) {
|
||||
return (remoteMessages.objects = remoteMessages.objects || {
|
||||
compressing: 0,
|
||||
counting: 0,
|
||||
enumerating: 0,
|
||||
packReused: 0,
|
||||
reused: { count: 0, delta: 0 },
|
||||
total: { count: 0, delta: 0 }
|
||||
});
|
||||
}
|
||||
function asObjectCount(source) {
|
||||
const count = /^\s*(\d+)/.exec(source);
|
||||
const delta = /delta (\d+)/i.exec(source);
|
||||
return {
|
||||
count: utils_1.asNumber(count && count[1] || '0'),
|
||||
delta: utils_1.asNumber(delta && delta[1] || '0'),
|
||||
};
|
||||
}
|
||||
exports.remoteMessagesObjectParsers = [
|
||||
new utils_1.RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i, (result, [action, count]) => {
|
||||
const key = action.toLowerCase();
|
||||
const enumeration = objectEnumerationResult(result.remoteMessages);
|
||||
Object.assign(enumeration, { [key]: utils_1.asNumber(count) });
|
||||
}),
|
||||
new utils_1.RemoteLineParser(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i, (result, [action, count]) => {
|
||||
const key = action.toLowerCase();
|
||||
const enumeration = objectEnumerationResult(result.remoteMessages);
|
||||
Object.assign(enumeration, { [key]: utils_1.asNumber(count) });
|
||||
}),
|
||||
new utils_1.RemoteLineParser(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i, (result, [total, reused, packReused]) => {
|
||||
const objects = objectEnumerationResult(result.remoteMessages);
|
||||
objects.total = asObjectCount(total);
|
||||
objects.reused = asObjectCount(reused);
|
||||
objects.packReused = utils_1.asNumber(packReused);
|
||||
}),
|
||||
];
|
||||
//# sourceMappingURL=parse-remote-objects.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"parse-remote-objects.js","sourceRoot":"","sources":["parse-remote-objects.ts"],"names":[],"mappings":";;;AACA,oCAAsD;AAEtD,SAAS,uBAAuB,CAA4C,cAAiB;IAC1F,OAAO,CAAC,cAAc,CAAC,OAAO,GAAG,cAAc,CAAC,OAAO,IAAI;QACxD,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,CAAC;QACb,MAAM,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC;QAC5B,KAAK,EAAE,EAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAC;KAC7B,CAAC,CAAC;AACN,CAAC;AAED,SAAS,aAAa,CAAC,MAAc;IAClC,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,MAAM,KAAK,GAAG,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE1C,OAAO;QACJ,KAAK,EAAE,gBAAQ,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;QACzC,KAAK,EAAE,gBAAQ,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;KAC3C,CAAC;AACL,CAAC;AAEY,QAAA,2BAA2B,GAA4D;IACjG,IAAI,wBAAgB,CAAC,gEAAgE,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE;QAChH,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,uBAAuB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAEnE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAC,CAAC,GAAG,CAAC,EAAE,gBAAQ,CAAC,KAAK,CAAC,EAAC,CAAC,CAAC;IACxD,CAAC,CAAC;IACF,IAAI,wBAAgB,CAAC,8EAA8E,EAAE,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE;QAC9H,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;QACjC,MAAM,WAAW,GAAG,uBAAuB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAEnE,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAC,CAAC,GAAG,CAAC,EAAE,gBAAQ,CAAC,KAAK,CAAC,EAAC,CAAC,CAAC;IACxD,CAAC,CAAC;IACF,IAAI,wBAAgB,CAAC,mDAAmD,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE;QAC/G,MAAM,OAAO,GAAG,uBAAuB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAC/D,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QACvC,OAAO,CAAC,UAAU,GAAG,gBAAQ,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC,CAAC;CACJ,CAAC"}
|
||||
+12
@@ -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;
|
||||
+31
@@ -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
|
||||
+1
@@ -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
@@ -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
@@ -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
|
||||
+1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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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AC,KAAK,CAAC,CAAC;SACxC;aAAM;YACJ,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAW,EAAE,KAAK,CAAC,CAAC;SAC/C;QAED,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;IACzB,CAAC;CAEH;AA1CD,gCA0CC;AAED,SAAgB,gBAAgB,CAAC,IAAY;IAC1C,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,GAAG;QAC/C,MAAM,IAAI,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACxC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,eAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QAE/C,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;KACpC;IAED,OAAO,MAAM,CAAC;AACjB,CAAC;AAZD,4CAYC;AAED,SAAS,cAAc,CAAC,QAAgB;IACrC,OAAO,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import { DiffResult, 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
@@ -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
@@ -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"}
|
||||
+9
@@ -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
@@ -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
|
||||
+1
@@ -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
@@ -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
@@ -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
|
||||
+1
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
|
||||
+1
@@ -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;QACvB,YAAO,GAAa,EAAE,CAAC;QACvB,aAAQ,GAAa,EAAE,CAAC;QACxB,YAAO,GAA0B,EAAE,CAAC;QAE3C;;;WAGG;QACI,UAAK,GAAuB,EAAE,CAAC;QAC/B,WAAM,GAAa,EAAE,C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AC;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
@@ -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
@@ -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
@@ -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;YA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,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAExB,IAAI,MAAM,KAAK,MAAM,EAAE;QACpB,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KACzB;IAED,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,MAAM,CAAC,CAAS,EAAE,CAAS;IACjC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,OAAO,CAAC,KAAa;IAC3B,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED,SAAS,QAAQ,CAAC,KAAyB;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC5B,OAAO,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;KACvD;IAED,OAAO,CAAC,CAAC;AACZ,CAAC"}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
import { Scheduler } from './scheduler';
|
||||
import { outputHandler, SimpleGitExecutor, SimpleGitTask } from '../types';
|
||||
export declare class GitExecutorChain implements SimpleGitExecutor {
|
||||
private _executor;
|
||||
private _scheduler;
|
||||
private _chain;
|
||||
private _queue;
|
||||
get binary(): string;
|
||||
get outputHandler(): outputHandler | undefined;
|
||||
get cwd(): string;
|
||||
get env(): import("../types").GitExecutorEnv;
|
||||
constructor(_executor: SimpleGitExecutor, _scheduler: Scheduler);
|
||||
push<R>(task: SimpleGitTask<R>): Promise<void | R>;
|
||||
private attemptTask;
|
||||
private onFatalException;
|
||||
private attemptRemoteTask;
|
||||
private attemptEmptyTask;
|
||||
private handleTaskData;
|
||||
private gitResponse;
|
||||
}
|
||||
+169
@@ -0,0 +1,169 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.GitExecutorChain = void 0;
|
||||
const child_process_1 = require("child_process");
|
||||
const api_1 = require("../api");
|
||||
const task_1 = require("../tasks/task");
|
||||
const tasks_pending_queue_1 = require("./tasks-pending-queue");
|
||||
const utils_1 = require("../utils");
|
||||
class GitExecutorChain {
|
||||
constructor(_executor, _scheduler) {
|
||||
this._executor = _executor;
|
||||
this._scheduler = _scheduler;
|
||||
this._chain = Promise.resolve();
|
||||
this._queue = new tasks_pending_queue_1.TasksPendingQueue();
|
||||
}
|
||||
get binary() {
|
||||
return this._executor.binary;
|
||||
}
|
||||
get outputHandler() {
|
||||
return this._executor.outputHandler;
|
||||
}
|
||||
get cwd() {
|
||||
return this._executor.cwd;
|
||||
}
|
||||
get env() {
|
||||
return this._executor.env;
|
||||
}
|
||||
push(task) {
|
||||
this._queue.push(task);
|
||||
return this._chain = this._chain.then(() => this.attemptTask(task));
|
||||
}
|
||||
attemptTask(task) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const onScheduleComplete = yield this._scheduler.next();
|
||||
const onQueueComplete = () => this._queue.complete(task);
|
||||
try {
|
||||
const { logger } = this._queue.attempt(task);
|
||||
return yield (task_1.isEmptyTask(task)
|
||||
? this.attemptEmptyTask(task, logger)
|
||||
: this.attemptRemoteTask(task, logger));
|
||||
}
|
||||
catch (e) {
|
||||
throw this.onFatalException(task, e);
|
||||
}
|
||||
finally {
|
||||
onQueueComplete();
|
||||
onScheduleComplete();
|
||||
}
|
||||
});
|
||||
}
|
||||
onFatalException(task, e) {
|
||||
const gitError = (e instanceof api_1.GitError) ? Object.assign(e, { task }) : new api_1.GitError(task, e && String(e));
|
||||
this._chain = Promise.resolve();
|
||||
this._queue.fatal(gitError);
|
||||
return gitError;
|
||||
}
|
||||
attemptRemoteTask(task, logger) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const raw = yield this.gitResponse(this.binary, task.commands, this.outputHandler, logger.step('SPAWN'));
|
||||
const outputStreams = yield this.handleTaskData(task, raw, logger.step('HANDLE'));
|
||||
logger(`passing response to task's parser as a %s`, task.format);
|
||||
if (task_1.isBufferTask(task)) {
|
||||
return utils_1.callTaskParser(task.parser, outputStreams);
|
||||
}
|
||||
return utils_1.callTaskParser(task.parser, outputStreams.asStrings());
|
||||
});
|
||||
}
|
||||
attemptEmptyTask(task, logger) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
logger(`empty task bypassing child process to call to task's parser`);
|
||||
return task.parser();
|
||||
});
|
||||
}
|
||||
handleTaskData({ onError, concatStdErr }, { exitCode, stdOut, stdErr }, logger) {
|
||||
return new Promise((done, fail) => {
|
||||
logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
|
||||
if (exitCode && stdErr.length && onError) {
|
||||
logger.info(`exitCode=%s handling with custom error handler`);
|
||||
logger(`concatenate stdErr to stdOut: %j`, concatStdErr);
|
||||
return onError(exitCode, Buffer.concat([...(concatStdErr ? stdOut : []), ...stdErr]).toString('utf-8'), (result) => {
|
||||
logger.info(`custom error handler treated as success`);
|
||||
logger(`custom error returned a %s`, utils_1.objectToString(result));
|
||||
done(new utils_1.GitOutputStreams(Buffer.isBuffer(result) ? result : Buffer.from(String(result)), Buffer.concat(stdErr)));
|
||||
}, fail);
|
||||
}
|
||||
if (exitCode && stdErr.length) {
|
||||
logger.info(`exitCode=%s treated as error when then child process has written to stdErr`);
|
||||
return fail(Buffer.concat(stdErr).toString('utf-8'));
|
||||
}
|
||||
if (concatStdErr) {
|
||||
logger(`concatenating stdErr onto stdOut before processing`);
|
||||
logger(`stdErr: $O`, stdErr);
|
||||
stdOut.push(...stdErr);
|
||||
}
|
||||
logger.info(`retrieving task output complete`);
|
||||
done(new utils_1.GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
|
||||
});
|
||||
}
|
||||
gitResponse(command, args, outputHandler, logger) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const outputLogger = logger.sibling('output');
|
||||
const spawnOptions = {
|
||||
cwd: this.cwd,
|
||||
env: this.env,
|
||||
windowsHide: true,
|
||||
};
|
||||
return new Promise((done) => {
|
||||
const stdOut = [];
|
||||
const stdErr = [];
|
||||
let attempted = false;
|
||||
function attemptClose(exitCode, event = 'retry') {
|
||||
// closing when there is content, terminate immediately
|
||||
if (attempted || stdErr.length || stdOut.length) {
|
||||
logger.info(`exitCode=%s event=%s`, exitCode, event);
|
||||
done({
|
||||
stdOut,
|
||||
stdErr,
|
||||
exitCode,
|
||||
});
|
||||
attempted = true;
|
||||
outputLogger.destroy();
|
||||
}
|
||||
// first attempt at closing but no content yet, wait briefly for the close/exit that may follow
|
||||
if (!attempted) {
|
||||
attempted = true;
|
||||
setTimeout(() => attemptClose(exitCode, 'deferred'), 50);
|
||||
logger('received %s event before content on stdOut/stdErr', event);
|
||||
}
|
||||
}
|
||||
logger.info(`%s %o`, command, args);
|
||||
logger('%O', spawnOptions);
|
||||
const spawned = child_process_1.spawn(command, args, spawnOptions);
|
||||
spawned.stdout.on('data', onDataReceived(stdOut, 'stdOut', logger, outputLogger.step('stdOut')));
|
||||
spawned.stderr.on('data', onDataReceived(stdErr, 'stdErr', logger, outputLogger.step('stdErr')));
|
||||
spawned.on('error', onErrorReceived(stdErr, logger));
|
||||
spawned.on('close', (code) => attemptClose(code, 'close'));
|
||||
spawned.on('exit', (code) => attemptClose(code, 'exit'));
|
||||
if (outputHandler) {
|
||||
logger(`Passing child process stdOut/stdErr to custom outputHandler`);
|
||||
outputHandler(command, spawned.stdout, spawned.stderr, [...args]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.GitExecutorChain = GitExecutorChain;
|
||||
function onErrorReceived(target, logger) {
|
||||
return (err) => {
|
||||
logger(`[ERROR] child process exception %o`, err);
|
||||
target.push(Buffer.from(String(err.stack), 'ascii'));
|
||||
};
|
||||
}
|
||||
function onDataReceived(target, name, logger, output) {
|
||||
return (buffer) => {
|
||||
logger(`%s received %L bytes`, name, buffer);
|
||||
output(`%B`, buffer);
|
||||
target.push(buffer);
|
||||
};
|
||||
}
|
||||
//# sourceMappingURL=git-executor-chain.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"git-executor-chain.js","sourceRoot":"","sources":["git-executor-chain.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAAoD;AACpD,gCAAkC;AAElC,wCAAsE;AAEtE,+DAA0D;AAU1D,oCAA4E;AAE5E,MAAa,gBAAgB;IAqB1B,YAAoB,SAA4B,EAAU,UAAqB;QAA3D,cAAS,GAAT,SAAS,CAAmB;QAAU,eAAU,GAAV,UAAU,CAAW;QAnBvE,WAAM,GAAiB,OAAO,CAAC,OAAO,EAAE,CAAC;QACzC,WAAM,GAAG,IAAI,uCAAiB,EAAE,CAAC;IAmBzC,CAAC;IAjBD,IAAW,MAAM;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,IAAW,aAAa;QACrB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;IACvC,CAAC;IAED,IAAW,GAAG;QACX,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC;IAC7B,CAAC;IAED,IAAW,GAAG;QACX,OAAO,I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,IAAI,CAAC,CAAC;gBACpC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;gBAC1B,MAAM,OAAO,GAAG,qBAAK,CAAC,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;gBAEnD,OAAO,CAAC,MAAO,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,CAALine truncated
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { GitExecutorEnv, outputHandler, SimpleGitExecutor, SimpleGitTask } from '../types';
|
||||
import { Scheduler } from './scheduler';
|
||||
export declare class GitExecutor implements SimpleGitExecutor {
|
||||
binary: string;
|
||||
cwd: string;
|
||||
private _scheduler;
|
||||
private _chain;
|
||||
env: GitExecutorEnv;
|
||||
outputHandler?: outputHandler;
|
||||
constructor(binary: string, cwd: string, _scheduler: Scheduler);
|
||||
chain(): SimpleGitExecutor;
|
||||
push<R>(task: SimpleGitTask<R>): Promise<void | R>;
|
||||
}
|
||||
Loaded 100 of 276 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user