mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +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>
|
||||
<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
|
||||
</span>
|
||||
</div>
|
||||
|
@ -445,7 +445,7 @@
|
|||
For a much easier time perusing the source, see the individual files at:
|
||||
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 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 util = require('../util');
|
||||
var intl = require('../intl');
|
||||
|
||||
/**
|
||||
* Globals
|
||||
|
@ -41,11 +42,27 @@ var init = function() {
|
|||
});
|
||||
|
||||
events.on('localeChanged', intlRefresh);
|
||||
events.on('vcsModeChange', vcsModeRefresh);
|
||||
|
||||
initRootEvents(eventBaton);
|
||||
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() {
|
||||
if (!window.$) { return; }
|
||||
$('span.intl-aware').each(function(i, el) {
|
||||
|
|
|
@ -70,6 +70,10 @@ GitEngine.prototype.handleModeChange = function(vcs, callback) {
|
|||
chain.then(callback);
|
||||
};
|
||||
|
||||
GitEngine.prototype.getIsHg = function() {
|
||||
return this.mode === 'hg';
|
||||
};
|
||||
|
||||
GitEngine.prototype.setMode = function(vcs) {
|
||||
var switchedToHg = (this.mode === 'git' && vcs === 'hg');
|
||||
this.mode = vcs;
|
||||
|
@ -1214,10 +1218,12 @@ GitEngine.prototype.setTargetLocation = function(ref, target) {
|
|||
|
||||
GitEngine.prototype.pruneTree = function() {
|
||||
var set = this.getUpstreamBranchSet();
|
||||
// dont prune dangling commits if we are on head
|
||||
var underHeadID = this.getCommitFromRef('HEAD').get('id');
|
||||
set[underHeadID] = set[underHeadID] || [];
|
||||
set[underHeadID].push('HEAD');
|
||||
// dont prune commits that HEAD depends on
|
||||
var headSet = this.getUpstreamSet('HEAD');
|
||||
console.log(headSet);
|
||||
_.each(headSet, function(val, commitID) {
|
||||
set[commitID] = true;
|
||||
});
|
||||
|
||||
var toDelete = [];
|
||||
this.commitCollection.each(function(commit) {
|
||||
|
@ -1227,9 +1233,12 @@ GitEngine.prototype.pruneTree = function() {
|
|||
}
|
||||
}, this);
|
||||
|
||||
if (toDelete.length) {
|
||||
this.command.addWarning(intl.str('hg-prune-tree'));
|
||||
if (!toDelete.length) {
|
||||
// returning nothing will perform
|
||||
// the switch sync
|
||||
return;
|
||||
}
|
||||
this.command.addWarning(intl.str('hg-prune-tree'));
|
||||
|
||||
_.each(toDelete, function(commit) {
|
||||
commit.removeFromParents();
|
||||
|
|
|
@ -19,7 +19,6 @@ var commandConfig = {
|
|||
],
|
||||
delegate: function(engine, command) {
|
||||
var options = command.getSupportedMap();
|
||||
console.log(options);
|
||||
if (options['-A']) {
|
||||
command.addWarning(intl.str('hg-a-option'));
|
||||
}
|
||||
|
|
|
@ -352,6 +352,11 @@ var VisBranch = VisBase.extend({
|
|||
var name = this.get('branch').getName();
|
||||
var selected = this.get('branch') === this.gitEngine.HEAD.get('target');
|
||||
var isRemote = this.getIsRemote();
|
||||
var isHg = this.gitEngine.getIsHg();
|
||||
|
||||
if (name === 'HEAD' && isHg) {
|
||||
name = '.';
|
||||
}
|
||||
|
||||
var after = (selected && !this.getIsInOrigin() && !isRemote) ? '*' : '';
|
||||
return name + after;
|
||||
|
@ -393,10 +398,13 @@ var VisBranch = VisBase.extend({
|
|||
this.gitVisuals.removeVisBranch(this);
|
||||
},
|
||||
|
||||
handleModeChange: function() {
|
||||
|
||||
},
|
||||
|
||||
genGraphics: function(paper) {
|
||||
var textPos = this.getTextPosition();
|
||||
var name = this.getName();
|
||||
var text;
|
||||
|
||||
// when from a reload, we dont need to generate the text
|
||||
text = paper.text(textPos.x, textPos.y, String(name));
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
</div>
|
||||
<div>
|
||||
<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
|
||||
</span>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue