Resolve conflicts on all clients when one client resolves it

pull/333/head
Tim Robinson 2016-06-21 21:51:14 +00:00
rodzic 8e02fc257c
commit 27823aa4e1
2 zmienionych plików z 21 dodań i 7 usunięć

Wyświetl plik

@ -71,7 +71,7 @@
"c9.ide.language.javascript.infer": "#b9c2e4bdb8",
"c9.ide.language.jsonalyzer": "#72954f8da1",
"c9.ide.language.codeintel": "#4e0a272229",
"c9.ide.collab": "#6bda028b24",
"c9.ide.collab": "#c8cab470b1",
"c9.ide.local": "#9169fec157",
"c9.ide.find": "#a2dfc3e306",
"c9.ide.find.infiles": "#488db22ee1",

Wyświetl plik

@ -154,6 +154,15 @@ define(function(require, exports, module) {
}
});
collab.on("resolveConflict", function (e) {
var tab = tabManager.findTab(e.path);
if (tab) {
var doc = tab.document;
var path = tab.path
resolveConflict(doc, path);
}
})
watcher.on("delete", function(e) {
var tab = tabManager.findTab(e.path);
if (tab)
@ -163,6 +172,12 @@ define(function(require, exports, module) {
/***** Methods *****/
function resolveConflict(doc, path) {
doc.tab.classList.remove("conflict");
delete doc.meta.$merge;
delete changedPaths[path];
}
function addChangedTab(tab, doubleCheckComparisonType) {
// If we already have a dialog open, just update it, but mark the value dirty
if (changedPaths[tab.path]) {
@ -178,6 +193,9 @@ define(function(require, exports, module) {
return;
}
var doc = tab.document;
var path = tab.path;
changedPaths[tab.path] = { tab: tab, resolve: resolve };
// If the terminal is currently focussed, lets wait until
@ -191,14 +209,10 @@ define(function(require, exports, module) {
}
function resolve() {
doc.tab.classList.remove("conflict");
delete doc.meta.$merge;
delete changedPaths[path];
collab.send({type: "RESOLVE_CONFLICT", data: {path: path}});
resolveConflict(doc, path);
}
var doc = tab.document;
var path = tab.path;
switch (doubleCheckComparisonType) {
case comparisonType.TIMESTAMP_AND_CONTENTS:
checkByStatOrContents();