Commit 6f185cfe authored by Ivanq's avatar Ivanq

Include HG everywhere

parent dfffcec2
class Hg {
};
\ No newline at end of file
......@@ -290,7 +290,14 @@ class Repository {
})
.then(() => this.sign());
}
install(title, description, address) {
install(title, description, address, type) {
if(type == "git") {
return this.installGit(title, description, address);
} else if(type == "hg") {
return this.installHg(title, description, address);
}
}
installGit(title, description, address) {
let auth, content;
return this.getContent()
.then(c => {
......@@ -325,6 +332,41 @@ class Repository {
return this.signContent("site");
});
}
installHg(title, description, address) {
let auth, content;
return this.getContent()
.then(c => {
content = c;
return this.zeroAuth.requestAuth();
})
.then(a => {
auth = a;
content.title = title;
content.description = description;
content.signers = [auth.address];
content.installed = true;
content.hg = address;
content.hooks = false;
return this.setContent(content);
})
.then(() => {
return this.zeroFS.readFile("data/users/" + auth.address + "/data.json").catch(() => "{}");
})
.then(profile => {
profile = JSON.parse(profile);
profile.commitName = profile.commitName || auth.user[0].toUpperCase() + auth.user.substr(1).replace(/@.*/, "");
profile.commitEmail = profile.commitEmail || auth.user;
return Hg.init("merged-GitCenter/" + this.address + "/" + address + (address.endsWith(".git") ? "" : ".git"), this.zeroPage, profile.commitName, profile.commitEmail);
})
.then(hg => {
this.hg = hg;
return this.signContent("site");
});
}
fork() {
return this.zeroPage.cmd("siteClone", [this.address])
}
......
......@@ -113,6 +113,7 @@
<script type="text/javascript" src="../../js/sha.js"></script>
<script type="text/javascript" src="../../js/git.js"></script>
<script type="text/javascript" src="../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../js/hg.js"></script>
<script type="text/javascript" src="../../js/repo.js"></script>
<script type="text/javascript" src="../js/path_common.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
......
......@@ -112,6 +112,7 @@
<script type="text/javascript" src="../../js/sha.js"></script>
<script type="text/javascript" src="../../js/git.js"></script>
<script type="text/javascript" src="../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../js/hg.js"></script>
<script type="text/javascript" src="../../js/repo.js"></script>
<script type="text/javascript" src="../js/path_common.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
......
......@@ -114,6 +114,7 @@
<script type="text/javascript" src="../js/sha.js"></script>
<script type="text/javascript" src="../js/git.js"></script>
<script type="text/javascript" src="../workerout/workerout.js"></script>
<script type="text/javascript" src="../js/hg.js"></script>
<script type="text/javascript" src="../js/repo.js"></script>
<script type="text/javascript" src="../marked/marked.js"></script>
<script type="text/javascript" src="../hljs/highlight.min.js"></script>
......
......@@ -94,6 +94,7 @@
<script type="text/javascript" src="../../js/sha.js"></script>
<script type="text/javascript" src="../../js/git.js"></script>
<script type="text/javascript" src="../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../js/hg.js"></script>
<script type="text/javascript" src="../../js/repo.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/user_common.js"></script>
......
......@@ -89,6 +89,7 @@
<script type="text/javascript" src="../../../js/sha.js"></script>
<script type="text/javascript" src="../../../js/git.js"></script>
<script type="text/javascript" src="../../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../../js/hg.js"></script>
<script type="text/javascript" src="../../../js/repo.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/user_common.js"></script>
......
......@@ -107,6 +107,7 @@
<script type="text/javascript" src="../../../js/sha.js"></script>
<script type="text/javascript" src="../../../js/git.js"></script>
<script type="text/javascript" src="../../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../../js/hg.js"></script>
<script type="text/javascript" src="../../../js/repo.js"></script>
<script type="text/javascript" src="../../../marked/marked.js"></script>
<script type="text/javascript" src="../../../hljs/highlight.min.js"></script>
......
......@@ -96,6 +96,7 @@
<script type="text/javascript" src="../../js/sha.js"></script>
<script type="text/javascript" src="../../js/git.js"></script>
<script type="text/javascript" src="../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../js/hg.js"></script>
<script type="text/javascript" src="../../js/repo.js"></script>
<script type="text/javascript" src="../js/path_common.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
......
......@@ -116,6 +116,7 @@
<script type="text/javascript" src="../../js/sha.js"></script>
<script type="text/javascript" src="../../js/git.js"></script>
<script type="text/javascript" src="../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../js/hg.js"></script>
<script type="text/javascript" src="../../js/repo.js"></script>
<script type="text/javascript" src="../js/path_common.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
......
......@@ -94,6 +94,7 @@
<script type="text/javascript" src="../../js/sha.js"></script>
<script type="text/javascript" src="../../js/git.js"></script>
<script type="text/javascript" src="../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../js/hg.js"></script>
<script type="text/javascript" src="../../js/repo.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/user_common.js"></script>
......
......@@ -91,6 +91,7 @@
<script type="text/javascript" src="../../../js/sha.js"></script>
<script type="text/javascript" src="../../../js/git.js"></script>
<script type="text/javascript" src="../../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../../js/hg.js"></script>
<script type="text/javascript" src="../../../js/repo.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/user_common.js"></script>
......
......@@ -112,6 +112,7 @@
<script type="text/javascript" src="../../../js/sha.js"></script>
<script type="text/javascript" src="../../../js/git.js"></script>
<script type="text/javascript" src="../../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../../js/hg.js"></script>
<script type="text/javascript" src="../../../js/repo.js"></script>
<script type="text/javascript" src="../../../marked/marked.js"></script>
<script type="text/javascript" src="../../../hljs/highlight.min.js"></script>
......
......@@ -87,6 +87,7 @@
<script type="text/javascript" src="../../js/sha.js"></script>
<script type="text/javascript" src="../../js/git.js"></script>
<script type="text/javascript" src="../../workerout/workerout.js"></script>
<script type="text/javascript" src="../../js/hg.js"></script>
<script type="text/javascript" src="../../js/repo.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/user_common.js"></script>
......
......@@ -122,6 +122,7 @@
<script type="text/javascript" src="../../js/pako.js"></script>
<script type="text/javascript" src="../../js/sha.js"></script>
<script type="text/javascript" src="../../js/git.js"></script>
<script type="text/javascript" src="../../js/hg.js"></script>
<script type="text/javascript" src="../../js/repo.js"></script>
<script type="text/javascript" src="../../workerout/workerout.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment