Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

File watchers and caching #6198

Merged
merged 105 commits into from
Jan 8, 2014
Merged
Changes from 1 commit
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
ec18bce
Cache file contents; add hash property to stats; reject writes for in…
Nov 12, 2013
d5893e5
Use the FileSystem from the testWindow when possible
Nov 14, 2013
8a80572
Only update the file hash on read or write; add blind write support.
Nov 15, 2013
a3fbbe5
Only cache stats and contents for watched entries
Nov 16, 2013
277f6f7
Add file caching unit tests
Nov 18, 2013
771e73c
work in progress
Nov 21, 2013
0ea50d4
Do not exec until connection is open and domains have been loaded; ad…
Nov 21, 2013
9c7d7d7
work in progress, moving synthetic events out of the impl and up to t…
Nov 22, 2013
24e3686
Clean up + some unit test fixes
Nov 24, 2013
32c37c0
Do not catch exceptions thrown by Directory.getContents callbacks
Nov 25, 2013
3c1e7b3
Include added and removed sets in change events
Nov 25, 2013
57f3085
Update search results using filesystem change event added and removed…
Nov 25, 2013
f565420
Add unified recursive or explicit watch and unwatch support
Nov 26, 2013
de3f169
Save As should always allow blind writes
Nov 26, 2013
94a23b8
Initial support for FSEvents-based change notifications
Nov 26, 2013
fdc6e5f
Fix unit tests that broke with the watcher changes
Nov 26, 2013
7413a2d
Add an offline callback for impl to call when all watchers should be …
Nov 27, 2013
f628555
Explicitly filter files using shouldShow in findAllFiles in case the …
Nov 27, 2013
842656b
Stub out the _fileSystemChange function for @jasonsanjose
Nov 27, 2013
e050826
Cache stats and directory contents (but not file contents, for space …
Nov 27, 2013
9a9e63b
Update the dualWrite tests to reflect the fact that synthetic change …
Nov 27, 2013
7b296e6
Fire a wholesale change event if watchers go offline
Nov 28, 2013
75ad54f
Set an inactive watched root before watching and activate it when wat…
Nov 28, 2013
491e3bf
Remove an unnecessary bind
Nov 28, 2013
0fc024e
Remove some dead code
Nov 30, 2013
5ee0387
Add a slightly more useful error message for CONTENTS_MODIFIED
Dec 2, 2013
b63df53
Disable watchers for network drives; document private AppshellFileSys…
Dec 2, 2013
0581be8
Apply both the entry's name and the parent path to the watchedRoot fi…
Dec 2, 2013
ba1d528
Only mark new entries as watched if they are beneath active watched r…
Dec 2, 2013
1ddf393
Always filter getAllFiles using shouldShow in case the project is not…
Dec 3, 2013
6200ec1
Handle a potential race in which the socket has disconnected but the …
Dec 3, 2013
d32b26a
unwatchPath bugfix
Dec 3, 2013
3d40057
Typo in Directory.create
Dec 3, 2013
abe72c5
Block external changes around the execution of unlink and moveToTrash
Dec 3, 2013
a6939e6
First attempt at extracting filesystem state updates from change noti…
Dec 4, 2013
63ceeb0
When updating search results as a result of filesystem changes, inclu…
Dec 4, 2013
6dbcea2
Improved factoring of change handling and event firing
Dec 5, 2013
a8941da
wire up the project tree to FileSystem change events
jasonsanjose Dec 5, 2013
4dbfacc
Merge pull request #6190 from adobe/jasonsanjose/file-watchers
iwehrman Dec 6, 2013
d1de067
Remove a superfluous argument applied to the _handleDirectoryChange c…
iwehrman Dec 6, 2013
fdf0bdd
Merge branch 'brackets' into iwehrman/file-watchers
Dec 6, 2013
9fb030d
Only remove entries from the index after unwatch, not after _unwatchE…
Dec 6, 2013
28a655a
Fix the rename unit test
Dec 6, 2013
ec57b00
Do not swallow directory change events if there are no added or remov…
Dec 8, 2013
b7a1f6b
Do not insert new tree nodes when the search for the parent node retu…
Dec 8, 2013
f4e5517
Serialize changes to the file tree; don't expand nodes to add children
Dec 9, 2013
77a35d8
Remove no-longer-useful logging statements
Dec 9, 2013
c6967bd
Added documentation to FileSystemEntry and AppshellFileSystem.
Dec 10, 2013
b636495
Try again to squash the duplicate-tree-nodes bug caused by ProjectMan…
iwehrman Dec 12, 2013
998317d
Add a rough FILE_SAVE dialog customized for CONTENTS_MODIFIED errors
Dec 13, 2013
be0645b
Allow FileSystemEntry objects to become unwatched. (Previously, unwat…
Dec 16, 2013
e37614d
Fix a problem with the InMemoryFile prototypical inhertance chain
Dec 16, 2013
f3d831b
Merge branch 'brackets' into iwehrman/file-watchers
Dec 16, 2013
a724116
Add additional event ordering tests
Dec 16, 2013
188ac33
Rename watchResults/writeCount to externalChanges/externalChangeCount…
Dec 17, 2013
5f16cd9
Add stub MockFileSystemImpl.recursiveWatch as a reminder to implement…
Dec 17, 2013
9fbbc35
Filter out image files in the FindInFiles search
Dec 18, 2013
4649341
Replace the _isWatched flag with an _isWatched() method
Dec 18, 2013
afaed1f
Avoid redundant stat calls during readFile when cached stats are avai…
iwehrman Dec 18, 2013
228aa0b
Only store cached data for watched files; always return cached data w…
Dec 18, 2013
b844177
Always save the file hash, even when not watched.
Dec 18, 2013
e91be35
Show the fullPath in the contents modified error dialog
Dec 18, 2013
f4fd368
Fix a typo and remove a superfluous console.info statement
Dec 18, 2013
8634380
Make the options parameter to readFile and writeFile mandatory
Dec 18, 2013
c3fb961
Merge branch 'brackets' into iwehrman/file-watchers
Dec 18, 2013
4132060
Replace NodeConnection with NodeDomain
Dec 18, 2013
de6e962
Type error in _unwatchAll: unwatch takes a FileSystemEntry, not a path
Dec 18, 2013
2856bb0
include FileWatcherDomain in build
jasonsanjose Dec 18, 2013
cafec66
Address a first round of review comments
iwehrman Dec 18, 2013
62e307a
Fix the watchPath/unwatchPath bind inside watchOrUnwatchEntry
iwehrman Dec 19, 2013
49f99b2
Add documentation about our use of fsevents versus fs.watch for file …
iwehrman Dec 19, 2013
71d27e4
Always make sure to clear cached data after unwatch; add a test to co…
Dec 19, 2013
8c39036
Do not remove entries from the index when watchers go offline; test t…
Dec 19, 2013
52cabdd
More fixes from the review: remove extra argument to watchOrUnwatch, …
Dec 19, 2013
896188f
Factor out a MockFileSystemModel from the MockFileSystemImpl to make …
Dec 20, 2013
ae7f28b
Add some basic tests for external change events
Dec 20, 2013
54cec57
Address more review comments
Dec 20, 2013
aa09120
Merge branch 'brackets' into iwehrman/file-watchers
Dec 21, 2013
45ffc1c
Additional external change event unit tests
Dec 25, 2013
b6fbdeb
Exclude all binary files from FindInFiles, not just images
Dec 26, 2013
f30a4eb
Error handling for missing Entry during change event
jasonsanjose Jan 2, 2014
e42f3db
Hack around a file tree race condition in the ProjectManager integrat…
Jan 2, 2014
a790803
Merge branch 'iwehrman/file-watchers' of https://github.com/adobe/bra…
Jan 2, 2014
a7a551d
Add an allFiles cache, used by getAllFiles, to ensure that there is a…
Jan 3, 2014
febbfe6
Allow Directory objects to cache their contents even while watchers a…
iwehrman Jan 3, 2014
68eef10
Improved optional parameter initialization in File.write and FileSyst…
iwehrman Jan 3, 2014
e1a3614
Make SpecRunnerUtils.createTextFile writes blind because overwriting …
Jan 3, 2014
2914b98
maintain selection in refreshFileTree
jasonsanjose Jan 6, 2014
4f07182
Delay the promise resolution until after we find a tree node withe se…
Jan 6, 2014
6262021
Merge branch 'iwehrman/file-watchers' into jasonsanjose/file-watchers
jasonsanjose Jan 6, 2014
52f8ed3
Merge branch 'jasonsanjose/file-watchers' of https://github.com/adobe…
jasonsanjose Jan 6, 2014
1d608b2
Always resolve refreshFileTree when _loadProject succeeds
jasonsanjose Jan 6, 2014
8de072b
Merge pull request #6382 from adobe/jasonsanjose/file-watchers
iwehrman Jan 6, 2014
3cc8955
Share temp project for ProjectManager-test. Code cleanup.
jasonsanjose Jan 7, 2014
63896e6
Bump a few timeouts in the DCH tests to account for additional Projec…
Jan 7, 2014
c2caa78
Merge pull request #6384 from adobe/jasonsanjose/file-watchers
iwehrman Jan 7, 2014
af2b4ea
Bump a few timeouts in the ProjectManager tests to account for additi…
Jan 7, 2014
d0d5648
Really REALLY bump up the timeouts
Jan 7, 2014
7e517ee
Bump up timeouts to account for additional Project Manager synchroniz…
Jan 7, 2014
26309a5
Fix selection update after fs change event. Remove unnecessary update…
jasonsanjose Jan 7, 2014
c2680b0
fix check for added and removed files in fs change event handler
jasonsanjose Jan 7, 2014
db45700
Merge pull request #6398 from adobe/jasonsanjose/file-watchers
iwehrman Jan 7, 2014
5a91580
Don't refresh the file tree on change events for directories outside …
Jan 7, 2014
3d821fe
Use Brackets shell for copying files to reduce the number of external…
Jan 8, 2014
6e0c286
Revert LiveDev timeout changes
Jan 8, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions test/spec/LiveDevelopment-test.js
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ define(function (require, exports, module) {
function openLiveDevelopmentAndWait() {
// start live dev
runs(function () {
waitsForDone(LiveDevelopment.open(), "LiveDevelopment.open()", 15000);
waitsForDone(LiveDevelopment.open(), "LiveDevelopment.open() 1", 60000);
});
}

@@ -98,7 +98,7 @@ define(function (require, exports, module) {

// save the file
var fileSavePromise = CommandManager.execute(Commands.FILE_SAVE, {doc: doc});
waitsForDone(fileSavePromise, "FILE_SAVE", 1000);
waitsForDone(fileSavePromise, "FILE_SAVE", 5000);

// wrap with a timeout to indicate loadEventFired was not fired
return Async.withTimeout(deferred.promise(), 2000);
@@ -112,13 +112,13 @@ define(function (require, exports, module) {

runs(function () {
spyOn(Inspector.Page, "reload");
waitsForDone(SpecRunnerUtils.openProjectFiles([htmlFile]), "SpecRunnerUtils.openProjectFiles " + htmlFile, 1000);
waitsForDone(SpecRunnerUtils.openProjectFiles([htmlFile]), "SpecRunnerUtils.openProjectFiles " + htmlFile, 10000);
});

openLiveDevelopmentAndWait();

runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles([cssFile]), "SpecRunnerUtils.openProjectFiles " + cssFile, 1000);
waitsForDone(SpecRunnerUtils.openProjectFiles([cssFile]), "SpecRunnerUtils.openProjectFiles " + cssFile, 10000);
});

runs(function () {
@@ -378,7 +378,7 @@ define(function (require, exports, module) {
});
});

waitsFor(function () { return (fileContent !== null); }, "Load fileContent", 1000);
waitsFor(function () { return (fileContent !== null); }, "Load fileContent", 5000);
}
}

@@ -547,7 +547,7 @@ define(function (require, exports, module) {

// copy files to temp directory
runs(function () {
waitsForDone(SpecRunnerUtils.copy(testPath, tempDir), "copy temp files");
waitsForDone(SpecRunnerUtils.copyPath(testPath, tempDir), "copy temp files");
});

// open project
@@ -569,7 +569,7 @@ define(function (require, exports, module) {
it("should establish a browser connection for an opened html file", function () {
//open a file
runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), "SpecRunnerUtils.openProjectFiles simple1.html", 1000);
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), "SpecRunnerUtils.openProjectFiles simple1.html", 10000);
});

openLiveDevelopmentAndWait();
@@ -585,12 +585,12 @@ define(function (require, exports, module) {
it("should should not start a browser connection for an opened css file", function () {
//open a file
runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.css"]), "SpecRunnerUtils.openProjectFiles simple1.css", 1000);
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.css"]), "SpecRunnerUtils.openProjectFiles simple1.css", 10000);
});

//start live dev
runs(function () {
waitsForFail(LiveDevelopment.open(), "LiveDevelopment.open()", 10000);
waitsForFail(LiveDevelopment.open(), "LiveDevelopment.open() 2", 30000);
});

runs(function () {
@@ -617,7 +617,7 @@ define(function (require, exports, module) {
browserText;

runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.css"]), "SpecRunnerUtils.openProjectFiles simple1.css", 1000);
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.css"]), "SpecRunnerUtils.openProjectFiles simple1.css", 10000);
});

runs(function () {
@@ -631,7 +631,7 @@ define(function (require, exports, module) {
});

runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), "SpecRunnerUtils.openProjectFiles simple1.html", 1000);
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), "SpecRunnerUtils.openProjectFiles simple1.html", 10000);
});

openLiveDevelopmentAndWait();
@@ -665,7 +665,7 @@ define(function (require, exports, module) {
spyOn(Inspector.Page, "reload").andCallThrough();
enableAgent(LiveDevelopment, "dom");

waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.css"]), "SpecRunnerUtils.openProjectFiles simple1.css", 1000);
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.css"]), "SpecRunnerUtils.openProjectFiles simple1.css", 10000);
});

runs(function () {
@@ -679,7 +679,7 @@ define(function (require, exports, module) {
});

runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), "SpecRunnerUtils.openProjectFiles simple1.html", 1000);
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), "SpecRunnerUtils.openProjectFiles simple1.html", 10000);
});

// Modify some text in test file before starting live dev
@@ -742,7 +742,7 @@ define(function (require, exports, module) {

function _openSimpleHTML() {
runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), "SpecRunnerUtils.openProjectFiles simple1.html", 1000);
waitsForDone(SpecRunnerUtils.openProjectFiles(["simple1.html"]), "SpecRunnerUtils.openProjectFiles simple1.html", 10000);
});

openLiveDevelopmentAndWait();
@@ -851,7 +851,7 @@ define(function (require, exports, module) {
saveDeferred.resolve();
});
CommandManager.execute(Commands.FILE_SAVE, { doc: doc });
waitsForDone(saveDeferred.promise(), "file finished saving");
waitsForDone(saveDeferred.promise(), "file finished saving", 5000);
});

runs(function () {
@@ -874,7 +874,7 @@ define(function (require, exports, module) {
spyOn(Inspector.Page, "reload").andCallThrough();

promise = SpecRunnerUtils.openProjectFiles(["simple1.html"]);
waitsForDone(promise, "SpecRunnerUtils.openProjectFiles simple1.html", 1000);
waitsForDone(promise, "SpecRunnerUtils.openProjectFiles simple1.html", 10000);
});

openLiveDevelopmentAndWait();
@@ -885,7 +885,7 @@ define(function (require, exports, module) {
jsdoc = openDocs["simple1.js"];
});

waitsForDone(promise, "SpecRunnerUtils.openProjectFiles simple1.js", 1000);
waitsForDone(promise, "SpecRunnerUtils.openProjectFiles simple1.js", 10000);
});

runs(function () {
@@ -1016,7 +1016,7 @@ define(function (require, exports, module) {

function loadFile(fileToLoadIntoEditor) {
runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles([fileToLoadIntoEditor]), "SpecRunnerUtils.openProjectFiles " + fileToLoadIntoEditor);
waitsForDone(SpecRunnerUtils.openProjectFiles([fileToLoadIntoEditor]), "SpecRunnerUtils.openProjectFiles " + fileToLoadIntoEditor, 10000);
});
}

@@ -1029,7 +1029,7 @@ define(function (require, exports, module) {
SpecRunnerUtils.loadProjectInTestWindow(testPath + "/static-project-1");

runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles([indexFile]), "SpecRunnerUtils.openProjectFiles " + indexFile);
waitsForDone(SpecRunnerUtils.openProjectFiles([indexFile]), "SpecRunnerUtils.openProjectFiles " + indexFile, 10000);
});

runs(function () {
@@ -1201,7 +1201,7 @@ define(function (require, exports, module) {
SpecRunnerUtils.loadProjectInTestWindow(testPath + "/dynamic-project-1");

runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles([indexFile]), "SpecRunnerUtils.openProjectFiles " + indexFile);
waitsForDone(SpecRunnerUtils.openProjectFiles([indexFile]), "SpecRunnerUtils.openProjectFiles " + indexFile, 10000);
});

runs(function () {