kopia lustrzana https://github.com/c9/core
Instead of automerging from disk, always prompt user about disk being different and allow them to apply the changes if they like
rodzic
0683fb0711
commit
77338d54e5
|
@ -71,7 +71,7 @@
|
||||||
"c9.ide.language.javascript.infer": "#18acb93a3a",
|
"c9.ide.language.javascript.infer": "#18acb93a3a",
|
||||||
"c9.ide.language.jsonalyzer": "#d8183d84b4",
|
"c9.ide.language.jsonalyzer": "#d8183d84b4",
|
||||||
"c9.ide.language.codeintel": "#fc867feec4",
|
"c9.ide.language.codeintel": "#fc867feec4",
|
||||||
"c9.ide.collab": "#1729d31b92",
|
"c9.ide.collab": "#1ea29be441",
|
||||||
"c9.ide.local": "#10eb45842a",
|
"c9.ide.local": "#10eb45842a",
|
||||||
"c9.ide.find": "#e33fbaed2f",
|
"c9.ide.find": "#e33fbaed2f",
|
||||||
"c9.ide.find.infiles": "#c0a13737ef",
|
"c9.ide.find.infiles": "#c0a13737ef",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
main.consumes = [
|
main.consumes = [
|
||||||
"Plugin", "fs", "settings", "preferences", "watcher", "tabManager",
|
"Plugin", "fs", "settings", "preferences", "watcher", "tabManager",
|
||||||
"save", "dialog.question", "dialog.filechange", "threewaymerge"
|
"save", "dialog.question", "dialog.filechange", "threewaymerge", "collab"
|
||||||
];
|
];
|
||||||
main.provides = ["watcher.gui"];
|
main.provides = ["watcher.gui"];
|
||||||
return main;
|
return main;
|
||||||
|
@ -17,6 +17,7 @@ define(function(require, exports, module) {
|
||||||
var question = imports["dialog.question"];
|
var question = imports["dialog.question"];
|
||||||
var filechange = imports["dialog.filechange"];
|
var filechange = imports["dialog.filechange"];
|
||||||
var threeWayMerge = imports.threewaymerge.merge;
|
var threeWayMerge = imports.threewaymerge.merge;
|
||||||
|
var collab = imports.collab;
|
||||||
|
|
||||||
var collabEnabled = options.collab;
|
var collabEnabled = options.collab;
|
||||||
|
|
||||||
|
@ -119,33 +120,33 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
// Hook watcher events
|
// Hook watcher events
|
||||||
|
|
||||||
// Update a file
|
// A change event sent from the watcher plugin
|
||||||
watcher.on("change", function(e) {
|
watcher.on("change", function(e) {
|
||||||
var tab = tabManager.findTab(e.path);
|
var tab = tabManager.findTab(e.path);
|
||||||
if (tab) {
|
if (tab) {
|
||||||
// If collab picks this up and handles the change it will return false
|
if (collabEnabled && tab.editorType == "ace") {
|
||||||
if (emit("docChange", {tab: tab}) === false)
|
/* If the lastChange (added by collab) was greater than 1 second ago set up a watch
|
||||||
return;
|
To ensure that collab makes this change, if not report an error. The lastChange
|
||||||
|
check is to avoid a race condition if collab updates before this function runs */
|
||||||
|
if (!tab.meta.$lastCollabChange || tab.meta.$lastCollabChange < (Date.now() - 1000)) {
|
||||||
|
if (tab.meta.$collabChangeRegistered) {
|
||||||
|
clearTimeout(tab.meta.$collabChangeRegistered);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
addChangedTab(tab, e.type === "change");
|
addChangedTab(tab, e.type === "change");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Directory watcher is not needed if the normal watcher works
|
collab.on("change", function (e) {
|
||||||
// watcher.on("directory", function(e) {
|
var tab = tabManager.findTab(e.path);
|
||||||
// var base = e.path;
|
if (tab) {
|
||||||
// var files = e.files;
|
addChangedTab(tab, e.type === "change");
|
||||||
//
|
}
|
||||||
// // Rename all tabs
|
});
|
||||||
// tabManager.getTabs().forEach(function(tab) {
|
|
||||||
// if (tab.path && tab.path.indexOf(base) == 0) {
|
|
||||||
// // If the file is gone, lets notify the user
|
|
||||||
// if (files.indexOf(tab.path) == -1) {
|
|
||||||
// resolveFileDelete(tab);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
||||||
watcher.on("delete", function(e) {
|
watcher.on("delete", function(e) {
|
||||||
var tab = tabManager.findTab(e.path);
|
var tab = tabManager.findTab(e.path);
|
||||||
|
|
Ładowanie…
Reference in New Issue