mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 23:48:34 +02:00
wip
This commit is contained in:
parent
e4209c708b
commit
37a9fccec0
9 changed files with 796 additions and 699 deletions
1438
build/bundle.js
1438
build/bundle.js
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
1
build/bundle.min.js
vendored
1
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -46,7 +46,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<i class="icon-home"></i>
|
<i class="icon-home"></i>
|
||||||
<span class="intl-aware" data-intl="learn-git-branching">
|
<span class="vcs-mode-aware intl-aware" data-intl="learn-git-branching">
|
||||||
Learn Git Branching
|
Learn Git Branching
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -445,7 +445,7 @@
|
||||||
For a much easier time perusing the source, see the individual files at:
|
For a much easier time perusing the source, see the individual files at:
|
||||||
https://github.com/pcottle/learnGitBranching
|
https://github.com/pcottle/learnGitBranching
|
||||||
-->
|
-->
|
||||||
<script src="build/bundle.min.4104878e.js"></script>
|
<script src="build/bundle.js"></script>
|
||||||
|
|
||||||
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
||||||
The downside? No raw logs to parse for analytics, so I have to include
|
The downside? No raw logs to parse for analytics, so I have to include
|
||||||
|
|
|
@ -3,6 +3,7 @@ var Backbone = require('backbone');
|
||||||
|
|
||||||
var constants = require('../util/constants');
|
var constants = require('../util/constants');
|
||||||
var util = require('../util');
|
var util = require('../util');
|
||||||
|
var intl = require('../intl');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Globals
|
* Globals
|
||||||
|
@ -41,11 +42,27 @@ var init = function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
events.on('localeChanged', intlRefresh);
|
events.on('localeChanged', intlRefresh);
|
||||||
|
events.on('vcsModeChange', vcsModeRefresh);
|
||||||
|
|
||||||
initRootEvents(eventBaton);
|
initRootEvents(eventBaton);
|
||||||
initDemo(sandbox);
|
initDemo(sandbox);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var vcsModeRefresh = function(eventData) {
|
||||||
|
if (!window.$) { return; }
|
||||||
|
|
||||||
|
var mode = eventData.mode;
|
||||||
|
var displayMode = mode.slice(0, 1).toUpperCase() + mode.slice(1);
|
||||||
|
var otherMode = (displayMode === 'Git') ? 'Hg' : 'Git';
|
||||||
|
var regex = new RegExp(otherMode, 'g');
|
||||||
|
|
||||||
|
document.title = intl.str('learn-git-branching').replace(regex, displayMode);
|
||||||
|
$('span.vcs-mode-aware').each(function(i, el) {
|
||||||
|
var text = $(el).text().replace(regex, displayMode);
|
||||||
|
$(el).text(text);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
var intlRefresh = function() {
|
var intlRefresh = function() {
|
||||||
if (!window.$) { return; }
|
if (!window.$) { return; }
|
||||||
$('span.intl-aware').each(function(i, el) {
|
$('span.intl-aware').each(function(i, el) {
|
||||||
|
|
|
@ -70,6 +70,10 @@ GitEngine.prototype.handleModeChange = function(vcs, callback) {
|
||||||
chain.then(callback);
|
chain.then(callback);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitEngine.prototype.getIsHg = function() {
|
||||||
|
return this.mode === 'hg';
|
||||||
|
};
|
||||||
|
|
||||||
GitEngine.prototype.setMode = function(vcs) {
|
GitEngine.prototype.setMode = function(vcs) {
|
||||||
var switchedToHg = (this.mode === 'git' && vcs === 'hg');
|
var switchedToHg = (this.mode === 'git' && vcs === 'hg');
|
||||||
this.mode = vcs;
|
this.mode = vcs;
|
||||||
|
@ -1214,10 +1218,12 @@ GitEngine.prototype.setTargetLocation = function(ref, target) {
|
||||||
|
|
||||||
GitEngine.prototype.pruneTree = function() {
|
GitEngine.prototype.pruneTree = function() {
|
||||||
var set = this.getUpstreamBranchSet();
|
var set = this.getUpstreamBranchSet();
|
||||||
// dont prune dangling commits if we are on head
|
// dont prune commits that HEAD depends on
|
||||||
var underHeadID = this.getCommitFromRef('HEAD').get('id');
|
var headSet = this.getUpstreamSet('HEAD');
|
||||||
set[underHeadID] = set[underHeadID] || [];
|
console.log(headSet);
|
||||||
set[underHeadID].push('HEAD');
|
_.each(headSet, function(val, commitID) {
|
||||||
|
set[commitID] = true;
|
||||||
|
});
|
||||||
|
|
||||||
var toDelete = [];
|
var toDelete = [];
|
||||||
this.commitCollection.each(function(commit) {
|
this.commitCollection.each(function(commit) {
|
||||||
|
@ -1227,9 +1233,12 @@ GitEngine.prototype.pruneTree = function() {
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
if (toDelete.length) {
|
if (!toDelete.length) {
|
||||||
this.command.addWarning(intl.str('hg-prune-tree'));
|
// returning nothing will perform
|
||||||
|
// the switch sync
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
this.command.addWarning(intl.str('hg-prune-tree'));
|
||||||
|
|
||||||
_.each(toDelete, function(commit) {
|
_.each(toDelete, function(commit) {
|
||||||
commit.removeFromParents();
|
commit.removeFromParents();
|
||||||
|
|
|
@ -19,7 +19,6 @@ var commandConfig = {
|
||||||
],
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
var options = command.getSupportedMap();
|
var options = command.getSupportedMap();
|
||||||
console.log(options);
|
|
||||||
if (options['-A']) {
|
if (options['-A']) {
|
||||||
command.addWarning(intl.str('hg-a-option'));
|
command.addWarning(intl.str('hg-a-option'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,6 +352,11 @@ var VisBranch = VisBase.extend({
|
||||||
var name = this.get('branch').getName();
|
var name = this.get('branch').getName();
|
||||||
var selected = this.get('branch') === this.gitEngine.HEAD.get('target');
|
var selected = this.get('branch') === this.gitEngine.HEAD.get('target');
|
||||||
var isRemote = this.getIsRemote();
|
var isRemote = this.getIsRemote();
|
||||||
|
var isHg = this.gitEngine.getIsHg();
|
||||||
|
|
||||||
|
if (name === 'HEAD' && isHg) {
|
||||||
|
name = '.';
|
||||||
|
}
|
||||||
|
|
||||||
var after = (selected && !this.getIsInOrigin() && !isRemote) ? '*' : '';
|
var after = (selected && !this.getIsInOrigin() && !isRemote) ? '*' : '';
|
||||||
return name + after;
|
return name + after;
|
||||||
|
@ -393,10 +398,13 @@ var VisBranch = VisBase.extend({
|
||||||
this.gitVisuals.removeVisBranch(this);
|
this.gitVisuals.removeVisBranch(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleModeChange: function() {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
genGraphics: function(paper) {
|
genGraphics: function(paper) {
|
||||||
var textPos = this.getTextPosition();
|
var textPos = this.getTextPosition();
|
||||||
var name = this.getName();
|
var name = this.getName();
|
||||||
var text;
|
|
||||||
|
|
||||||
// when from a reload, we dont need to generate the text
|
// when from a reload, we dont need to generate the text
|
||||||
text = paper.text(textPos.x, textPos.y, String(name));
|
text = paper.text(textPos.x, textPos.y, String(name));
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<i class="icon-home"></i>
|
<i class="icon-home"></i>
|
||||||
<span class="intl-aware" data-intl="learn-git-branching">
|
<span class="vcs-mode-aware intl-aware" data-intl="learn-git-branching">
|
||||||
Learn Git Branching
|
Learn Git Branching
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue