summaryrefslogtreecommitdiff
path: root/github.js
diff options
context:
space:
mode:
authorGubolin <gubolin@fantasymail.de>2014-09-14 18:46:07 +0200
committerGubolin <gubolin@fantasymail.de>2014-09-14 18:46:07 +0200
commitc77c46d107a017b188f0ff6b9310cc0d61f2733a (patch)
tree56f8ebbfea737b83f6f9577ed11d38f11cf8297b /github.js
parenta5e84dc86786381b9247c757b5b4e47c02787b8f (diff)
downloadsnap-octokat.tar.gz
snap-octokat.zip
Diffstat (limited to 'github.js')
-rw-r--r--github.js17
1 files changed, 11 insertions, 6 deletions
diff --git a/github.js b/github.js
index cf41e8b..6fabfac 100644
--- a/github.js
+++ b/github.js
@@ -175,15 +175,20 @@ 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();
- dmp.Match_Threshold = 0.1;
- var codeDiff, noteDiff;
+ //dmp.Match_Threshold = 0.1;
+ var codeDiff, codeDiffs;
var codePatch, notePatch;
// diff parent <-> local
- codeDiff = dmp.diff_main(parentCode, localCode);
- noteDiff = dmp.diff_main(parentNotes, localNotes);
- codePatch = dmp.patch_make(codeDiff);
- notePatch = dmp.patch_make(noteDiff);
+ codeDiff = dmp.diff_linesToChars_(parentCode, localCode);
+ console.log('converted ' + JSON.stringify(codeDiff));//DEBUG
+ codeDiffs = dmp.diff_main(codeDiff.chars1, codeDiff.chars2, false);
+ console.log('diffed');//DEBUG
+ dmp.diff_charsToLines_(codeDiffs, codeDiff.lineArray);
+ console.log('creating patch');//DEBUG
+ codePatch = dmp.patch_make(codeDiffs);
+
+ notePatch = dmp.patch_make(parentNotes, localNotes);
console.log(JSON.stringify(codePatch));//DEBUG
// patch (parent<->local) => head
localCode = dmp.patch_apply(codePatch, headCode);