Skip to content

Commit ece033e

Browse files
committed
Merge pull request #294 from zaggino/FezVrasta-git-ftp2
Merge of #288
2 parents 12b21ed + f12eb74 commit ece033e

15 files changed

Lines changed: 276 additions & 232 deletions

File tree

htmlContent/git-panel.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
<div class="btn-group git-available dropup">
4242
<button type="button" class="git-remotes btn small dropdown-toggle" data-toggle="dropdown" title="{{TOOLTIP_PICK_REMOTE}}">
4343
<span class="caret"></span>
44-
<span class="ftp-prefix">FTP: </span>
4544
<span class="git-selected-remote">&mdash;</span>
4645
</button>
4746
<ul class="dropdown-menu git-remotes-dropdown"></ul>
Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
11
<!-- List of remotes defined for the current local repository -->
2-
<li class="dropdown-header">{{Strings.GIT_REMOTES}}</li>
3-
{{#hasRemotes}}
42
{{#remotes}}
53
<li class="remote">
6-
<a href="#" data-remote-name="{{name}}" data-is-gitftp="false">
4+
<a href="#" data-remote-name="{{name}}" data-type="git" class="remote-name">
75
{{#deletable}}<span class="trash-icon remove-remote">&times;</span>{{/deletable}}
86
<span class="change-remote">{{name}}</span>
97
</a>
108
</li>
119
{{/remotes}}
12-
{{/hasRemotes}}
1310
<li><a class="git-remote-new"><span>{{Strings.CREATE_NEW_REMOTE}}</span></a></li>
14-
15-
<!-- List of Git-FTP remotes, used only if Git-FTP is available and enabled -->
16-
{{#gitFtpEnabled}}
17-
<li class="divider"></li>
18-
<li class="dropdown-header">{{Strings.GITFTP_REMOTES}}</li>
19-
{{#hasFtpRemotes}}
20-
{{#ftpRemotes}}
21-
<li class="gitftp-remote">
22-
<a href="#" data-remote-name="{{name}}" data-is-gitftp="true">
23-
<span class="trash-icon gitftp-remove-remote">&times;</span>
24-
<span class="change-remote">{{name}}</span>
25-
</a>
26-
</li>
27-
{{/ftpRemotes}}
28-
{{/hasFtpRemotes}}
29-
<li><a class="gitftp-remote-new"><span>{{Strings.CREATE_NEW_GITFTP_REMOTE}}</span></a></li>
30-
{{/gitFtpEnabled}}

less/brackets-git.less

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,19 +259,11 @@
259259
}
260260
}
261261

262-
[data-is-gitftp=true] .change-remote:before {
262+
a[data-type=ftp] .change-remote:before, span[data-type=ftp]:before {
263263
content: "FTP:";
264264
padding-right: 5px;
265265
opacity: 0.5;
266266
}
267-
.ftp-prefix {
268-
display: none;
269-
padding-right: 5px;
270-
opacity: 0.5;
271-
&[data-is-gitftp=true] {
272-
display: inline;
273-
}
274-
}
275267

276268
.dropdown-menu {
277269
border: none;

main.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,12 @@ define(function (require, exports, module) {
3232
domainModulePath = moduleDirectory + "src/Domains/cli",
3333
nodeConnection = new NodeConnection();
3434

35-
// Load extension sources
36-
require("src/Remotes");
37-
require("src/Ftp"); // TODO: maybe only if FTP is enabled?
35+
// Load extension modules that are not included by core
36+
var modules = ["src/Remotes"];
37+
if (Preferences.get("useGitFtp")) {
38+
modules.push("src/Ftp/Ftp");
39+
}
40+
require(modules);
3841

3942
// Seems just too buggy right now
4043
q.stopUnhandledRejectionTracking();

nls/root/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ define({
133133
TOOLTIP_SHOW_HISTORY: "Show history",
134134
TOOLTIP_PICK_REMOTE: "Pick preferred remote",
135135
TOOLTIP_MORE: "More actions\u2026",
136+
USER_ABORTED: "User aborted!",
136137
UNDO_CHANGES: "Discard changes",
137138
UNDO_LAST_LOCAL_COMMIT: "Undo last local (not pushed) commit",
138139
URL: "URL",

src/Branch.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ define(function (require, exports) {
122122
$this.prop("disabled", true).attr("title", "Already fetched");
123123
_reloadBranchSelect($select, branches);
124124
});
125-
}).fail(function (err) {
125+
}).catch(function (err) {
126126
throw ErrorHandler.showError(err, "Fetching remote information failed");
127127
});
128128
});
@@ -138,7 +138,7 @@ define(function (require, exports) {
138138
isRemote = $option.attr("remote"),
139139
track = !!isRemote;
140140

141-
Main.gitControl.createBranch(branchName, originName, track).fail(function (err) {
141+
Main.gitControl.createBranch(branchName, originName, track).catch(function (err) {
142142
ErrorHandler.showError(err, "Creating new branch failed");
143143
}).then(function () {
144144
closeDropdown();
@@ -152,7 +152,7 @@ define(function (require, exports) {
152152
}).on("click", "a.git-branch-link .switch-branch", function (e) {
153153
e.stopPropagation();
154154
var branchName = $(this).parent().data("branch");
155-
Main.gitControl.checkoutBranch(branchName).fail(function (err) {
155+
Main.gitControl.checkoutBranch(branchName).catch(function (err) {
156156
ErrorHandler.showError(err, "Switching branches failed");
157157
}).then(function () {
158158
closeDropdown();
@@ -164,9 +164,9 @@ define(function (require, exports) {
164164
}).on("mouseleave", "a", function () {
165165
$(this).removeClass("selected");
166166
}).on("click", "a.git-branch-link .trash-icon", function () {
167-
Main.gitControl.deleteLocalBranch($(this).parent().data("branch"))
168-
.fail(function (err) { ErrorHandler.showError(err, "Branch deletion failed"); });
169-
$(this).parent().remove();
167+
Main.gitControl.deleteLocalBranch($(this).parent().data("branch")).catch(function (err) {
168+
ErrorHandler.showError(err, "Branch deletion failed");
169+
});
170170
}).on("click", ".merge-branch", function () {
171171
var fromBranch = $(this).parent().data("branch");
172172
doMerge(fromBranch);
@@ -203,7 +203,7 @@ define(function (require, exports) {
203203

204204
Menus.closeAll();
205205

206-
Git.getBranches().fail(function (err) {
206+
Git.getBranches().catch(function (err) {
207207
ErrorHandler.showError(err, "Getting branch list failed");
208208
}).then(function (branches) {
209209
branches = branches.reduce(function (arr, branch) {
@@ -262,7 +262,7 @@ define(function (require, exports) {
262262
.on("click", toggleDropdown)
263263
.append($("<span class='dropdown-arrow' />"));
264264
Panel.enable();
265-
}).fail(function (ex) {
265+
}).catch(function (ex) {
266266
if (ErrorHandler.contains(ex, "unknown revision")) {
267267
$gitBranchName
268268
.off("click")
@@ -272,7 +272,7 @@ define(function (require, exports) {
272272
throw ex;
273273
}
274274
});
275-
}).fail(function (err) {
275+
}).catch(function (err) {
276276
throw ErrorHandler.showError(err);
277277
});
278278
}

src/ErrorHandler.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ define(function (require, exports) {
7070
);
7171
};
7272

73+
exports.equals = function (err, what) {
74+
return err.toString().toLowerCase() === what.toLowerCase();
75+
};
76+
7377
exports.contains = function (err, what) {
7478
return err.toString().toLowerCase().indexOf(what.toLowerCase()) !== -1;
7579
};

src/Events.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ define(function (require, exports) {
2828
exports.PULL_FINISHED = "pull.finished";
2929
exports.PUSH_STARTED = "push.started";
3030
exports.PUSH_FINISHED = "push.finished";
31+
exports.REMOTES_REFRESH_PICKER = "remotes.refresh.picker";
3132

3233
});

src/Ftp.js

Lines changed: 0 additions & 119 deletions
This file was deleted.

0 commit comments

Comments
 (0)