mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 16:08:34 +02:00
importTreeNow command
This commit is contained in:
parent
d52830f3d2
commit
24b4fcd1cd
7 changed files with 69 additions and 3 deletions
|
@ -248,6 +248,7 @@ var Sandbox = Backbone.View.extend({
|
|||
'build level': this.buildLevel,
|
||||
'export tree': this.exportTree,
|
||||
'import tree': this.importTree,
|
||||
'importTreeNow': this.importTreeNow,
|
||||
'import level': this.importLevel
|
||||
};
|
||||
|
||||
|
@ -269,6 +270,26 @@ var Sandbox = Backbone.View.extend({
|
|||
this.mainVis.show();
|
||||
},
|
||||
|
||||
importTreeNow: function(command, deferred) {
|
||||
var options = command.get('regexResults') || [];
|
||||
if (options.length < 2) {
|
||||
command.set('error', new Errors.GitError({
|
||||
msg: intl.str('git-error-options')
|
||||
}));
|
||||
} else {
|
||||
var string = options.input.replace(/importTreeNow\s+/g, '');
|
||||
try {
|
||||
this.mainVis.gitEngine.loadTreeFromString(string);
|
||||
} catch (e) {
|
||||
command.set('error', new Errors.GitError({
|
||||
msg: String(e)
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
command.finishWith(deferred);
|
||||
},
|
||||
|
||||
importTree: function(command, deferred) {
|
||||
var jsonGrabber = new BuilderViews.MarkdownPresenter({
|
||||
previewText: intl.str('paste-json'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue