Example #1
0
 return Utils.askQuestion(Strings.CLONE_REPOSITORY, Strings.ENTER_REMOTE_GIT_URL).then(function (remoteGitUrl) {
     $gitPanel.find(".git-clone").prop("disabled", true);
     return ProgressDialog.show(Git.clone(remoteGitUrl, "."))
         .then(function () {
             EventEmitter.emit(Events.REFRESH_ALL);
         });
 });
Example #2
0
 q = q.then(function () {
     // fetch the remote first
     return ProgressDialog.show(Git.fetchRemote(pullConfig.remote))
         .then(function () {
             if (pullConfig.strategy === "DEFAULT") {
                 return Git.mergeRemote(pullConfig.remote, pullConfig.branch);
             } else if (pullConfig.strategy === "AVOID_MERGING") {
                 return Git.mergeRemote(pullConfig.remote, pullConfig.branch, true);
             } else if (pullConfig.strategy === "MERGE_NOCOMMIT") {
                 return Git.mergeRemote(pullConfig.remote, pullConfig.branch, false, true);
             } else if (pullConfig.strategy === "REBASE") {
                 return Git.rebaseRemote(pullConfig.remote, pullConfig.branch);
             } else if (pullConfig.strategy === "RESET") {
                 return Git.resetRemote(pullConfig.remote, pullConfig.branch);
             }
         })
         .then(function (result) {
             return ProgressDialog.waitForClose().then(function () {
                 Utils.showOutput(result, Strings.GIT_PULL_RESPONSE);
             });
         })
         .catch(function (err) {
             ErrorHandler.showError(err, "Pulling from remote failed");
         });
 });
 $dialog.on("click", ".fetchBranches", function () {
     ProgressDialog.show(Git.fetchRemote(config.remote))
         .then(function () {
             fillBranches(config, $dialog);
         }).catch(function (err) {
             throw ErrorHandler.showError(err, "Fetching remote information failed");
         });
 });
Example #4
0
 dialog.getElement().find(".fetchBranches").on("click", function () {
     var $this = $(this);
     ProgressDialog.show(Git.fetchAllRemotes())
         .then(function () {
             return Git.getAllBranches().then(function (branches) {
                 $this.prop("disabled", true).attr("title", "Already fetched");
                 _reloadBranchSelect($select, branches);
             });
         }).catch(function (err) {
             throw ErrorHandler.showError(err, "Fetching remote information failed");
         });
 });
Example #5
0
 function _getStagedDiff() {
     return ProgressDialog.show(Git.getDiffOfStagedFiles(),
                                Strings.GETTING_STAGED_DIFF_PROGRESS,
                                { preDelay: 3, postDelay: 1 })
     .then(function (diff) {
         if (!diff) {
             return Git.getListOfStagedFiles().then(function (filesList) {
                 return Strings.DIFF_FAILED_SEE_FILES + "\n\n" + filesList;
             });
         }
         return diff;
     });
 }
Example #6
0
 function _getStagedDiff() {
     return ProgressDialog.show(Git.getDiffOfStagedFiles(),
                                Strings.GETTING_STAGED_DIFF_PROGRESS,
                                { preDelay: 3, postDelay: 1 })
     .catch(function (err) {
         if (ErrorHandler.contains(err, "cleanup")) {
             return false; // will display list of staged files instead
         }
         throw err;
     })
     .then(function (diff) {
         if (!diff) {
             return Git.getListOfStagedFiles().then(function (filesList) {
                 return Strings.DIFF_FAILED_SEE_FILES + "\n\n" + filesList;
             });
         }
         return diff;
     });
 }
Example #7
0
                q = q.then(function () {
                    var op;

                    if (pushConfig.pushToNew) {
                        op = Git.pushToNewUpstream(pushConfig.remote, pushConfig.branch);
                    } else if (pushConfig.strategy === "DEFAULT") {
                        op = Git.push(pushConfig.remote, pushConfig.branch);
                    } else if (pushConfig.strategy === "FORCED") {
                        op = Git.pushForced(pushConfig.remote, pushConfig.branch);
                    } else if (pushConfig.strategy === "DELETE_BRANCH") {
                        op = Git.deleteRemoteBranch(pushConfig.remote, pushConfig.branch);
                    }
                    return ProgressDialog.show(op)
                        .then(function (result) {
                            return ProgressDialog.waitForClose().then(function () {
                                showPushResult(result);
                            });
                        })
                        .catch(function (err) {
                            ErrorHandler.showError(err, "Pushing to remote failed");
                        });
                });
Example #8
0
 queue = queue.then(function () {
     return ProgressDialog.show(Utils.stripWhitespaceFromFiles(files),
                                Strings.CLEANING_WHITESPACE_PROGRESS,
                                { preDelay: 3, postDelay: 1 });
 });
Example #9
0
 q = q.then(function () {
     return ProgressDialog.show(Git.clone(remoteUrl, "."));
 }).catch(function (err) {