mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 16:38:50 +02:00
refactor: replace all master to main
This commit is contained in:
parent
4148f0b846
commit
b7ac2851c6
55 changed files with 431 additions and 455 deletions
|
@ -187,36 +187,36 @@ var initDemo = function(sandbox) {
|
|||
|
||||
if (params.hasOwnProperty('demo')) {
|
||||
commands = [
|
||||
"git commit; git checkout -b bugFix C1; git commit; git merge master; git checkout master; git commit; git rebase bugFix;",
|
||||
"git commit; git checkout -b bugFix C1; git commit; git merge main; git checkout main; git commit; git rebase bugFix;",
|
||||
"delay 1000; reset;",
|
||||
"level advanced1 --noFinishDialog --noStartCommand --noIntroDialog;",
|
||||
"delay 2000; show goal; delay 1000; hide goal;",
|
||||
"git checkout bugFix; git rebase master; git checkout side; git rebase bugFix;",
|
||||
"git checkout another; git rebase side; git rebase another master;",
|
||||
"git checkout bugFix; git rebase main; git checkout side; git rebase bugFix;",
|
||||
"git checkout another; git rebase side; git rebase another main;",
|
||||
"help; levels"
|
||||
];
|
||||
} else if (params.hasOwnProperty('hgdemo')) {
|
||||
commands = [
|
||||
'importTreeNow {"branches":{"master":{"target":"C3","id":"master"},"feature":{"target":"C2","id":"feature"},"debug":{"target":"C4","id":"debug"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C1"],"id":"C3"},"C4":{"parents":["C2"],"id":"C4"}},"HEAD":{"target":"feature","id":"HEAD"}}',
|
||||
'importTreeNow {"branches":{"main":{"target":"C3","id":"main"},"feature":{"target":"C2","id":"feature"},"debug":{"target":"C4","id":"debug"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C1"],"id":"C3"},"C4":{"parents":["C2"],"id":"C4"}},"HEAD":{"target":"feature","id":"HEAD"}}',
|
||||
'delay 1000',
|
||||
'git rebase master',
|
||||
'git rebase main',
|
||||
'delay 1000',
|
||||
'undo',
|
||||
'hg book',
|
||||
'delay 1000',
|
||||
'hg rebase -d master'
|
||||
'hg rebase -d main'
|
||||
];
|
||||
commands = commands.join(';#').split('#'); // hax
|
||||
} else if (params.hasOwnProperty('hgdemo2')) {
|
||||
commands = [
|
||||
'importTreeNow {"branches":{"master":{"target":"C3","id":"master"},"feature":{"target":"C2","id":"feature"},"debug":{"target":"C4","id":"debug"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C1"],"id":"C3"},"C4":{"parents":["C2"],"id":"C4"}},"HEAD":{"target":"debug","id":"HEAD"}}',
|
||||
'importTreeNow {"branches":{"main":{"target":"C3","id":"main"},"feature":{"target":"C2","id":"feature"},"debug":{"target":"C4","id":"debug"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"},"C3":{"parents":["C1"],"id":"C3"},"C4":{"parents":["C2"],"id":"C4"}},"HEAD":{"target":"debug","id":"HEAD"}}',
|
||||
'delay 1000',
|
||||
'git rebase master',
|
||||
'git rebase main',
|
||||
'delay 1000',
|
||||
'undo',
|
||||
'hg sum',
|
||||
'delay 1000',
|
||||
'hg rebase -d master'
|
||||
'hg rebase -d main'
|
||||
];
|
||||
commands = commands.join(';#').split('#'); // hax
|
||||
} else if (params.hasOwnProperty('remoteDemo')) {
|
||||
|
|
|
@ -20,7 +20,7 @@ exports.dialog = {
|
|||
'Try out ',
|
||||
'[this special link](https://pcottle.github.io/learnGitBranching/?NODEMO)',
|
||||
'',
|
||||
'PPS: GitHub (and the industry at large) is moving to naming the default branch as `main` instead of `master` ',
|
||||
'PPS: GitHub (and the industry at large) is moving to naming the default branch as `main` instead of `main` ',
|
||||
'with [more details available here](https://github.com/github/renaming). In order to accommodate this change in ',
|
||||
'a backwards-compatible way, these two names will be considered aliases of each other, with `main` being ',
|
||||
'the preferred one to display. We\'ve made a best-effort attempt to update all of the level content, but ',
|
||||
|
@ -803,7 +803,7 @@ exports.dialog = {
|
|||
'அப்படியானால் பின் வரும் இணைப்பை பயன்பாடித்துக ',
|
||||
'[this special link](https://pcottle.github.io/learnGitBranching/?NODEMO)',
|
||||
'',
|
||||
'பின்குறிப்பு: GitHub (பெரிய அளவில் பயன்பாட்டில் உள்ள இணையதலம்) `main` என்ற கிளையை `master`-க்கு பதில் ',
|
||||
'பின்குறிப்பு: GitHub (பெரிய அளவில் பயன்பாட்டில் உள்ள இணையதலம்) `main` என்ற கிளையை `main`-க்கு பதில் ',
|
||||
'முன்னிருப்பு கிளையாக பயன் படுத்த உள்ளது [more details available here](https://github.com/github/renaming). ',
|
||||
'இந்த மாற்றத்தை பின்னோக்கி இணக்கமான வழியில் பொருத்துவதற்காக, `main`-ஐ முதன்மையாக கருதி ',
|
||||
'இந்த இரண்டு பெயர்களும் ஒன்றுக்கொன்று மாற்றுப்பெயர்களாகக் கருதப்படும். ',
|
||||
|
@ -835,7 +835,7 @@ exports.dialog = {
|
|||
"Prova ",
|
||||
"[questo link](https://pcottle.github.io/learnGitBranching/?NODEMO?locale=it_IT)",
|
||||
"",
|
||||
"PPS: GitHub (e il settore in generale) sta modificando il nome del ramo di default in `main` invece che `master` ",
|
||||
"PPS: GitHub (e il settore in generale) sta modificando il nome del ramo di default in `main` invece che `main` ",
|
||||
"leggi [qui per ulteriori dettagli](https://github.com/github/renaming). In modo da adattare questo cambiamento ",
|
||||
"e tenere la retrocompatibilità , questi nomi saranno considerati equivalenti. `main` sarà comunque ",
|
||||
"il nome predefinito. Ci siamo impegnati per aggiornare tutti i livelli, ma ci sarà ",
|
||||
|
@ -846,4 +846,3 @@ exports.dialog = {
|
|||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ var commandConfig = {
|
|||
} else if (firstArg) {
|
||||
source = firstArg;
|
||||
assertIsBranch(engine.origin, source);
|
||||
// get o/master locally if master is specified
|
||||
// get o/main locally if main is specified
|
||||
destination = engine.origin.resolveID(source).getPrefixedID();
|
||||
} else {
|
||||
// can't be detached
|
||||
|
@ -296,7 +296,7 @@ var commandConfig = {
|
|||
switch (generalArgs.length) {
|
||||
// git fakeTeamwork
|
||||
case 0:
|
||||
branch = 'master';
|
||||
branch = 'main';
|
||||
numToMake = 1;
|
||||
break;
|
||||
|
||||
|
@ -307,7 +307,7 @@ var commandConfig = {
|
|||
numToMake = 1;
|
||||
} else {
|
||||
numToMake = parseInt(generalArgs[0], 10);
|
||||
branch = 'master';
|
||||
branch = 'main';
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -393,7 +393,7 @@ var commandConfig = {
|
|||
// technically we have a destination here as the remote branch
|
||||
source = firstArg;
|
||||
assertIsBranch(engine.origin, source);
|
||||
// get o/master locally if master is specified
|
||||
// get o/main locally if main is specified
|
||||
destination = engine.origin.resolveID(source).getPrefixedID();
|
||||
}
|
||||
if (source) { // empty string fails this check
|
||||
|
|
|
@ -137,14 +137,14 @@ GitEngine.prototype.defaultInit = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.init = function() {
|
||||
// make an initial commit and a master branch
|
||||
// make an initial commit and a main branch
|
||||
this.rootCommit = this.makeCommit(null, null, {rootCommit: true});
|
||||
this.commitCollection.add(this.rootCommit);
|
||||
|
||||
var master = this.makeBranch('master', this.rootCommit);
|
||||
var main = this.makeBranch('main', this.rootCommit);
|
||||
this.HEAD = new Ref({
|
||||
id: 'HEAD',
|
||||
target: master
|
||||
target: main
|
||||
});
|
||||
this.refs[this.HEAD.get('id')] = this.HEAD;
|
||||
|
||||
|
@ -330,7 +330,7 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
|||
msg: intl.str('git-error-origin-exists')
|
||||
});
|
||||
}
|
||||
treeString = treeString || this.printTree(this.exportTreeForBranch('master'));
|
||||
treeString = treeString || this.printTree(this.exportTreeForBranch('main'));
|
||||
|
||||
// this is super super ugly but a necessary hack because of the way LGB was
|
||||
// originally designed. We need to get to the top level visualization from
|
||||
|
@ -338,8 +338,8 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
|||
// visualization and ask the main vis to create a new vis/git pair. Then
|
||||
// we grab the gitengine out of that and assign that as our origin repo
|
||||
// which connects the two. epic
|
||||
var masterVis = this.gitVisuals.getVisualization();
|
||||
var originVis = masterVis.makeOrigin({
|
||||
var mainVis = this.gitVisuals.getVisualization();
|
||||
var originVis = mainVis.makeOrigin({
|
||||
localRepo: this,
|
||||
treeString: treeString
|
||||
});
|
||||
|
@ -480,9 +480,9 @@ GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch)
|
|||
}
|
||||
|
||||
var msg = 'local branch "' +
|
||||
this.postProcessBranchID(localBranch.get('id')) +
|
||||
localBranch.get('id') +
|
||||
'" set to track remote branch "' +
|
||||
this.postProcessBranchID(remoteBranch.get('id')) +
|
||||
remoteBranch.get('id') +
|
||||
'"';
|
||||
this.command.addWarning(intl.todo(msg));
|
||||
};
|
||||
|
@ -694,19 +694,7 @@ GitEngine.prototype.validateAndMakeTag = function(id, target) {
|
|||
this.makeTag(id, target);
|
||||
};
|
||||
|
||||
GitEngine.prototype.postProcessBranchID = function(id) {
|
||||
if (id.match(/\bmaster\b/)) {
|
||||
id = id.replace(/\bmaster\b/, 'main');
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
GitEngine.prototype.makeBranch = function(id, target) {
|
||||
// all main branches are stored as master under the hood
|
||||
if (id.match(/\bmain\b/)) {
|
||||
id = id.replace(/\bmain\b/, 'master');
|
||||
}
|
||||
|
||||
if (this.refs[id]) {
|
||||
var err = new Error();
|
||||
throw new Error('woah already have that ref ' + id + ' ' + err.stack);
|
||||
|
@ -1141,8 +1129,8 @@ GitEngine.prototype.push = function(options) {
|
|||
}
|
||||
}
|
||||
|
||||
// now here is the tricky part -- the difference between local master
|
||||
// and remote master might be commits C2, C3, and C4, but the remote
|
||||
// now here is the tricky part -- the difference between local main
|
||||
// and remote main might be commits C2, C3, and C4, but the remote
|
||||
// might already have those commits. In this case, we don't need to
|
||||
// make them, so filter these out
|
||||
commitsToMake = commitsToMake.filter(function(commitJSON) {
|
||||
|
@ -1195,7 +1183,7 @@ GitEngine.prototype.push = function(options) {
|
|||
return this.animationFactory.playRefreshAnimation(this.origin.gitVisuals);
|
||||
}.bind(this));
|
||||
|
||||
// HAX HAX update master and remote tracking for master
|
||||
// HAX HAX update main and remote tracking for main
|
||||
chain = chain.then(function() {
|
||||
var localCommit = this.getCommitFromRef(sourceLocation);
|
||||
this.setTargetLocation(this.resolveID(ORIGIN_PREFIX + options.destination), localCommit);
|
||||
|
@ -1211,9 +1199,9 @@ GitEngine.prototype.pushDeleteRemoteBranch = function(
|
|||
remoteBranch,
|
||||
branchOnRemote
|
||||
) {
|
||||
if (branchOnRemote.get('id') === 'master') {
|
||||
if (branchOnRemote.get('id') === 'main') {
|
||||
throw new GitError({
|
||||
msg: intl.todo('You cannot delete master branch on remote!')
|
||||
msg: intl.todo('You cannot delete main branch on remote!')
|
||||
});
|
||||
}
|
||||
// ok so this isn't too bad -- we basically just:
|
||||
|
@ -1315,8 +1303,8 @@ GitEngine.prototype.fetchCore = function(sourceDestPairs, options) {
|
|||
commitsToMake = Graph.getUniqueObjects(commitsToMake);
|
||||
commitsToMake = Graph.descendSortDepth(commitsToMake);
|
||||
|
||||
// now here is the tricky part -- the difference between local master
|
||||
// and remote master might be commits C2, C3, and C4, but we
|
||||
// now here is the tricky part -- the difference between local main
|
||||
// and remote main might be commits C2, C3, and C4, but we
|
||||
// might already have those commits. In this case, we don't need to
|
||||
// make them, so filter these out
|
||||
commitsToMake = commitsToMake.filter(function(commitJSON) {
|
||||
|
@ -1446,7 +1434,7 @@ GitEngine.prototype.pullFinishWithRebase = function(
|
|||
}.bind(this));
|
||||
|
||||
chain = chain.then(function() {
|
||||
// highlight last commit on o/master to color of
|
||||
// highlight last commit on o/main to color of
|
||||
// local branch
|
||||
return this.animationFactory.playHighlightPromiseAnimation(
|
||||
this.getCommitFromRef(remoteBranch),
|
||||
|
@ -1511,7 +1499,7 @@ GitEngine.prototype.pullFinishWithMerge = function(
|
|||
}.bind(this));
|
||||
|
||||
chain = chain.then(function() {
|
||||
// highlight last commit on o/master to color of
|
||||
// highlight last commit on o/main to color of
|
||||
// local branch
|
||||
return this.animationFactory.playHighlightPromiseAnimation(
|
||||
this.getCommitFromRef(remoteBranch),
|
||||
|
@ -1520,7 +1508,7 @@ GitEngine.prototype.pullFinishWithMerge = function(
|
|||
}.bind(this));
|
||||
|
||||
chain = chain.then(function() {
|
||||
// highlight commit on master to color of remote
|
||||
// highlight commit on main to color of remote
|
||||
return this.animationFactory.playHighlightPromiseAnimation(
|
||||
this.getCommitFromRef(localBranch),
|
||||
remoteBranch
|
||||
|
@ -1617,7 +1605,7 @@ GitEngine.prototype.resolveNameNoPrefix = function(someRef) {
|
|||
return obj.get('id');
|
||||
}
|
||||
if (obj.get('type') == 'branch') {
|
||||
return obj.get('id').replace(/\bmaster\b/, 'main');
|
||||
return obj.get('id');
|
||||
}
|
||||
// we are dealing with HEAD
|
||||
return this.resolveNameNoPrefix(obj.get('target'));
|
||||
|
@ -1630,7 +1618,7 @@ GitEngine.prototype.resolveName = function(someRef) {
|
|||
return 'commit ' + obj.get('id');
|
||||
}
|
||||
if (obj.get('type') == 'branch') {
|
||||
return 'branch "' + obj.get('id').replace(/\bmaster\b/, 'main') + '"';
|
||||
return 'branch "' + obj.get('id') + '"';
|
||||
}
|
||||
// we are dealing with HEAD
|
||||
return this.resolveName(obj.get('target'));
|
||||
|
@ -1681,19 +1669,12 @@ GitEngine.prototype.resolveRelativeRef = function(commit, relative) {
|
|||
};
|
||||
|
||||
GitEngine.prototype.doesRefExist = function(ref) {
|
||||
if (ref.match(/\bmain\b/)) {
|
||||
ref = ref.replace(/\bmain\b/, 'master');
|
||||
}
|
||||
return !!this.refs[ref]
|
||||
};
|
||||
|
||||
GitEngine.prototype.resolveStringRef = function(ref) {
|
||||
ref = this.crappyUnescape(ref);
|
||||
|
||||
if (ref.match(/\bmain\b/)) {
|
||||
ref = ref.replace(/\bmain\b/, 'master');
|
||||
}
|
||||
|
||||
if (this.refs[ref]) {
|
||||
return this.refs[ref];
|
||||
}
|
||||
|
@ -2108,18 +2089,18 @@ GitEngine.prototype.hgRebase = function(destination, base) {
|
|||
moreSets.push(this.getDownstreamSet(id));
|
||||
}, this);
|
||||
|
||||
var masterSet = {};
|
||||
masterSet[baseCommit.get('id')] = true;
|
||||
var mainSet = {};
|
||||
mainSet[baseCommit.get('id')] = true;
|
||||
[upstream, downstream].concat(moreSets).forEach(function(set) {
|
||||
Object.keys(set).forEach(function(id) {
|
||||
masterSet[id] = true;
|
||||
mainSet[id] = true;
|
||||
});
|
||||
});
|
||||
|
||||
// we also need the branches POINTING to master set
|
||||
// we also need the branches POINTING to main set
|
||||
var branchMap = {};
|
||||
var upstreamSet = this.getUpstreamBranchSet();
|
||||
Object.keys(masterSet).forEach(function(commitID) {
|
||||
Object.keys(mainSet).forEach(function(commitID) {
|
||||
// now loop over that commits branches
|
||||
upstreamSet[commitID].forEach(function(branchJSON) {
|
||||
branchMap[branchJSON.id] = true;
|
||||
|
@ -2131,7 +2112,7 @@ GitEngine.prototype.hgRebase = function(destination, base) {
|
|||
chain = chain.then(function() {
|
||||
// now we just moved a bunch of commits, but we haven't updated the
|
||||
// dangling guys. lets do that and then prune
|
||||
var anyChange = this.updateCommitParentsForHgRebase(masterSet);
|
||||
var anyChange = this.updateCommitParentsForHgRebase(mainSet);
|
||||
if (!anyChange) {
|
||||
return;
|
||||
}
|
||||
|
@ -2638,7 +2619,7 @@ GitEngine.prototype.validateAndDeleteBranch = function(name) {
|
|||
var target = this.resolveID(name);
|
||||
|
||||
if (target.get('type') !== 'branch' ||
|
||||
target.get('id') == 'master' ||
|
||||
target.get('id') == 'main' ||
|
||||
this.HEAD.get('target') === target) {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-branch')
|
||||
|
@ -2663,7 +2644,7 @@ GitEngine.prototype.deleteBranch = function(branch) {
|
|||
// also in some cases external engines call our delete, so
|
||||
// verify integrity of HEAD here
|
||||
if (this.HEAD.get('target') === branch) {
|
||||
this.HEAD.set('target', this.refs['master']);
|
||||
this.HEAD.set('target', this.refs['main']);
|
||||
}
|
||||
|
||||
if (branch.get('visBranch')) {
|
||||
|
@ -2910,8 +2891,8 @@ var Branch = Ref.extend({
|
|||
* 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
|
||||
* 2) Local remote branches (o/main) that track an origin branch
|
||||
* 3) Origin branches (main) that exist in origin
|
||||
*
|
||||
* With that in mind, we change our branch model to support the following
|
||||
*/
|
||||
|
|
|
@ -160,7 +160,7 @@ var Graph = {
|
|||
},
|
||||
|
||||
getDefaultTree: function() {
|
||||
return JSON.parse(unescape("%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C1%22%2C%22id%22%3A%22master%22%2C%22type%22%3A%22branch%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%22C0%22%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C1%22%7D%7D%2C%22HEAD%22%3A%7B%22id%22%3A%22HEAD%22%2C%22target%22%3A%22master%22%2C%22type%22%3A%22general%20ref%22%7D%7D"));
|
||||
return JSON.parse(unescape("%7B%22branches%22%3A%7B%22main%22%3A%7B%22target%22%3A%22C1%22%2C%22id%22%3A%22main%22%2C%22type%22%3A%22branch%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%22C0%22%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C1%22%7D%7D%2C%22HEAD%22%3A%7B%22id%22%3A%22HEAD%22%2C%22target%22%3A%22main%22%2C%22type%22%3A%22general%20ref%22%7D%7D"));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@ TreeCompare.dispatchFromLevel = function(levelBlob, treeToCompare) {
|
|||
return TreeCompare.dispatch(levelBlob, goalTreeString, treeToCompare);
|
||||
};
|
||||
|
||||
TreeCompare.onlyMasterCompared = function(levelBlob) {
|
||||
TreeCompare.onlyMainCompared = function(levelBlob) {
|
||||
var getAroundLintTrue = true;
|
||||
switch (getAroundLintTrue) {
|
||||
case !!levelBlob.compareOnlyMaster:
|
||||
case !!levelBlob.compareOnlyMasterHashAgnostic:
|
||||
case !!levelBlob.compareOnlyMasterHashAgnosticWithAsserts:
|
||||
case !!levelBlob.compareOnlyMain:
|
||||
case !!levelBlob.compareOnlyMainHashAgnostic:
|
||||
case !!levelBlob.compareOnlyMainHashAgnosticWithAsserts:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
@ -50,9 +50,9 @@ TreeCompare.dispatchShallow = function(levelBlob, goalTreeString, treeToCompare)
|
|||
var getAroundLintTrue = true;
|
||||
// i actually prefer this to else if
|
||||
switch (getAroundLintTrue) {
|
||||
case !!levelBlob.compareOnlyMaster:
|
||||
case !!levelBlob.compareOnlyMain:
|
||||
return TreeCompare.compareBranchWithinTrees(
|
||||
treeToCompare, goalTreeString, 'master'
|
||||
treeToCompare, goalTreeString, 'main'
|
||||
);
|
||||
case !!levelBlob.compareAllBranchesAndEnforceBranchCleanup:
|
||||
return TreeCompare.compareAllBranchesAndEnforceBranchCleanup(
|
||||
|
@ -66,13 +66,13 @@ TreeCompare.dispatchShallow = function(levelBlob, goalTreeString, treeToCompare)
|
|||
return TreeCompare.compareAllBranchesWithinTreesHashAgnostic(
|
||||
treeToCompare, goalTreeString
|
||||
);
|
||||
case !!levelBlob.compareOnlyMasterHashAgnostic:
|
||||
case !!levelBlob.compareOnlyMainHashAgnostic:
|
||||
return TreeCompare.compareBranchesWithinTreesHashAgnostic(
|
||||
treeToCompare, goalTreeString, ['master']
|
||||
treeToCompare, goalTreeString, ['main']
|
||||
);
|
||||
case !!levelBlob.compareOnlyMasterHashAgnosticWithAsserts:
|
||||
case !!levelBlob.compareOnlyMainHashAgnosticWithAsserts:
|
||||
return TreeCompare.compareBranchesWithinTreesHashAgnostic(
|
||||
treeToCompare, goalTreeString, ['master']
|
||||
treeToCompare, goalTreeString, ['main']
|
||||
) && TreeCompare.evalAsserts(treeToCompare, levelBlob.goalAsserts);
|
||||
default:
|
||||
return TreeCompare.compareAllBranchesWithinTreesAndHEAD(
|
||||
|
@ -98,7 +98,7 @@ TreeCompare.compareAllBranchesAndEnforceBranchCleanup = function(treeToCompare,
|
|||
|
||||
// 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
|
||||
// we enforce 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(
|
||||
|
|
|
@ -79,7 +79,7 @@ var LevelBuilder = Level.extend({
|
|||
initGoalData: function() {
|
||||
// add some default behavior in the beginning if we are not editing
|
||||
if (!this.options.editLevel) {
|
||||
this.level.goalTreeString = '{"branches":{"master":{"target":"C1","id":"master"},"makeLevel":{"target":"C2","id":"makeLevel"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"makeLevel","id":"HEAD"}}';
|
||||
this.level.goalTreeString = '{"branches":{"main":{"target":"C1","id":"main"},"makeLevel":{"target":"C2","id":"makeLevel"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"makeLevel","id":"HEAD"}}';
|
||||
this.level.solutionCommand = 'git checkout -b makeLevel; git commit';
|
||||
}
|
||||
LevelBuilder.__super__.initGoalData.apply(this, arguments);
|
||||
|
@ -294,8 +294,8 @@ var LevelBuilder = Level.extend({
|
|||
this.defineName();
|
||||
}
|
||||
|
||||
var masterDeferred = Q.defer();
|
||||
var chain = masterDeferred.promise;
|
||||
var mainDeferred = Q.defer();
|
||||
var chain = mainDeferred.promise;
|
||||
|
||||
if (this.level.hint === undefined) {
|
||||
var askForHintDeferred = Q.defer();
|
||||
|
@ -355,7 +355,7 @@ var LevelBuilder = Level.extend({
|
|||
command.finishWith(deferred);
|
||||
}.bind(this));
|
||||
|
||||
masterDeferred.resolve();
|
||||
mainDeferred.resolve();
|
||||
},
|
||||
|
||||
getExportObj: function() {
|
||||
|
|
|
@ -197,10 +197,10 @@ var Level = Sandbox.extend({
|
|||
},
|
||||
|
||||
initGoalVisualization: function() {
|
||||
var onlyMaster = TreeCompare.onlyMasterCompared(this.level);
|
||||
var onlyMain = TreeCompare.onlyMainCompared(this.level);
|
||||
// first we make the goal visualization holder
|
||||
this.goalCanvasHolder = new CanvasTerminalHolder({
|
||||
text: (onlyMaster) ? intl.str('goal-only-main') : undefined,
|
||||
text: (onlyMain) ? intl.str('goal-only-main') : undefined,
|
||||
parent: this
|
||||
});
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ var Sandbox = Backbone.View.extend({
|
|||
},
|
||||
|
||||
releaseControl: function() {
|
||||
// we will be handling commands that are submitted, mainly to add the sanadbox
|
||||
// we will be handling commands that are submitted, mainly to add the sandbox
|
||||
// functionality (which is included by default in ParseWaterfall())
|
||||
Main.getEventBaton().releaseBaton('commandSubmitted', this.commandSubmitted, this);
|
||||
// we obviously take care of sandbox commands
|
||||
|
|
|
@ -550,8 +550,8 @@ GitVisuals.prototype.calcBranchStacks = function() {
|
|||
map[thisId].sort(function(a, b) {
|
||||
var aId = a.obj.get('id');
|
||||
var bId = b.obj.get('id');
|
||||
if (aId == 'master' || bId == 'master') {
|
||||
return aId == 'master' ? -1 : 1;
|
||||
if (aId == 'main' || bId == 'main') {
|
||||
return aId == 'main' ? -1 : 1;
|
||||
}
|
||||
return aId.localeCompare(bId);
|
||||
});
|
||||
|
|
|
@ -68,7 +68,7 @@ var VisBranch = VisBase.extend({
|
|||
this.refreshOffset();
|
||||
|
||||
this.set('fill', GRAPHICS.headRectFill);
|
||||
} else if (id !== 'master') {
|
||||
} else if (id !== 'main') {
|
||||
// we need to set our color to something random
|
||||
this.set('fill', randomHueString());
|
||||
}
|
||||
|
@ -103,16 +103,16 @@ var VisBranch = VisBase.extend({
|
|||
* compared in the goal (used in a goal visualization context
|
||||
*/
|
||||
getIsLevelBranchCompared: function() {
|
||||
if (this.getIsMaster()) {
|
||||
return true; // master always compared
|
||||
if (this.getIsMain()) {
|
||||
return true; // main always compared
|
||||
}
|
||||
// we are not master, so return true if its not just master being compared
|
||||
// we are not main, so return true if its not just main being compared
|
||||
var levelBlob = this.get('gitVisuals').getLevelBlob();
|
||||
return !TreeCompare.onlyMasterCompared(levelBlob);
|
||||
return !TreeCompare.onlyMainCompared(levelBlob);
|
||||
},
|
||||
|
||||
getIsMaster: function() {
|
||||
return this.get('branch').get('id') == 'master';
|
||||
getIsMain: function() {
|
||||
return this.get('branch').get('id') == 'main';
|
||||
},
|
||||
|
||||
getFlipValue: function(commit, visNode) {
|
||||
|
@ -357,9 +357,6 @@ var VisBranch = VisBase.extend({
|
|||
if (name === 'HEAD' && isHg) {
|
||||
name = '.';
|
||||
}
|
||||
if (name.match(/\bmaster\b/)) {
|
||||
name = name.replace(/\bmaster\b/, 'main');
|
||||
}
|
||||
|
||||
var after = (selected && !this.getIsInOrigin() && !isRemote) ? '*' : '';
|
||||
return name + after;
|
||||
|
|
|
@ -81,9 +81,9 @@ var VisTag = VisBase.extend({
|
|||
* compared in the goal (used in a goal visualization context
|
||||
*/
|
||||
getIsLevelTagCompared: function() {
|
||||
// we are not master, so return true if its not just master being compared
|
||||
// we are not main, so return true if its not just main being compared
|
||||
var levelBlob = this.get('gitVisuals').getLevelBlob();
|
||||
return !TreeCompare.onlyMasterCompared(levelBlob);
|
||||
return !TreeCompare.onlyMainCompared(levelBlob);
|
||||
},
|
||||
|
||||
getTagStackIndex: function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue