本文整理汇总了TypeScript中nodegit.Clone.clone方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Clone.clone方法的具体用法?TypeScript Clone.clone怎么用?TypeScript Clone.clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nodegit.Clone
的用法示例。
在下文中一共展示了Clone.clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: rateLimit
promises.push((async () => {
const dir = path.join('repos', ghRepo.name);
let repo: nodegit.Repository;
if (existsSync(dir)) {
repo = await nodegit.Repository.open(dir);
} else {
await rateLimit(100);
repo = await nodegit.Clone.clone(ghRepo.clone_url, dir, undefined);
}
let skipThisElement = false;
if (opts.branchToFix !== 'master') {
let ref = undefined;
try {
ref = await repo.getBranch(`refs/remotes/origin/${opts.branchToFix}`);
} catch (_) {
skipThisElement = true;
}
if (ref) {
const commit = await repo.getReferenceCommit(ref);
const branch =
await nodegit.Branch.create(repo, opts.branchToFix, commit, 1);
await repo.checkoutBranch(branch);
}
}
if (skipThisElement) {
return undefined;
}
return new ElementRepo({repo, dir, ghRepo, analyzer: null});
})());
示例2: downloadFunc
function downloadFunc(cloneURL, localPath) {
let fullLocalPath = require("path").join(__dirname, localPath);
let options = {};
displayModal("Cloning Repository...");
options = {
fetchOpts: {
callbacks: {
certificateCheck: function() { return 1; },
credentials: function() {
return cred;
}
}
}
};
console.log("cloning into " + fullLocalPath);
let repository = Git.Clone.clone(cloneURL, fullLocalPath, options)
.then(function(repository) {
console.log("Repo successfully cloned");
updateModalText("Clone Successful, repository saved under: " + fullLocalPath);
addCommand("git clone " + cloneURL + " " + localPath);
repoFullPath = fullLocalPath;
repoLocalPath = localPath;
refreshAll(repository);
},
function(err) {
updateModalText("Clone Failed - " + err);
console.log(err); // TODO show error on screen
});
}
示例3: downloadFunc
function downloadFunc(cloneURL, fullLocalPath) {
console.log("Path of cloning repo: " + fullLocalPath);
let progressDiv = document.getElementById("cloneProgressDiv");
progressDiv.style.visibility = "visible";
let options = {};
options = {
fetchOpts: {
callbacks: {
certificateCheck: function () {
return 1;
},
credentials: function () {
return Git.Cred.userpassPlaintextNew(getUsernameTemp(), getPasswordTemp());
},
transferProgress: function (data) {
let bytesRatio = data.receivedObjects() / data.totalObjects();
updateProgressBar(bytesRatio);
}
}
}
};
console.log("cloning into " + fullLocalPath);
let repository = Git.Clone.clone(cloneURL, fullLocalPath, options)
.then(function (repository) {
progressDiv.style.visibility = 'collapse';
updateProgressBar(0);
console.log("Repo successfully cloned");
document.getElementById('spinner').style.display = 'block';
refreshAll(repository);
updateModalText("Clone Successful, repository saved under: " + fullLocalPath);
addCommand("git clone " + cloneURL + " " + fullLocalPath);
repoFullPath = fullLocalPath;
repoLocalPath = fullLocalPath;
document.getElementById('spinner').style.display = 'block';
refreshAll(repository);
switchToMainPanel();
},
function (err) {
updateModalText("Clone Failed - " + err);
console.log("repo.ts, line 64, failed to clone repo: " + err); // TODO show error on screen
switchToAddRepositoryPanel();
});
}
示例4:
() => nodegit.Clone.clone(ghRepo.clone_url, dir, null));