summaryrefslogtreecommitdiff
path: root/github.js
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2014-09-14 11:24:20 +0200
committerGubolin <gubolin@fantasymail.de>2014-09-14 11:24:20 +0200
commit7d0c563654d37aa525d4e8cf57edb7b72773083b (patch)
tree0c89b3968d368c654f2f9dee01b367cb8ab9f6f2 /github.js
parent8e20460fed4f35b624b53f4a1ccb3dd48727d544 (diff)
downloadsnap-7d0c563654d37aa525d4e8cf57edb7b72773083b.tar.gz
snap-7d0c563654d37aa525d4e8cf57edb7b72773083b.zip
WIP
Diffstat (limited to 'github.js')
-rw-r--r--github.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/github.js b/github.js
index 0dc6ab5..c66ddc7 100644
--- a/github.js
+++ b/github.js
@@ -150,7 +150,8 @@ GitHubBackend.prototype.saveProject = function (commitMessage, parentCommitSha,
var exists = false;
projects.forEach(function (project) {
- if (project.ProjectName.indexOf(repoName) > -1) {
+ if (project.ProjectName.indexOf(repoName) > -1) { // FIXME 1) create "Foobar" 2) create "Foo" -> error
+ // indexOf: bad idea
exists = true;
return;
}
@@ -174,11 +175,14 @@ GitHubBackend.prototype.saveProject = function (commitMessage, parentCommitSha,
var parentCode = atob(parentCodeFile.content), parentNotes = atob(parentNotesFile.content);
var headCode = atob(headCodeFile.content), headNotes = atob(headNoteFile.content);
var dmp = new diff_match_patch();
+ var codeDiff, noteDiff;
var codePatch, notePatch;
// diff parent <-> local
- codePatch = dmp.patch_make(parentCode, localCode);
- notePatch = dmp.patch_make(parentNotes, localNotes);
+ codeDiff = dmp.diff_main(parentCode, localCode);
+ noteDiff = dmp.diff_main(parentNotes, localNotes);
+ codePatch = dmp.patch_make(codeDiff);
+ notePatch = dmp.patch_make(noteDiff);
console.log(JSON.stringify(codePatch));//DEBUG
// patch (parent<->local) => head
localCode = dmp.patch_apply(codePatch, headCode);
@@ -271,7 +275,6 @@ GitHubBackend.prototype.saveProject = function (commitMessage, parentCommitSha,
} else {
pushChanges(data, parentCommitSha);
}
-
},
function (error) {
errorCall.call(null, error, 'GitHub');