mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
Issue #123
This commit is contained in:
parent
fc502bcdaf
commit
d6c89f913f
7 changed files with 192 additions and 72 deletions
172
build/bundle.js
172
build/bundle.js
|
@ -7236,6 +7236,7 @@ var GitError = Errors.GitError;
|
||||||
var CommandResult = Errors.CommandResult;
|
var CommandResult = Errors.CommandResult;
|
||||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||||
|
|
||||||
|
var ORIGIN_PREFIX = 'o/';
|
||||||
|
|
||||||
function GitEngine(options) {
|
function GitEngine(options) {
|
||||||
this.rootCommit = null;
|
this.rootCommit = null;
|
||||||
|
@ -7565,19 +7566,25 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
||||||
_.each(originTree.branches, function(branchJSON, branchName) {
|
_.each(originTree.branches, function(branchJSON, branchName) {
|
||||||
var originTarget = branchJSON.target;
|
var originTarget = branchJSON.target;
|
||||||
var originBranch = this.makeBranch(
|
var originBranch = this.makeBranch(
|
||||||
'o/' + branchName,
|
ORIGIN_PREFIX + branchName,
|
||||||
this.getCommitFromRef(originTarget)
|
this.getCommitFromRef(originTarget)
|
||||||
);
|
);
|
||||||
originBranch.set('remote', true);
|
|
||||||
// TODO
|
this.setLocalToTrackRemote(this.refs[branchJSON.id], originBranch);
|
||||||
this.setLocalToTrackRemote();
|
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch) {
|
GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch) {
|
||||||
this.command.addWarning(
|
remoteBranch.addLocalBranchThatTracksThis(localBranch);
|
||||||
'local branch set to track remote branch'
|
localBranch.setRemoteTrackingBranchID(remoteBranch.get('id'));
|
||||||
);
|
|
||||||
|
// same for local
|
||||||
|
var msg = 'local branch "' +
|
||||||
|
localBranch.get('id') +
|
||||||
|
'" set to track remote branch "' +
|
||||||
|
remoteBranch.get('id') +
|
||||||
|
'"';
|
||||||
|
this.command.addWarning(msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||||
|
@ -8091,7 +8098,7 @@ GitEngine.prototype.push = function(options) {
|
||||||
return this.animationFactory.playRefreshAnimation(this.origin.gitVisuals);
|
return this.animationFactory.playRefreshAnimation(this.origin.gitVisuals);
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
// HAX HAX update o/master
|
// HAX HAX update master and remote tracking for master
|
||||||
chain = chain.then(_.bind(function() {
|
chain = chain.then(_.bind(function() {
|
||||||
var localCommit = this.getCommitFromRef(localBranch);
|
var localCommit = this.getCommitFromRef(localBranch);
|
||||||
var remoteBranchID = localBranch.getRemoteBranchID();
|
var remoteBranchID = localBranch.getRemoteBranchID();
|
||||||
|
@ -8110,16 +8117,26 @@ GitEngine.prototype.fetch = function(options) {
|
||||||
var localBranch = this.refs['o/master'];
|
var localBranch = this.refs['o/master'];
|
||||||
var remoteBranch = this.origin.refs['master'];
|
var remoteBranch = this.origin.refs['master'];
|
||||||
|
|
||||||
// first check if this is even allowed by checking the sync between
|
// fetch all local branches
|
||||||
this.checkUpstreamOfSource(
|
var allRemotes = this.branchCollection.filter(function(branch) {
|
||||||
this,
|
return branch.getIsRemote();
|
||||||
this.origin,
|
});
|
||||||
localBranch,
|
console.log(allRemotes);
|
||||||
remoteBranch
|
|
||||||
);
|
// first check if our local remote branch is upstream of the origin branch set.
|
||||||
|
// this check essentially pretends the local remote branch is in origin and
|
||||||
|
// could be fast forwarded (basic sanity check)
|
||||||
|
_.each(allRemotes, function(localRemoteBranch) {
|
||||||
|
this.checkUpstreamOfSource(
|
||||||
|
this,
|
||||||
|
this.origin,
|
||||||
|
localRemoteBranch,
|
||||||
|
localRemoteBranch.getRemoteBranchFromEngine(this.origin)
|
||||||
|
);
|
||||||
|
}, this);
|
||||||
|
|
||||||
// then we get the difference in commits between these two graphs, ordered by
|
// then we get the difference in commits between these two graphs, ordered by
|
||||||
// depth
|
// depth. TODO -- make work for all branches
|
||||||
var commitsToMake = this.getTargetGraphDifference(
|
var commitsToMake = this.getTargetGraphDifference(
|
||||||
this,
|
this,
|
||||||
this.origin,
|
this.origin,
|
||||||
|
@ -9486,12 +9503,22 @@ var Branch = Ref.extend({
|
||||||
this.set('type', 'branch');
|
this.set('type', 'branch');
|
||||||
},
|
},
|
||||||
|
|
||||||
setLocalBranchesThatTrackThis: function(branches) {
|
/**
|
||||||
this.set('localBranchesThatTrackThis', branches);
|
* Here is the deal -- there are essentially three types of branches
|
||||||
|
* we deal with:
|
||||||
|
* 1) Normal local branches (that may track a remote branch)
|
||||||
|
* 2) Local remote branches (o/master) that track an origin branch
|
||||||
|
* 3) Origin branches (master) that exist in origin
|
||||||
|
*
|
||||||
|
* With that in mind, we change our branch model to support the following
|
||||||
|
*/
|
||||||
|
|
||||||
|
setRemoteTrackingBranchID: function(id) {
|
||||||
|
this.set('remoteTrackingBranchID', id);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLocalBranchesThatTrackThis: function() {
|
getRemoteTrackingBranchID: function() {
|
||||||
return this.get('localBranchesThatTrackThis') || [];
|
return this.get('remoteTrackingBranchID');
|
||||||
},
|
},
|
||||||
|
|
||||||
addLocalBranchThatTracksThis: function(localBranch) {
|
addLocalBranchThatTracksThis: function(localBranch) {
|
||||||
|
@ -9500,15 +9527,27 @@ var Branch = Ref.extend({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setLocalBranchesThatTrackThis: function(branches) {
|
||||||
|
this.set('localBranchesThatTrackThis', branches);
|
||||||
|
},
|
||||||
|
|
||||||
|
getLocalBranchesThatTrackThis: function() {
|
||||||
|
return this.get('localBranchesThatTrackThis') || [];
|
||||||
|
},
|
||||||
|
|
||||||
getRemoteBranchID: function() {
|
getRemoteBranchID: function() {
|
||||||
if (this.getIsRemote()) {
|
if (this.getIsRemote()) {
|
||||||
throw new Error('I am a remote branch! dont try to get remote from me');
|
throw new Error('I am a remote branch! dont try to get remote from me');
|
||||||
}
|
}
|
||||||
return 'o/' + this.get('id');
|
return ORIGIN_PREFIX + this.get('id');
|
||||||
|
},
|
||||||
|
|
||||||
|
getRemoteBranchFromEngine: function(engine) {
|
||||||
|
return engine.refs[this.getRemoteBranchID()];
|
||||||
},
|
},
|
||||||
|
|
||||||
getIsRemote: function() {
|
getIsRemote: function() {
|
||||||
return !!this.get('remote');
|
return this.get('id').slice(0, 2) === ORIGIN_PREFIX;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -22416,7 +22455,8 @@ require.define("/levels/mixed/jugglingCommits2.js",function(require,module,expor
|
||||||
require.define("/levels/rebase/manyRebases.js",function(require,module,exports,__dirname,__filename,process,global){exports.level = {
|
require.define("/levels/rebase/manyRebases.js",function(require,module,exports,__dirname,__filename,process,global){exports.level = {
|
||||||
"compareOnlyMasterHashAgnostic": true,
|
"compareOnlyMasterHashAgnostic": true,
|
||||||
"disabledMap": {
|
"disabledMap": {
|
||||||
"git revert": true
|
"git revert": true,
|
||||||
|
"git cherry-pick": true
|
||||||
},
|
},
|
||||||
"goalTreeString": "%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22master%22%7D%2C%22bugFix%22%3A%7B%22target%22%3A%22C3%27%22%2C%22id%22%3A%22bugFix%22%7D%2C%22side%22%3A%7B%22target%22%3A%22C6%27%22%2C%22id%22%3A%22side%22%7D%2C%22another%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22another%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22parents%22%3A%5B%5D%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C1%22%7D%2C%22C2%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C2%22%7D%2C%22C3%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C3%22%7D%2C%22C4%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C4%22%7D%2C%22C5%22%3A%7B%22parents%22%3A%5B%22C4%22%5D%2C%22id%22%3A%22C5%22%7D%2C%22C6%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C6%22%7D%2C%22C7%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C7%22%7D%2C%22C3%27%22%3A%7B%22parents%22%3A%5B%22C2%22%5D%2C%22id%22%3A%22C3%27%22%7D%2C%22C4%27%22%3A%7B%22parents%22%3A%5B%22C3%27%22%5D%2C%22id%22%3A%22C4%27%22%7D%2C%22C5%27%22%3A%7B%22parents%22%3A%5B%22C4%27%22%5D%2C%22id%22%3A%22C5%27%22%7D%2C%22C6%27%22%3A%7B%22parents%22%3A%5B%22C5%27%22%5D%2C%22id%22%3A%22C6%27%22%7D%2C%22C7%27%22%3A%7B%22parents%22%3A%5B%22C6%27%22%5D%2C%22id%22%3A%22C7%27%22%7D%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22master%22%2C%22id%22%3A%22HEAD%22%7D%7D",
|
"goalTreeString": "%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22master%22%7D%2C%22bugFix%22%3A%7B%22target%22%3A%22C3%27%22%2C%22id%22%3A%22bugFix%22%7D%2C%22side%22%3A%7B%22target%22%3A%22C6%27%22%2C%22id%22%3A%22side%22%7D%2C%22another%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22another%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22parents%22%3A%5B%5D%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C1%22%7D%2C%22C2%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C2%22%7D%2C%22C3%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C3%22%7D%2C%22C4%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C4%22%7D%2C%22C5%22%3A%7B%22parents%22%3A%5B%22C4%22%5D%2C%22id%22%3A%22C5%22%7D%2C%22C6%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C6%22%7D%2C%22C7%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C7%22%7D%2C%22C3%27%22%3A%7B%22parents%22%3A%5B%22C2%22%5D%2C%22id%22%3A%22C3%27%22%7D%2C%22C4%27%22%3A%7B%22parents%22%3A%5B%22C3%27%22%5D%2C%22id%22%3A%22C4%27%22%7D%2C%22C5%27%22%3A%7B%22parents%22%3A%5B%22C4%27%22%5D%2C%22id%22%3A%22C5%27%22%7D%2C%22C6%27%22%3A%7B%22parents%22%3A%5B%22C5%27%22%5D%2C%22id%22%3A%22C6%27%22%7D%2C%22C7%27%22%3A%7B%22parents%22%3A%5B%22C6%27%22%5D%2C%22id%22%3A%22C7%27%22%7D%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22master%22%2C%22id%22%3A%22HEAD%22%7D%7D",
|
||||||
"solutionCommand": "git checkout bugFix;git rebase master;git checkout side;git rebase bugFix;git checkout another;git rebase side;git rebase another master",
|
"solutionCommand": "git checkout bugFix;git rebase master;git checkout side;git rebase bugFix;git checkout another;git rebase side;git rebase another master",
|
||||||
|
@ -25618,6 +25658,7 @@ var GitError = Errors.GitError;
|
||||||
var CommandResult = Errors.CommandResult;
|
var CommandResult = Errors.CommandResult;
|
||||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||||
|
|
||||||
|
var ORIGIN_PREFIX = 'o/';
|
||||||
|
|
||||||
function GitEngine(options) {
|
function GitEngine(options) {
|
||||||
this.rootCommit = null;
|
this.rootCommit = null;
|
||||||
|
@ -25947,19 +25988,25 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
||||||
_.each(originTree.branches, function(branchJSON, branchName) {
|
_.each(originTree.branches, function(branchJSON, branchName) {
|
||||||
var originTarget = branchJSON.target;
|
var originTarget = branchJSON.target;
|
||||||
var originBranch = this.makeBranch(
|
var originBranch = this.makeBranch(
|
||||||
'o/' + branchName,
|
ORIGIN_PREFIX + branchName,
|
||||||
this.getCommitFromRef(originTarget)
|
this.getCommitFromRef(originTarget)
|
||||||
);
|
);
|
||||||
originBranch.set('remote', true);
|
|
||||||
// TODO
|
this.setLocalToTrackRemote(this.refs[branchJSON.id], originBranch);
|
||||||
this.setLocalToTrackRemote();
|
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch) {
|
GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch) {
|
||||||
this.command.addWarning(
|
remoteBranch.addLocalBranchThatTracksThis(localBranch);
|
||||||
'local branch set to track remote branch'
|
localBranch.setRemoteTrackingBranchID(remoteBranch.get('id'));
|
||||||
);
|
|
||||||
|
// same for local
|
||||||
|
var msg = 'local branch "' +
|
||||||
|
localBranch.get('id') +
|
||||||
|
'" set to track remote branch "' +
|
||||||
|
remoteBranch.get('id') +
|
||||||
|
'"';
|
||||||
|
this.command.addWarning(msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||||
|
@ -26473,7 +26520,7 @@ GitEngine.prototype.push = function(options) {
|
||||||
return this.animationFactory.playRefreshAnimation(this.origin.gitVisuals);
|
return this.animationFactory.playRefreshAnimation(this.origin.gitVisuals);
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
// HAX HAX update o/master
|
// HAX HAX update master and remote tracking for master
|
||||||
chain = chain.then(_.bind(function() {
|
chain = chain.then(_.bind(function() {
|
||||||
var localCommit = this.getCommitFromRef(localBranch);
|
var localCommit = this.getCommitFromRef(localBranch);
|
||||||
var remoteBranchID = localBranch.getRemoteBranchID();
|
var remoteBranchID = localBranch.getRemoteBranchID();
|
||||||
|
@ -26492,16 +26539,26 @@ GitEngine.prototype.fetch = function(options) {
|
||||||
var localBranch = this.refs['o/master'];
|
var localBranch = this.refs['o/master'];
|
||||||
var remoteBranch = this.origin.refs['master'];
|
var remoteBranch = this.origin.refs['master'];
|
||||||
|
|
||||||
// first check if this is even allowed by checking the sync between
|
// fetch all local branches
|
||||||
this.checkUpstreamOfSource(
|
var allRemotes = this.branchCollection.filter(function(branch) {
|
||||||
this,
|
return branch.getIsRemote();
|
||||||
this.origin,
|
});
|
||||||
localBranch,
|
console.log(allRemotes);
|
||||||
remoteBranch
|
|
||||||
);
|
// first check if our local remote branch is upstream of the origin branch set.
|
||||||
|
// this check essentially pretends the local remote branch is in origin and
|
||||||
|
// could be fast forwarded (basic sanity check)
|
||||||
|
_.each(allRemotes, function(localRemoteBranch) {
|
||||||
|
this.checkUpstreamOfSource(
|
||||||
|
this,
|
||||||
|
this.origin,
|
||||||
|
localRemoteBranch,
|
||||||
|
localRemoteBranch.getRemoteBranchFromEngine(this.origin)
|
||||||
|
);
|
||||||
|
}, this);
|
||||||
|
|
||||||
// then we get the difference in commits between these two graphs, ordered by
|
// then we get the difference in commits between these two graphs, ordered by
|
||||||
// depth
|
// depth. TODO -- make work for all branches
|
||||||
var commitsToMake = this.getTargetGraphDifference(
|
var commitsToMake = this.getTargetGraphDifference(
|
||||||
this,
|
this,
|
||||||
this.origin,
|
this.origin,
|
||||||
|
@ -27868,12 +27925,22 @@ var Branch = Ref.extend({
|
||||||
this.set('type', 'branch');
|
this.set('type', 'branch');
|
||||||
},
|
},
|
||||||
|
|
||||||
setLocalBranchesThatTrackThis: function(branches) {
|
/**
|
||||||
this.set('localBranchesThatTrackThis', branches);
|
* Here is the deal -- there are essentially three types of branches
|
||||||
|
* we deal with:
|
||||||
|
* 1) Normal local branches (that may track a remote branch)
|
||||||
|
* 2) Local remote branches (o/master) that track an origin branch
|
||||||
|
* 3) Origin branches (master) that exist in origin
|
||||||
|
*
|
||||||
|
* With that in mind, we change our branch model to support the following
|
||||||
|
*/
|
||||||
|
|
||||||
|
setRemoteTrackingBranchID: function(id) {
|
||||||
|
this.set('remoteTrackingBranchID', id);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLocalBranchesThatTrackThis: function() {
|
getRemoteTrackingBranchID: function() {
|
||||||
return this.get('localBranchesThatTrackThis') || [];
|
return this.get('remoteTrackingBranchID');
|
||||||
},
|
},
|
||||||
|
|
||||||
addLocalBranchThatTracksThis: function(localBranch) {
|
addLocalBranchThatTracksThis: function(localBranch) {
|
||||||
|
@ -27882,15 +27949,27 @@ var Branch = Ref.extend({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setLocalBranchesThatTrackThis: function(branches) {
|
||||||
|
this.set('localBranchesThatTrackThis', branches);
|
||||||
|
},
|
||||||
|
|
||||||
|
getLocalBranchesThatTrackThis: function() {
|
||||||
|
return this.get('localBranchesThatTrackThis') || [];
|
||||||
|
},
|
||||||
|
|
||||||
getRemoteBranchID: function() {
|
getRemoteBranchID: function() {
|
||||||
if (this.getIsRemote()) {
|
if (this.getIsRemote()) {
|
||||||
throw new Error('I am a remote branch! dont try to get remote from me');
|
throw new Error('I am a remote branch! dont try to get remote from me');
|
||||||
}
|
}
|
||||||
return 'o/' + this.get('id');
|
return ORIGIN_PREFIX + this.get('id');
|
||||||
|
},
|
||||||
|
|
||||||
|
getRemoteBranchFromEngine: function(engine) {
|
||||||
|
return engine.refs[this.getRemoteBranchID()];
|
||||||
},
|
},
|
||||||
|
|
||||||
getIsRemote: function() {
|
getIsRemote: function() {
|
||||||
return !!this.get('remote');
|
return this.get('id').slice(0, 2) === ORIGIN_PREFIX;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -41019,7 +41098,8 @@ require("/src/levels/rampup/reversingChanges.js");
|
||||||
require.define("/src/levels/rebase/manyRebases.js",function(require,module,exports,__dirname,__filename,process,global){exports.level = {
|
require.define("/src/levels/rebase/manyRebases.js",function(require,module,exports,__dirname,__filename,process,global){exports.level = {
|
||||||
"compareOnlyMasterHashAgnostic": true,
|
"compareOnlyMasterHashAgnostic": true,
|
||||||
"disabledMap": {
|
"disabledMap": {
|
||||||
"git revert": true
|
"git revert": true,
|
||||||
|
"git cherry-pick": true
|
||||||
},
|
},
|
||||||
"goalTreeString": "%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22master%22%7D%2C%22bugFix%22%3A%7B%22target%22%3A%22C3%27%22%2C%22id%22%3A%22bugFix%22%7D%2C%22side%22%3A%7B%22target%22%3A%22C6%27%22%2C%22id%22%3A%22side%22%7D%2C%22another%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22another%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22parents%22%3A%5B%5D%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C1%22%7D%2C%22C2%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C2%22%7D%2C%22C3%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C3%22%7D%2C%22C4%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C4%22%7D%2C%22C5%22%3A%7B%22parents%22%3A%5B%22C4%22%5D%2C%22id%22%3A%22C5%22%7D%2C%22C6%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C6%22%7D%2C%22C7%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C7%22%7D%2C%22C3%27%22%3A%7B%22parents%22%3A%5B%22C2%22%5D%2C%22id%22%3A%22C3%27%22%7D%2C%22C4%27%22%3A%7B%22parents%22%3A%5B%22C3%27%22%5D%2C%22id%22%3A%22C4%27%22%7D%2C%22C5%27%22%3A%7B%22parents%22%3A%5B%22C4%27%22%5D%2C%22id%22%3A%22C5%27%22%7D%2C%22C6%27%22%3A%7B%22parents%22%3A%5B%22C5%27%22%5D%2C%22id%22%3A%22C6%27%22%7D%2C%22C7%27%22%3A%7B%22parents%22%3A%5B%22C6%27%22%5D%2C%22id%22%3A%22C7%27%22%7D%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22master%22%2C%22id%22%3A%22HEAD%22%7D%7D",
|
"goalTreeString": "%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22master%22%7D%2C%22bugFix%22%3A%7B%22target%22%3A%22C3%27%22%2C%22id%22%3A%22bugFix%22%7D%2C%22side%22%3A%7B%22target%22%3A%22C6%27%22%2C%22id%22%3A%22side%22%7D%2C%22another%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22another%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22parents%22%3A%5B%5D%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C1%22%7D%2C%22C2%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C2%22%7D%2C%22C3%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C3%22%7D%2C%22C4%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C4%22%7D%2C%22C5%22%3A%7B%22parents%22%3A%5B%22C4%22%5D%2C%22id%22%3A%22C5%22%7D%2C%22C6%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C6%22%7D%2C%22C7%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C7%22%7D%2C%22C3%27%22%3A%7B%22parents%22%3A%5B%22C2%22%5D%2C%22id%22%3A%22C3%27%22%7D%2C%22C4%27%22%3A%7B%22parents%22%3A%5B%22C3%27%22%5D%2C%22id%22%3A%22C4%27%22%7D%2C%22C5%27%22%3A%7B%22parents%22%3A%5B%22C4%27%22%5D%2C%22id%22%3A%22C5%27%22%7D%2C%22C6%27%22%3A%7B%22parents%22%3A%5B%22C5%27%22%5D%2C%22id%22%3A%22C6%27%22%7D%2C%22C7%27%22%3A%7B%22parents%22%3A%5B%22C6%27%22%5D%2C%22id%22%3A%22C7%27%22%7D%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22master%22%2C%22id%22%3A%22HEAD%22%7D%7D",
|
||||||
"solutionCommand": "git checkout bugFix;git rebase master;git checkout side;git rebase bugFix;git checkout another;git rebase side;git rebase another master",
|
"solutionCommand": "git checkout bugFix;git rebase master;git checkout side;git rebase bugFix;git checkout another;git rebase side;git rebase another master",
|
||||||
|
|
1
build/bundle.min.19698afc.js
Normal file
1
build/bundle.min.19698afc.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
build/bundle.min.js
vendored
2
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -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.f6846e91.js"></script>
|
<script src="build/bundle.min.19698afc.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
|
||||||
|
|
|
@ -16,6 +16,7 @@ var GitError = Errors.GitError;
|
||||||
var CommandResult = Errors.CommandResult;
|
var CommandResult = Errors.CommandResult;
|
||||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||||
|
|
||||||
|
var ORIGIN_PREFIX = 'o/';
|
||||||
|
|
||||||
function GitEngine(options) {
|
function GitEngine(options) {
|
||||||
this.rootCommit = null;
|
this.rootCommit = null;
|
||||||
|
@ -345,19 +346,25 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
||||||
_.each(originTree.branches, function(branchJSON, branchName) {
|
_.each(originTree.branches, function(branchJSON, branchName) {
|
||||||
var originTarget = branchJSON.target;
|
var originTarget = branchJSON.target;
|
||||||
var originBranch = this.makeBranch(
|
var originBranch = this.makeBranch(
|
||||||
'o/' + branchName,
|
ORIGIN_PREFIX + branchName,
|
||||||
this.getCommitFromRef(originTarget)
|
this.getCommitFromRef(originTarget)
|
||||||
);
|
);
|
||||||
originBranch.set('remote', true);
|
|
||||||
// TODO
|
this.setLocalToTrackRemote(this.refs[branchJSON.id], originBranch);
|
||||||
this.setLocalToTrackRemote();
|
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch) {
|
GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch) {
|
||||||
this.command.addWarning(
|
remoteBranch.addLocalBranchThatTracksThis(localBranch);
|
||||||
'local branch set to track remote branch'
|
localBranch.setRemoteTrackingBranchID(remoteBranch.get('id'));
|
||||||
);
|
|
||||||
|
// same for local
|
||||||
|
var msg = 'local branch "' +
|
||||||
|
localBranch.get('id') +
|
||||||
|
'" set to track remote branch "' +
|
||||||
|
remoteBranch.get('id') +
|
||||||
|
'"';
|
||||||
|
this.command.addWarning(msg);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||||
|
@ -871,7 +878,7 @@ GitEngine.prototype.push = function(options) {
|
||||||
return this.animationFactory.playRefreshAnimation(this.origin.gitVisuals);
|
return this.animationFactory.playRefreshAnimation(this.origin.gitVisuals);
|
||||||
}, this));
|
}, this));
|
||||||
|
|
||||||
// HAX HAX update o/master
|
// HAX HAX update master and remote tracking for master
|
||||||
chain = chain.then(_.bind(function() {
|
chain = chain.then(_.bind(function() {
|
||||||
var localCommit = this.getCommitFromRef(localBranch);
|
var localCommit = this.getCommitFromRef(localBranch);
|
||||||
var remoteBranchID = localBranch.getRemoteBranchID();
|
var remoteBranchID = localBranch.getRemoteBranchID();
|
||||||
|
@ -890,16 +897,26 @@ GitEngine.prototype.fetch = function(options) {
|
||||||
var localBranch = this.refs['o/master'];
|
var localBranch = this.refs['o/master'];
|
||||||
var remoteBranch = this.origin.refs['master'];
|
var remoteBranch = this.origin.refs['master'];
|
||||||
|
|
||||||
// first check if this is even allowed by checking the sync between
|
// fetch all local branches
|
||||||
this.checkUpstreamOfSource(
|
var allRemotes = this.branchCollection.filter(function(branch) {
|
||||||
this,
|
return branch.getIsRemote();
|
||||||
this.origin,
|
});
|
||||||
localBranch,
|
console.log(allRemotes);
|
||||||
remoteBranch
|
|
||||||
);
|
// first check if our local remote branch is upstream of the origin branch set.
|
||||||
|
// this check essentially pretends the local remote branch is in origin and
|
||||||
|
// could be fast forwarded (basic sanity check)
|
||||||
|
_.each(allRemotes, function(localRemoteBranch) {
|
||||||
|
this.checkUpstreamOfSource(
|
||||||
|
this,
|
||||||
|
this.origin,
|
||||||
|
localRemoteBranch,
|
||||||
|
localRemoteBranch.getRemoteBranchFromEngine(this.origin)
|
||||||
|
);
|
||||||
|
}, this);
|
||||||
|
|
||||||
// then we get the difference in commits between these two graphs, ordered by
|
// then we get the difference in commits between these two graphs, ordered by
|
||||||
// depth
|
// depth. TODO -- make work for all branches
|
||||||
var commitsToMake = this.getTargetGraphDifference(
|
var commitsToMake = this.getTargetGraphDifference(
|
||||||
this,
|
this,
|
||||||
this.origin,
|
this.origin,
|
||||||
|
@ -2266,12 +2283,22 @@ var Branch = Ref.extend({
|
||||||
this.set('type', 'branch');
|
this.set('type', 'branch');
|
||||||
},
|
},
|
||||||
|
|
||||||
setLocalBranchesThatTrackThis: function(branches) {
|
/**
|
||||||
this.set('localBranchesThatTrackThis', branches);
|
* Here is the deal -- there are essentially three types of branches
|
||||||
|
* we deal with:
|
||||||
|
* 1) Normal local branches (that may track a remote branch)
|
||||||
|
* 2) Local remote branches (o/master) that track an origin branch
|
||||||
|
* 3) Origin branches (master) that exist in origin
|
||||||
|
*
|
||||||
|
* With that in mind, we change our branch model to support the following
|
||||||
|
*/
|
||||||
|
|
||||||
|
setRemoteTrackingBranchID: function(id) {
|
||||||
|
this.set('remoteTrackingBranchID', id);
|
||||||
},
|
},
|
||||||
|
|
||||||
getLocalBranchesThatTrackThis: function() {
|
getRemoteTrackingBranchID: function() {
|
||||||
return this.get('localBranchesThatTrackThis') || [];
|
return this.get('remoteTrackingBranchID');
|
||||||
},
|
},
|
||||||
|
|
||||||
addLocalBranchThatTracksThis: function(localBranch) {
|
addLocalBranchThatTracksThis: function(localBranch) {
|
||||||
|
@ -2280,15 +2307,27 @@ var Branch = Ref.extend({
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
setLocalBranchesThatTrackThis: function(branches) {
|
||||||
|
this.set('localBranchesThatTrackThis', branches);
|
||||||
|
},
|
||||||
|
|
||||||
|
getLocalBranchesThatTrackThis: function() {
|
||||||
|
return this.get('localBranchesThatTrackThis') || [];
|
||||||
|
},
|
||||||
|
|
||||||
getRemoteBranchID: function() {
|
getRemoteBranchID: function() {
|
||||||
if (this.getIsRemote()) {
|
if (this.getIsRemote()) {
|
||||||
throw new Error('I am a remote branch! dont try to get remote from me');
|
throw new Error('I am a remote branch! dont try to get remote from me');
|
||||||
}
|
}
|
||||||
return 'o/' + this.get('id');
|
return ORIGIN_PREFIX + this.get('id');
|
||||||
|
},
|
||||||
|
|
||||||
|
getRemoteBranchFromEngine: function(engine) {
|
||||||
|
return engine.refs[this.getRemoteBranchID()];
|
||||||
},
|
},
|
||||||
|
|
||||||
getIsRemote: function() {
|
getIsRemote: function() {
|
||||||
return !!this.get('remote');
|
return this.get('id').slice(0, 2) === ORIGIN_PREFIX;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
exports.level = {
|
exports.level = {
|
||||||
"compareOnlyMasterHashAgnostic": true,
|
"compareOnlyMasterHashAgnostic": true,
|
||||||
"disabledMap": {
|
"disabledMap": {
|
||||||
"git revert": true
|
"git revert": true,
|
||||||
|
"git cherry-pick": true
|
||||||
},
|
},
|
||||||
"goalTreeString": "%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22master%22%7D%2C%22bugFix%22%3A%7B%22target%22%3A%22C3%27%22%2C%22id%22%3A%22bugFix%22%7D%2C%22side%22%3A%7B%22target%22%3A%22C6%27%22%2C%22id%22%3A%22side%22%7D%2C%22another%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22another%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22parents%22%3A%5B%5D%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C1%22%7D%2C%22C2%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C2%22%7D%2C%22C3%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C3%22%7D%2C%22C4%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C4%22%7D%2C%22C5%22%3A%7B%22parents%22%3A%5B%22C4%22%5D%2C%22id%22%3A%22C5%22%7D%2C%22C6%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C6%22%7D%2C%22C7%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C7%22%7D%2C%22C3%27%22%3A%7B%22parents%22%3A%5B%22C2%22%5D%2C%22id%22%3A%22C3%27%22%7D%2C%22C4%27%22%3A%7B%22parents%22%3A%5B%22C3%27%22%5D%2C%22id%22%3A%22C4%27%22%7D%2C%22C5%27%22%3A%7B%22parents%22%3A%5B%22C4%27%22%5D%2C%22id%22%3A%22C5%27%22%7D%2C%22C6%27%22%3A%7B%22parents%22%3A%5B%22C5%27%22%5D%2C%22id%22%3A%22C6%27%22%7D%2C%22C7%27%22%3A%7B%22parents%22%3A%5B%22C6%27%22%5D%2C%22id%22%3A%22C7%27%22%7D%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22master%22%2C%22id%22%3A%22HEAD%22%7D%7D",
|
"goalTreeString": "%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22master%22%7D%2C%22bugFix%22%3A%7B%22target%22%3A%22C3%27%22%2C%22id%22%3A%22bugFix%22%7D%2C%22side%22%3A%7B%22target%22%3A%22C6%27%22%2C%22id%22%3A%22side%22%7D%2C%22another%22%3A%7B%22target%22%3A%22C7%27%22%2C%22id%22%3A%22another%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22parents%22%3A%5B%5D%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C1%22%7D%2C%22C2%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C2%22%7D%2C%22C3%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C3%22%7D%2C%22C4%22%3A%7B%22parents%22%3A%5B%22C0%22%5D%2C%22id%22%3A%22C4%22%7D%2C%22C5%22%3A%7B%22parents%22%3A%5B%22C4%22%5D%2C%22id%22%3A%22C5%22%7D%2C%22C6%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C6%22%7D%2C%22C7%22%3A%7B%22parents%22%3A%5B%22C5%22%5D%2C%22id%22%3A%22C7%22%7D%2C%22C3%27%22%3A%7B%22parents%22%3A%5B%22C2%22%5D%2C%22id%22%3A%22C3%27%22%7D%2C%22C4%27%22%3A%7B%22parents%22%3A%5B%22C3%27%22%5D%2C%22id%22%3A%22C4%27%22%7D%2C%22C5%27%22%3A%7B%22parents%22%3A%5B%22C4%27%22%5D%2C%22id%22%3A%22C5%27%22%7D%2C%22C6%27%22%3A%7B%22parents%22%3A%5B%22C5%27%22%5D%2C%22id%22%3A%22C6%27%22%7D%2C%22C7%27%22%3A%7B%22parents%22%3A%5B%22C6%27%22%5D%2C%22id%22%3A%22C7%27%22%7D%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22master%22%2C%22id%22%3A%22HEAD%22%7D%7D",
|
||||||
"solutionCommand": "git checkout bugFix;git rebase master;git checkout side;git rebase bugFix;git checkout another;git rebase side;git rebase another master",
|
"solutionCommand": "git checkout bugFix;git rebase master;git checkout side;git rebase bugFix;git checkout another;git rebase side;git rebase another master",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue