Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function filesToCommit(path) {
const simpleGit = new SimpleGit(path);
const gitDiff = promisify(simpleGit.diff, simpleGit);
return gitDiff(['--name-status', '--cached'])
.then(output => {
return output
.split('\n')
.filter(line => line.trim().length > 0) // Ignore blank lines
.map(line => line.trim().split('\t'))
.map(parts => {
const status = parts[0];
// If a file's been edited, it will only have 2 elements. If it's been renamed it will have
// 3 elements. But in both cases, the last element is the current name of the file.
const name = parts[parts.length - 1];
return { status, name };
})
.filter(file => file.status !== 'D'); // Ignore deleted files
if( options.remote == undefined )
options.remote = obj.remote
}
var directory = path.join(__dirname,"/logs");
var gitDirectory = path.join(directory, ".git");
var dataFile = path.join(directory, "pomodoro.json");
var gh_pages = path.join(directory, "www")
// Save message to repo.
if( options.remote )
{
// starting a new repo
if( !fs.existsSync( gitDirectory ) )
{
require('simple-git')()
.clone(options.remote,directory, function (err)
{
// done.
commitLogMessage();
});
}
else
{
// update repo and when there are changes, pull changes
require('simple-git')(directory)
.pull(function(err, update)
{
if(update && update.summary.changes)
{
console.log( "pulled latest")
}
if( options.remote == undefined )
options.remote = obj.remote
}
var directory = path.join(__dirname,"/logs");
var gitDirectory = path.join(directory, ".git");
var dataFile = path.join(directory, "pomodoro.json");
var gh_pages = path.join(directory, "www")
// Save message to repo.
if( options.remote )
{
// starting a new repo
if( !fs.existsSync( gitDirectory ) )
{
require('simple-git')()
.clone(options.remote,directory, function (err)
{
// done.
commitLogMessage();
});
}
else
{
// update repo and when there are changes, pull changes
require('simple-git')(directory)
.pull(function(err, update)
{
if(update && update.summary.changes)
{
console.log( "pulled latest")
}
const mergeCmd = [
'merge',
'--no-commit',
'--no-ff',
syncPath
];
let mergeResult;
try {
mergeResult = await exec('git', mergeCmd).stdout;
} catch (e) {
console.log(e.stderr);
mergeResult = parseMerge(e.stdout);
}
if ((mergeResult.conflicts || []).length) {
console.log('Sync: Syncing was not successful! There might be some merge' +
'conflicts which have to be fixed before.');
// exclude files that should not be synced
const result = await excludeFilesFromMerge({
conflicts: mergeResult.conflicts,
files: [
'client/src/app/tabs/dmn/',
'client/src/app/tabs/cmmn/',
'client/test/mocks/cmmn-js/',
'client/test/mocks/dmn-js/',
'client/src/app/tabs/bpmn/modeler/features/apply-default-templates/',
async function assertGitWorktreeClean() {
let status = await git().status();
if (status.files.length > status.not_added.length) {
throw new CLIError(`\
You have modifications to your git worktree.
Please revert or commit them before running convert.`);
} else if (status.not_added.length > 0) {
console.log(`\
Warning: the following untracked files are present in your repository:
${status.not_added.join('\n')}
Proceeding anyway.
`);
}
}
export async function closure(context: IGeneratorDictionary) {
const git = simplegit(context.destinationPath());
try {
const checkIsRepo = await git.checkIsRepo();
if (checkIsRepo) {
console.log(
chalk`{grey - This project is already setup as a git repo; doing nothing more}`
);
} else {
console.log(
chalk`{grey - this project has {italic not yet} been setup as a git repository}`
);
await git.init();
console.log(
chalk`- This project has been registered as a {bold git} project`
);
message += `\n\n${differentialRevisionLine}`;
await git().commit(message, ['--amend']);
}
}
}
console.log(`Creating merge commit on ${remoteBranch}`);
let cherryPickHeadCommit = (await git().revparse(['HEAD'])).trim();
await git().checkout(remoteBranch);
let mergeMessage = `Merge decaffeinate changes into ${remoteBranch}`;
if (phabricatorAware) {
mergeMessage += `\n\n${differentialRevisionLine}`;
}
await git().mergeFromTo(cherryPickHeadCommit, 'HEAD', ['--no-ff']);
await git().commit(mergeMessage, ['--amend']);
if (phabricatorAware) {
console.log('Pulling commit message from Phabricator.');
await exec('arc amend');
}
console.log('');
console.log('Done. Please verify that the git history looks right.');
console.log('You can push your changes with a command like this:');
console.log(`git push ${remote} HEAD:${upstreamBranch}`);
console.log('If you get a conflict, you should re-run "bulk-decaffeinate land".');
}
del(localFolder).then(() => {
git()
.silent(true)
.clone(repoURL, localFolder)
.then(() => git(localFolder).checkout('heroku'))
.then(() => del([`${localFolder}/**/*`]))
.then(() => fs.copy(localDist, localFolder))
.then(() => git(localFolder).add(['--all', '.']))
.then(() => git(localFolder).commit('heroku updated'))
.then(() => git(localFolder).push('origin', 'heroku'))
.catch(err => console.error('failed: ', err));
});
} else {
del(localFolder).then(() => {
git()
.silent(false)
.clone(repoURL, localFolder)
.then(() => git(localFolder).checkout('stable'))
.then(() => del([`${localFolder}/**/*`]))
.then(() => fs.copy(localDist, localFolder))
.then(() => git(localFolder).add(['--all', '.']))
.then(() => git(localFolder).commit('stable updated'))
.then(() => git(localFolder).push('origin', 'stable'))
.catch(err => console.error('failed: ', err));
});
} else {
export var CloneAndAddToIDE = function (path, gitUrl){
var pieces = gitUrl.replace(".git","").split("/");
var extensionName = pieces[pieces.length-1];
var fullPath = path + "/Extensions/" + extensionName;
console.log("Git Url : " + gitUrl);
console.log("Full path : " + fullPath);
require('simple-git')()
.clone(gitUrl, fullPath, function(err){
if(err){
ShowLoading("Extesnion doesn't exists.", true);
ShowErrorDialog("Error", "Repository doesn't exists");
}
})
.then(function() {
ShowLoading('Verifying extension...');
var AllFiles = GetAllFilesFromPath(fullPath);
var extName = GetActionName(AllFiles);
AddFileInXcode(AllFiles,path,extName);
var dep = GetDependencies(AllFiles);
if(dep != null && dep.length > 0){
InjectCocoapodsDependencies(path, dep);
}else {
ShowLoading('Completed...', true);