Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}).then(refs => {
// console.log("FOUND REFS: " + refs);
let walk = Git.Revwalk.create(repo);
refs.forEach(ref => {
let code = walk.pushRef(ref);
if (code) logError("Problem adding reference to Git Revwalk: " + ref, null);
});
walk.sorting(Git.Revwalk.SORT.TIME);
return walk.getCommits(maxCount); // maximum # of commits to retrieve
});
}
}).then(refs => {
// console.log("FOUND REFS: " + refs);
let walk = Git.Revwalk.create(repo);
refs.forEach(ref => {
let code = walk.pushRef(ref);
if (code) logError("Problem adding reference to Git Revwalk: " + ref, null);
});
walk.sorting(Git.Revwalk.SORT.TIME);
return walk.getCommits(maxCount); // maximum # of commits to retrieve
});
}
exports.getClosePushedCommit = co.wrap(function*(repo, remoteName, commit) {
assert.instanceOf(repo, NodeGit.Repository);
assert.isString(remoteName);
assert.instanceOf(commit, NodeGit.Commit);
// Search for the first commit that is not an ancestor of a remote ref, ie.
// the first commit that is unpushed. First by topological, then resolving
// by timestamp.
const walk = NodeGit.Revwalk.create(repo);
walk.sorting(NodeGit.Revwalk.SORT.TOPOLOGICAL,
NodeGit.Revwalk.SORT.TIME,
NodeGit.Revwalk.SORT.REVERSE);
walk.hideGlob(`refs/remotes/${remoteName}`);
walk.push(commit);
// This occurs when walk.next() has no commits left -- in this case,
// when there are no unpushed commits. Return the passed commit as the
// last pushed commit.
let firstNewOid;
try {
firstNewOid = yield walk.next();
} catch (err) {
if (NodeGit.Error.CODE.ITEROVER === err.errno) {
return commit;
}
for (var i = 0 ; i < keys.length; i++) {
for (var j = 0; j < commitJSONs[keys[i]].Parents.length; j++) {
if (commitJSONs[keys[i]].Parents[j].Name === missing[0]) {
commitJSONs[keys[i]].Parents[j] = createParentJSON(candidate.sha(), fileDir);
}
}
}
// remove the resolved commit
missing.shift();
if (missing.length === 0) {
sendResponse();
} else {
// still more to go, resolve the next one
revWalk = repo.createRevWalk();
revWalk.sorting(git.Revwalk.SORT.TOPOLOGICAL);
revWalk.push(missing[0]);
return resolveParents(missing, keep, ignore);
}
}
})
.catch(function(error) {
revs(order = Git.Revwalk.SORT.REVERSE) {
return Git.Repository
.open(".")
.then(repo => repo.getMasterCommit().then(master => ([repo, master])))
.then(([repo, master]) => {
let walker = repo.createRevWalk()
walker.push(master.sha())
walker.sorting(order)
return walker.fileHistoryWalk(this.location, 1000)})
}
}
async getHistory(fileNames, { revision, maxCount = 1000 } = {}) {
fileNames = Array.isArray(fileNames) ? fileNames : [fileNames];
const sha = revision || (await this._repo.getMasterCommit()).sha();
const walker = this._repo.createRevWalk();
walker.sorting(Git.Revwalk.SORT.TIME);
const historyEntries = await mapSeries(fileNames, (fileName) => {
walker.push(sha);
return walker.fileHistoryWalk(fileName, maxCount);
});
const mapEntry = ({ commit }) => ({
sha: commit.sha(),
author: commit.author().name(),
date: commit.date(),
message: commit.message(),
});
const uniqSort = R.pipe(
R.flatten,
R.map(mapEntry),
}).then(function(firstCommitOnMaster){
var walker = repo.createRevWalk();
walker.push(firstCommitOnMaster.sha());
walker.sorting(nodegit.Revwalk.SORT.Time);
return walker.fileHistoryWalk(filepath.toString(), 500);
}).then(continueSearch).then(function(result){
return result.map(function(entry){
async function getHistory(repo, commit, numCommits) {
const commitId = typeof commit === "Commit" ? commit.id() : commit;
const walker = nodegit.Revwalk.create(repo);
walker.sorting(nodegit.Revwalk.SORT.TIME);
walker.push(commitId);
return walker.getCommits(numCommits);
}
function getCommits() {
if (Repo && window) {
let walker = NodeGit.Revwalk.create(Repo);
walker.sorting(NodeGit.Revwalk.SORT.TOPOLOGICAL, NodeGit.Revwalk.SORT.TIME);
walker.pushGlob('*');
let stashes = [];
return NodeGit.Stash.foreach(Repo, (index, msg, id) => {
stashes.push(id.toString());
walker.push(id);
}).then(() => {
return walker.getCommits(500).then(res => {
let commits = [];
let stashIndicies = [];
res.forEach(x => {
let stashIndex = -1;
let isStash = false;
let parents = x.parents().map(p => p.toString());
if (stashes.indexOf(x.sha()) !== -1) {
isStash = true;
function getCommits() {
if (Repo && window) {
let walker = NodeGit.Revwalk.create(Repo);
walker.sorting(NodeGit.Revwalk.SORT.TOPOLOGICAL, NodeGit.Revwalk.SORT.TIME);
walker.pushGlob('*');
let stashes = [];
return NodeGit.Stash.foreach(Repo, (index, msg, id) => {
stashes.push(id.toString());
walker.push(id);
}).then(() => {
return walker.getCommits(500).then(res => {
let commits = [];
let stashIndicies = [];
res.forEach(x => {
let stashIndex = -1;
let isStash = false;
let parents = x.parents().map(p => p.toString());
if (stashes.indexOf(x.sha()) !== -1) {
isStash = true;
parents = [x.parents()[0].toString()];