bit of remote work

This commit is contained in:
Peter Cottle 2013-06-24 08:59:02 -07:00
parent 8a4f8baafb
commit af632eaa5e
6 changed files with 55 additions and 1142 deletions

View file

@ -879,10 +879,10 @@ GitEngine.prototype.push = function(options) {
// HAX HAX update o/master
chain = chain.then(_.bind(function() {
var localLocationID = localBranch.get('target').get('id');
var localCommit = this.refs[localLocationID];
// HAX HAX
this.setTargetLocation(this.refs['o/master'], localCommit);
var localCommit = this.getCommitFromRef(localBranch);
var remoteBranchID = localBranch.getRemoteBranchIDFromTracking();
// less hacks hax
this.setTargetLocation(this.refs[remoteBranchID], localCommit);
return AnimationFactory.playRefreshAnimation(this.gitVisuals);
}, this));
@ -2233,9 +2233,23 @@ var Ref = Backbone.Model.extend({
var Branch = Ref.extend({
defaults: {
visBranch: null,
remoteTrackingBranch: null,
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');
},