mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +02:00
WIP
This commit is contained in:
parent
62e56861cf
commit
4815a6f30b
3 changed files with 109 additions and 58 deletions
110
build/bundle.js
110
build/bundle.js
|
@ -7569,9 +7569,17 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
||||||
this.getCommitFromRef(originTarget)
|
this.getCommitFromRef(originTarget)
|
||||||
);
|
);
|
||||||
originBranch.set('remote', true);
|
originBranch.set('remote', true);
|
||||||
|
// TODO
|
||||||
|
this.setLocalToTrackRemote();
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch) {
|
||||||
|
this.command.addWarning(
|
||||||
|
'local branch set to track remote branch'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||||
if (createdSoFar[objID]) {
|
if (createdSoFar[objID]) {
|
||||||
// base case
|
// base case
|
||||||
|
@ -8086,7 +8094,7 @@ GitEngine.prototype.push = function(options) {
|
||||||
// HAX HAX update o/master
|
// HAX HAX update o/master
|
||||||
chain = chain.then(_.bind(function() {
|
chain = chain.then(_.bind(function() {
|
||||||
var localCommit = this.getCommitFromRef(localBranch);
|
var localCommit = this.getCommitFromRef(localBranch);
|
||||||
var remoteBranchID = localBranch.getRemoteBranchIDFromTracking();
|
var remoteBranchID = localBranch.getRemoteBranchID();
|
||||||
// less hacks hax
|
// less hacks hax
|
||||||
this.setTargetLocation(this.refs[remoteBranchID], localCommit);
|
this.setTargetLocation(this.refs[remoteBranchID], localCommit);
|
||||||
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
||||||
|
@ -9468,30 +9476,39 @@ var Ref = Backbone.Model.extend({
|
||||||
var Branch = Ref.extend({
|
var Branch = Ref.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
visBranch: null,
|
visBranch: null,
|
||||||
remoteTrackingBranch: null,
|
remoteTrackingBranchID: null,
|
||||||
|
localBranchesThatTrackThis: null,
|
||||||
remote: false
|
remote: false
|
||||||
},
|
},
|
||||||
|
|
||||||
getRemoteBranchIDFromTracking: function() {
|
|
||||||
if (this.getIsRemote()) {
|
|
||||||
throw new Error('I am a remote branch! dont try to get remote from me');
|
|
||||||
}
|
|
||||||
// TODO check if remote tracking also
|
|
||||||
return 'o/' + this.getRemoteTrackingBranchName();
|
|
||||||
},
|
|
||||||
|
|
||||||
getRemoteTrackingBranchName: function() {
|
|
||||||
var originBranchName = this.get('remoteTrackingBranch');
|
|
||||||
return (originBranchName) ? originBranchName : this.get('id');
|
|
||||||
},
|
|
||||||
|
|
||||||
getIsRemote: function() {
|
|
||||||
return this.get('remote');
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
Ref.prototype.initialize.call(this);
|
Ref.prototype.initialize.call(this);
|
||||||
this.set('type', 'branch');
|
this.set('type', 'branch');
|
||||||
|
},
|
||||||
|
|
||||||
|
setLocalBranchesThatTrackThis: function(branches) {
|
||||||
|
this.set('localBranchesThatTrackThis', branches);
|
||||||
|
},
|
||||||
|
|
||||||
|
getLocalBranchesThatTrackThis: function() {
|
||||||
|
return this.get('localBranchesThatTrackThis') || [];
|
||||||
|
},
|
||||||
|
|
||||||
|
addLocalBranchThatTracksThis: function(localBranch) {
|
||||||
|
this.setLocalBranchesThatTrackThis(
|
||||||
|
this.getLocalBranchesThatTrackThis().concat([localBranch])
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
getRemoteBranchID: function() {
|
||||||
|
if (this.getIsRemote()) {
|
||||||
|
throw new Error('I am a remote branch! dont try to get remote from me');
|
||||||
|
}
|
||||||
|
return 'o/' + this.get('id');
|
||||||
|
},
|
||||||
|
|
||||||
|
getIsRemote: function() {
|
||||||
|
return !!this.get('remote');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -25934,9 +25951,17 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
||||||
this.getCommitFromRef(originTarget)
|
this.getCommitFromRef(originTarget)
|
||||||
);
|
);
|
||||||
originBranch.set('remote', true);
|
originBranch.set('remote', true);
|
||||||
|
// TODO
|
||||||
|
this.setLocalToTrackRemote();
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch) {
|
||||||
|
this.command.addWarning(
|
||||||
|
'local branch set to track remote branch'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||||
if (createdSoFar[objID]) {
|
if (createdSoFar[objID]) {
|
||||||
// base case
|
// base case
|
||||||
|
@ -26451,7 +26476,7 @@ GitEngine.prototype.push = function(options) {
|
||||||
// HAX HAX update o/master
|
// HAX HAX update o/master
|
||||||
chain = chain.then(_.bind(function() {
|
chain = chain.then(_.bind(function() {
|
||||||
var localCommit = this.getCommitFromRef(localBranch);
|
var localCommit = this.getCommitFromRef(localBranch);
|
||||||
var remoteBranchID = localBranch.getRemoteBranchIDFromTracking();
|
var remoteBranchID = localBranch.getRemoteBranchID();
|
||||||
// less hacks hax
|
// less hacks hax
|
||||||
this.setTargetLocation(this.refs[remoteBranchID], localCommit);
|
this.setTargetLocation(this.refs[remoteBranchID], localCommit);
|
||||||
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
||||||
|
@ -27833,30 +27858,39 @@ var Ref = Backbone.Model.extend({
|
||||||
var Branch = Ref.extend({
|
var Branch = Ref.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
visBranch: null,
|
visBranch: null,
|
||||||
remoteTrackingBranch: null,
|
remoteTrackingBranchID: null,
|
||||||
|
localBranchesThatTrackThis: null,
|
||||||
remote: false
|
remote: false
|
||||||
},
|
},
|
||||||
|
|
||||||
getRemoteBranchIDFromTracking: function() {
|
|
||||||
if (this.getIsRemote()) {
|
|
||||||
throw new Error('I am a remote branch! dont try to get remote from me');
|
|
||||||
}
|
|
||||||
// TODO check if remote tracking also
|
|
||||||
return 'o/' + this.getRemoteTrackingBranchName();
|
|
||||||
},
|
|
||||||
|
|
||||||
getRemoteTrackingBranchName: function() {
|
|
||||||
var originBranchName = this.get('remoteTrackingBranch');
|
|
||||||
return (originBranchName) ? originBranchName : this.get('id');
|
|
||||||
},
|
|
||||||
|
|
||||||
getIsRemote: function() {
|
|
||||||
return this.get('remote');
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
Ref.prototype.initialize.call(this);
|
Ref.prototype.initialize.call(this);
|
||||||
this.set('type', 'branch');
|
this.set('type', 'branch');
|
||||||
|
},
|
||||||
|
|
||||||
|
setLocalBranchesThatTrackThis: function(branches) {
|
||||||
|
this.set('localBranchesThatTrackThis', branches);
|
||||||
|
},
|
||||||
|
|
||||||
|
getLocalBranchesThatTrackThis: function() {
|
||||||
|
return this.get('localBranchesThatTrackThis') || [];
|
||||||
|
},
|
||||||
|
|
||||||
|
addLocalBranchThatTracksThis: function(localBranch) {
|
||||||
|
this.setLocalBranchesThatTrackThis(
|
||||||
|
this.getLocalBranchesThatTrackThis().concat([localBranch])
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
getRemoteBranchID: function() {
|
||||||
|
if (this.getIsRemote()) {
|
||||||
|
throw new Error('I am a remote branch! dont try to get remote from me');
|
||||||
|
}
|
||||||
|
return 'o/' + this.get('id');
|
||||||
|
},
|
||||||
|
|
||||||
|
getIsRemote: function() {
|
||||||
|
return !!this.get('remote');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -349,9 +349,17 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
||||||
this.getCommitFromRef(originTarget)
|
this.getCommitFromRef(originTarget)
|
||||||
);
|
);
|
||||||
originBranch.set('remote', true);
|
originBranch.set('remote', true);
|
||||||
|
// TODO
|
||||||
|
this.setLocalToTrackRemote();
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch) {
|
||||||
|
this.command.addWarning(
|
||||||
|
'local branch set to track remote branch'
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||||
if (createdSoFar[objID]) {
|
if (createdSoFar[objID]) {
|
||||||
// base case
|
// base case
|
||||||
|
@ -866,7 +874,7 @@ GitEngine.prototype.push = function(options) {
|
||||||
// HAX HAX update o/master
|
// HAX HAX update o/master
|
||||||
chain = chain.then(_.bind(function() {
|
chain = chain.then(_.bind(function() {
|
||||||
var localCommit = this.getCommitFromRef(localBranch);
|
var localCommit = this.getCommitFromRef(localBranch);
|
||||||
var remoteBranchID = localBranch.getRemoteBranchIDFromTracking();
|
var remoteBranchID = localBranch.getRemoteBranchID();
|
||||||
// less hacks hax
|
// less hacks hax
|
||||||
this.setTargetLocation(this.refs[remoteBranchID], localCommit);
|
this.setTargetLocation(this.refs[remoteBranchID], localCommit);
|
||||||
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
return this.animationFactory.playRefreshAnimation(this.gitVisuals);
|
||||||
|
@ -2248,30 +2256,39 @@ var Ref = Backbone.Model.extend({
|
||||||
var Branch = Ref.extend({
|
var Branch = Ref.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
visBranch: null,
|
visBranch: null,
|
||||||
remoteTrackingBranch: null,
|
remoteTrackingBranchID: null,
|
||||||
|
localBranchesThatTrackThis: null,
|
||||||
remote: false
|
remote: false
|
||||||
},
|
},
|
||||||
|
|
||||||
getRemoteBranchIDFromTracking: function() {
|
|
||||||
if (this.getIsRemote()) {
|
|
||||||
throw new Error('I am a remote branch! dont try to get remote from me');
|
|
||||||
}
|
|
||||||
// TODO check if remote tracking also
|
|
||||||
return 'o/' + this.getRemoteTrackingBranchName();
|
|
||||||
},
|
|
||||||
|
|
||||||
getRemoteTrackingBranchName: function() {
|
|
||||||
var originBranchName = this.get('remoteTrackingBranch');
|
|
||||||
return (originBranchName) ? originBranchName : this.get('id');
|
|
||||||
},
|
|
||||||
|
|
||||||
getIsRemote: function() {
|
|
||||||
return this.get('remote');
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
Ref.prototype.initialize.call(this);
|
Ref.prototype.initialize.call(this);
|
||||||
this.set('type', 'branch');
|
this.set('type', 'branch');
|
||||||
|
},
|
||||||
|
|
||||||
|
setLocalBranchesThatTrackThis: function(branches) {
|
||||||
|
this.set('localBranchesThatTrackThis', branches);
|
||||||
|
},
|
||||||
|
|
||||||
|
getLocalBranchesThatTrackThis: function() {
|
||||||
|
return this.get('localBranchesThatTrackThis') || [];
|
||||||
|
},
|
||||||
|
|
||||||
|
addLocalBranchThatTracksThis: function(localBranch) {
|
||||||
|
this.setLocalBranchesThatTrackThis(
|
||||||
|
this.getLocalBranchesThatTrackThis().concat([localBranch])
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
|
getRemoteBranchID: function() {
|
||||||
|
if (this.getIsRemote()) {
|
||||||
|
throw new Error('I am a remote branch! dont try to get remote from me');
|
||||||
|
}
|
||||||
|
return 'o/' + this.get('id');
|
||||||
|
},
|
||||||
|
|
||||||
|
getIsRemote: function() {
|
||||||
|
return !!this.get('remote');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
2
todo.txt
2
todo.txt
|
@ -11,7 +11,7 @@ Easier origin things:
|
||||||
|
|
||||||
Origin things:
|
Origin things:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
[ ] set checkout -b branch __remoteBranch to track the remote branch
|
[-] set checkout -b branch __remoteBranch to track the remote branch
|
||||||
[ ] prototype visual layout (background change + header? maybe...)
|
[ ] prototype visual layout (background change + header? maybe...)
|
||||||
|
|
||||||
Medium things:
|
Medium things:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue