mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-08-01 08:35:32 +02:00
merge master
This commit is contained in:
commit
5a8762f2ac
5 changed files with 37 additions and 6 deletions
|
@ -49,6 +49,18 @@ describe('Tree Compare', function() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('compares with considering leftover branches', function() {
|
||||||
|
testMethod(
|
||||||
|
{
|
||||||
|
compareAllBranchesAndEnforceBranchCleanup: true,
|
||||||
|
},
|
||||||
|
'{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":null},"foo":{"target":"C2","id":"foo","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"tags":{},"HEAD":{"target":"foo","id":"HEAD"}}',
|
||||||
|
{
|
||||||
|
'{"branches":{"master":{"target":"C2","id":"master","remoteTrackingBranchID":null},"foo":{"target":"C2","id":"foo","remoteTrackingBranchID":null},"randoBran":{"target":"C2","id":"randoBran","remoteTrackingBranchID":null}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"tags":{},"HEAD":{"target":"foo","id":"HEAD"}}': false,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('deep compares on origin tree', function() {
|
it('deep compares on origin tree', function() {
|
||||||
testMethod(
|
testMethod(
|
||||||
{}, // checked for all methods so this doesn't matter
|
{}, // checked for all methods so this doesn't matter
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
"flux": "^3.1.3",
|
"flux": "^3.1.3",
|
||||||
"jquery": "^3.4.0",
|
"jquery": "^3.4.0",
|
||||||
"jquery-ui": "^1.12.1",
|
"jquery-ui": "^1.12.1",
|
||||||
"jquery-ui-sortable-npm": "^1.0.0",
|
|
||||||
"markdown": "^0.5.0",
|
"markdown": "^0.5.0",
|
||||||
"prop-types": "^15.7.2",
|
"prop-types": "^15.7.2",
|
||||||
"q": "^1.5.1",
|
"q": "^1.5.1",
|
||||||
|
|
|
@ -54,6 +54,10 @@ TreeCompare.dispatchShallow = function(levelBlob, goalTreeString, treeToCompare)
|
||||||
return TreeCompare.compareBranchWithinTrees(
|
return TreeCompare.compareBranchWithinTrees(
|
||||||
treeToCompare, goalTreeString, 'master'
|
treeToCompare, goalTreeString, 'master'
|
||||||
);
|
);
|
||||||
|
case !!levelBlob.compareAllBranchesAndEnforceBranchCleanup:
|
||||||
|
return TreeCompare.compareAllBranchesAndEnforceBranchCleanup(
|
||||||
|
treeToCompare, goalTreeString
|
||||||
|
);
|
||||||
case !!levelBlob.compareOnlyBranches:
|
case !!levelBlob.compareOnlyBranches:
|
||||||
return TreeCompare.compareAllBranchesWithinTrees(
|
return TreeCompare.compareAllBranchesWithinTrees(
|
||||||
treeToCompare, goalTreeString
|
treeToCompare, goalTreeString
|
||||||
|
@ -88,6 +92,26 @@ TreeCompare.compareAllBranchesWithinTreesAndHEAD = function(treeToCompare, goalT
|
||||||
this.compareAllTagsWithinTrees(treeToCompare, goalTree);
|
this.compareAllTagsWithinTrees(treeToCompare, goalTree);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TreeCompare.compareAllBranchesAndEnforceBranchCleanup = function(treeToCompare, goalTree) {
|
||||||
|
treeToCompare = this.convertTreeSafe(treeToCompare);
|
||||||
|
goalTree = this.convertTreeSafe(goalTree);
|
||||||
|
|
||||||
|
// Unlike compareAllBranchesWithinTrees, here we consider both the branches
|
||||||
|
// in the goalTree and the branches in the treeToCompare. This means that
|
||||||
|
// we enfoce that you clean up any branches that you have locally that
|
||||||
|
// the goal does not have. this is helpful when we want to verify that you
|
||||||
|
// have deleted branch, for instance.
|
||||||
|
var allBranches = Object.assign(
|
||||||
|
{},
|
||||||
|
treeToCompare.branches,
|
||||||
|
goalTree.branches
|
||||||
|
);
|
||||||
|
return Object.keys(allBranches).every(function(branch) {
|
||||||
|
return this.compareBranchWithinTrees(treeToCompare, goalTree, branch);
|
||||||
|
}.bind(this));
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
TreeCompare.compareAllBranchesWithinTrees = function(treeToCompare, goalTree) {
|
TreeCompare.compareAllBranchesWithinTrees = function(treeToCompare, goalTree) {
|
||||||
treeToCompare = this.convertTreeSafe(treeToCompare);
|
treeToCompare = this.convertTreeSafe(treeToCompare);
|
||||||
goalTree = this.convertTreeSafe(goalTree);
|
goalTree = this.convertTreeSafe(goalTree);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
exports.level = {
|
exports.level = {
|
||||||
|
"compareAllBranchesAndEnforceBranchCleanup": true,
|
||||||
"disabledMap": {
|
"disabledMap": {
|
||||||
"git branch": true,
|
"git branch": true,
|
||||||
"git checkout": true
|
"git checkout": true
|
||||||
|
|
|
@ -2563,11 +2563,6 @@ jasmine@^3.1.0:
|
||||||
glob "^7.1.4"
|
glob "^7.1.4"
|
||||||
jasmine-core "~3.5.0"
|
jasmine-core "~3.5.0"
|
||||||
|
|
||||||
jquery-ui-sortable-npm@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/jquery-ui-sortable-npm/-/jquery-ui-sortable-npm-1.0.0.tgz#5fa27c36b76d1fbd45de9e24a0c940c19ba1f6ce"
|
|
||||||
integrity sha1-X6J8NrdtH71F3p4koMlAwZuh9s4=
|
|
||||||
|
|
||||||
jquery-ui@^1.12.1:
|
jquery-ui@^1.12.1:
|
||||||
version "1.12.1"
|
version "1.12.1"
|
||||||
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.12.1.tgz#bcb4045c8dd0539c134bc1488cdd3e768a7a9e51"
|
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.12.1.tgz#bcb4045c8dd0539c134bc1488cdd3e768a7a9e51"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue