Permalink
Browse files

Fixed bug that kept revisions to be loaded for the first time

  • Loading branch information...
1 parent c19be7f commit f2efa51eed2e89b9385703d3d6df085c791a35ea Sergi Mansilla committed Jun 1, 2012
Showing with 10 additions and 3 deletions.
  1. +10 −3 plugins-server/cloud9.ide.revisions/revisions.js
View
13 plugins-server/cloud9.ide.revisions/revisions.js
@@ -108,6 +108,10 @@ require("util").inherits(RevisionsPlugin, Plugin);
self.broadcastConfirmSave(message.path, revisionInfo.revision);
if (message.forceRevisionListResponse === true) {
self.getAllRevisions(revisionInfo.absPath, function(err, revObj) {
+ if (err) {
+ return console.error(err);
+ }
+
self.broadcastRevisions.call(self, revObj, user, {
path: message.path
});
@@ -117,7 +121,8 @@ require("util").inherits(RevisionsPlugin, Plugin);
else {
this.getRevisions(message.path, function(err, revObj) {
if (err) {
- return console.error("There was a problem retrieving the revisions" + " for the file " + message.path + ":\n", err);
+ return console.error("There was a problem retrieving revisions" +
+ " for the file " + message.path + ":\n", err);
}
self.broadcastRevisions.call(self, revObj, null, {
@@ -199,20 +204,22 @@ require("util").inherits(RevisionsPlugin, Plugin);
var error;
var lineCount = 0;
var lines = data.toString().split("\n");
-
if (lines.length) {
Async.whilst(
function () {
- return (lineCount < lines.length && error === null);
+ return lineCount < lines.length && !error;
},
function (next) {
+ var line = lines[lineCount];
+ if (line) {
try {
var revision = JSON.parse(lines[lineCount]);
revObj[revision.ts] = revision;
}
catch(e) {
error = e;
}
+ }
lineCount++;
next();
},

0 comments on commit f2efa51

Please sign in to comment.