mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 01:10:04 +02:00
mercurial test coverage
This commit is contained in:
parent
7db6f0d38c
commit
bf132f8f09
8 changed files with 122 additions and 18 deletions
|
@ -6053,7 +6053,6 @@ var initRootEvents = function(eventBaton) {
|
||||||
|
|
||||||
var initDemo = function(sandbox) {
|
var initDemo = function(sandbox) {
|
||||||
var params = util.parseQueryString(window.location.href);
|
var params = util.parseQueryString(window.location.href);
|
||||||
console.log(params);
|
|
||||||
|
|
||||||
// being the smart programmer I am (not), I dont include a true value on demo, so
|
// being the smart programmer I am (not), I dont include a true value on demo, so
|
||||||
// I have to check if the key exists here
|
// I have to check if the key exists here
|
||||||
|
@ -10978,7 +10977,6 @@ var commandConfig = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(generalArgs);
|
|
||||||
command.validateArgBounds(generalArgs, 1, 1);
|
command.validateArgBounds(generalArgs, 1, 1);
|
||||||
|
|
||||||
engine.checkout(engine.crappyUnescape(generalArgs[0]));
|
engine.checkout(engine.crappyUnescape(generalArgs[0]));
|
||||||
|
@ -11095,6 +11093,7 @@ var commandConfig = {
|
||||||
'-r'
|
'-r'
|
||||||
],
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
command.appendOptionR();
|
||||||
var options = command.getSupportedMap();
|
var options = command.getSupportedMap();
|
||||||
if (!options['-r']) {
|
if (!options['-r']) {
|
||||||
throw new GitError({
|
throw new GitError({
|
||||||
|
@ -11234,7 +11233,11 @@ var commandConfig = {
|
||||||
|
|
||||||
update: {
|
update: {
|
||||||
regex: /^hg +(update|up)($|\s+)/,
|
regex: /^hg +(update|up)($|\s+)/,
|
||||||
|
options: [
|
||||||
|
'-r'
|
||||||
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
command.appendOptionR();
|
||||||
return {
|
return {
|
||||||
vcs: 'git',
|
vcs: 'git',
|
||||||
name: 'checkout'
|
name: 'checkout'
|
||||||
|
@ -11244,7 +11247,11 @@ var commandConfig = {
|
||||||
|
|
||||||
backout: {
|
backout: {
|
||||||
regex: /^hg +backout($|\s+)/,
|
regex: /^hg +backout($|\s+)/,
|
||||||
|
options: [
|
||||||
|
'-r'
|
||||||
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
command.appendOptionR();
|
||||||
return {
|
return {
|
||||||
vcs: 'git',
|
vcs: 'git',
|
||||||
name: 'revert'
|
name: 'revert'
|
||||||
|
@ -11268,9 +11275,6 @@ var commandConfig = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO rebase :OOOO need to graft? engine work
|
|
||||||
// rebase: {
|
|
||||||
|
|
||||||
pull: {
|
pull: {
|
||||||
regex: /^hg +pull($|\s+)/,
|
regex: /^hg +pull($|\s+)/,
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
@ -14814,6 +14818,18 @@ var Command = Backbone.Model.extend({
|
||||||
return string.replace(/\./g, 'HEAD');
|
return string.replace(/\./g, 'HEAD');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since mercurial always wants revisions with
|
||||||
|
* -r, we want to just make these general
|
||||||
|
* args for git
|
||||||
|
*/
|
||||||
|
appendOptionR: function() {
|
||||||
|
var rOptions = this.getSupportedMap()['-r'] || [];
|
||||||
|
this.setGeneralArgs(
|
||||||
|
this.getGeneralArgs().concat(rOptions)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
mapDotToHead: function() {
|
mapDotToHead: function() {
|
||||||
var generalArgs = this.getGeneralArgs();
|
var generalArgs = this.getGeneralArgs();
|
||||||
var options = this.getSupportedMap();
|
var options = this.getSupportedMap();
|
||||||
|
@ -24070,7 +24086,6 @@ var initRootEvents = function(eventBaton) {
|
||||||
|
|
||||||
var initDemo = function(sandbox) {
|
var initDemo = function(sandbox) {
|
||||||
var params = util.parseQueryString(window.location.href);
|
var params = util.parseQueryString(window.location.href);
|
||||||
console.log(params);
|
|
||||||
|
|
||||||
// being the smart programmer I am (not), I dont include a true value on demo, so
|
// being the smart programmer I am (not), I dont include a true value on demo, so
|
||||||
// I have to check if the key exists here
|
// I have to check if the key exists here
|
||||||
|
@ -25294,7 +25309,6 @@ var commandConfig = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(generalArgs);
|
|
||||||
command.validateArgBounds(generalArgs, 1, 1);
|
command.validateArgBounds(generalArgs, 1, 1);
|
||||||
|
|
||||||
engine.checkout(engine.crappyUnescape(generalArgs[0]));
|
engine.checkout(engine.crappyUnescape(generalArgs[0]));
|
||||||
|
@ -31016,6 +31030,7 @@ var commandConfig = {
|
||||||
'-r'
|
'-r'
|
||||||
],
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
command.appendOptionR();
|
||||||
var options = command.getSupportedMap();
|
var options = command.getSupportedMap();
|
||||||
if (!options['-r']) {
|
if (!options['-r']) {
|
||||||
throw new GitError({
|
throw new GitError({
|
||||||
|
@ -31155,7 +31170,11 @@ var commandConfig = {
|
||||||
|
|
||||||
update: {
|
update: {
|
||||||
regex: /^hg +(update|up)($|\s+)/,
|
regex: /^hg +(update|up)($|\s+)/,
|
||||||
|
options: [
|
||||||
|
'-r'
|
||||||
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
command.appendOptionR();
|
||||||
return {
|
return {
|
||||||
vcs: 'git',
|
vcs: 'git',
|
||||||
name: 'checkout'
|
name: 'checkout'
|
||||||
|
@ -31165,7 +31184,11 @@ var commandConfig = {
|
||||||
|
|
||||||
backout: {
|
backout: {
|
||||||
regex: /^hg +backout($|\s+)/,
|
regex: /^hg +backout($|\s+)/,
|
||||||
|
options: [
|
||||||
|
'-r'
|
||||||
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
command.appendOptionR();
|
||||||
return {
|
return {
|
||||||
vcs: 'git',
|
vcs: 'git',
|
||||||
name: 'revert'
|
name: 'revert'
|
||||||
|
@ -31189,9 +31212,6 @@ var commandConfig = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO rebase :OOOO need to graft? engine work
|
|
||||||
// rebase: {
|
|
||||||
|
|
||||||
pull: {
|
pull: {
|
||||||
regex: /^hg +pull($|\s+)/,
|
regex: /^hg +pull($|\s+)/,
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
@ -31409,6 +31429,18 @@ var Command = Backbone.Model.extend({
|
||||||
return string.replace(/\./g, 'HEAD');
|
return string.replace(/\./g, 'HEAD');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since mercurial always wants revisions with
|
||||||
|
* -r, we want to just make these general
|
||||||
|
* args for git
|
||||||
|
*/
|
||||||
|
appendOptionR: function() {
|
||||||
|
var rOptions = this.getSupportedMap()['-r'] || [];
|
||||||
|
this.setGeneralArgs(
|
||||||
|
this.getGeneralArgs().concat(rOptions)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
mapDotToHead: function() {
|
mapDotToHead: function() {
|
||||||
var generalArgs = this.getGeneralArgs();
|
var generalArgs = this.getGeneralArgs();
|
||||||
var options = this.getSupportedMap();
|
var options = this.getSupportedMap();
|
||||||
|
|
File diff suppressed because one or more lines are too long
1
build/bundle.min.js
vendored
1
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.dfe3f962.js"></script>
|
<script src="build/bundle.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
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
var base = require('./base');
|
var base = require('./base');
|
||||||
var expectTreeAsync = base.expectTreeAsync;
|
var expectTreeAsync = base.expectTreeAsync;
|
||||||
|
|
||||||
describe('GitEngine', function() {
|
describe('Git', function() {
|
||||||
it('Commits', function() {
|
it('Commits', function() {
|
||||||
expectTreeAsync(
|
expectTreeAsync(
|
||||||
'git commit',
|
'git commit',
|
||||||
'{"branches":{"master":{"target":"C2","id":"master","type":"branch"}},"commits":{"C0":{"type":"commit","parents":[],"id":"C0","rootCommit":true},"C1":{"type":"commit","parents":["C0"],"id":"C1"},"C2":{"type":"commit","parents":["C1"],"id":"C2"}},"HEAD":{"id":"HEAD","target":"master","type":"general ref"}}'
|
base.ONE_COMMIT_TREE
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
56
spec/mercurial.spec.js
Normal file
56
spec/mercurial.spec.js
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
var base = require('./base');
|
||||||
|
var expectTreeAsync = base.expectTreeAsync;
|
||||||
|
|
||||||
|
describe('Mercurial', function() {
|
||||||
|
var assert = function(msg, command, tree) {
|
||||||
|
it(msg, function() {
|
||||||
|
expectTreeAsync(command, tree);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
assert(
|
||||||
|
'Commits',
|
||||||
|
'hg commit',
|
||||||
|
base.ONE_COMMIT_TREE
|
||||||
|
);
|
||||||
|
|
||||||
|
assert(
|
||||||
|
'Makes a bookmark',
|
||||||
|
'hg book;hg book foo;hg ci;hg book -r C0 asd;',
|
||||||
|
'{"branches":{"master":{"target":"C1","id":"master"},"foo":{"target":"C2","id":"foo"},"asd":{"target":"C0","id":"asd"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"foo","id":"HEAD"}}'
|
||||||
|
);
|
||||||
|
|
||||||
|
assert(
|
||||||
|
'updates to bookmarks',
|
||||||
|
'hg book;hg book foo;hg ci;hg book -r C0 asd; hg update asd',
|
||||||
|
'{"branches":{"master":{"target":"C1","id":"master"},"foo":{"target":"C2","id":"foo"},"asd":{"target":"C0","id":"asd"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"asd","id":"HEAD"}}'
|
||||||
|
);
|
||||||
|
|
||||||
|
assert(
|
||||||
|
'updates to revisions',
|
||||||
|
'hg update -r C0',
|
||||||
|
'{"branches":{"master":{"target":"C1","id":"master"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"}},"HEAD":{"target":"C0","id":"HEAD"}}'
|
||||||
|
);
|
||||||
|
|
||||||
|
assert(
|
||||||
|
'backs out revisions and bookmarks',
|
||||||
|
'hg book -r C0 foo;hg ci;hg backout foo;hg backout -r C1 C2;',
|
||||||
|
'%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C2%27%22%2C%22id%22%3A%22master%22%7D%2C%22foo%22%3A%7B%22target%22%3A%22C0%22%2C%22id%22%3A%22foo%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%22C0%27%22%3A%7B%22parents%22%3A%5B%22C2%22%5D%2C%22id%22%3A%22C0%27%22%7D%2C%22C1%27%22%3A%7B%22parents%22%3A%5B%22C0%27%22%5D%2C%22id%22%3A%22C1%27%22%7D%2C%22C2%27%22%3A%7B%22parents%22%3A%5B%22C1%27%22%5D%2C%22id%22%3A%22C2%27%22%7D%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22master%22%2C%22id%22%3A%22HEAD%22%7D%7D'
|
||||||
|
);
|
||||||
|
|
||||||
|
assert(
|
||||||
|
'commits and ammends',
|
||||||
|
'hg commit -A; hg commit --amend',
|
||||||
|
'%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C2%27%22%2C%22id%22%3A%22master%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%22C2%27%22%3A%7B%22parents%22%3A%5B%22C1%22%5D%2C%22id%22%3A%22C2%27%22%7D%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22master%22%2C%22id%22%3A%22HEAD%22%7D%7D'
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
// TODO -- need to shim out more animation factory things
|
||||||
|
assert(
|
||||||
|
'rebases with -d',
|
||||||
|
'hg ci; hg book -r C1 feature; hg update feature; hg ci;hg book debug;hg ci;hg rebase -d master;',
|
||||||
|
'%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C2%22%2C%22id%22%3A%22master%22%7D%2C%22feature%22%3A%7B%22target%22%3A%22C3%27%22%2C%22id%22%3A%22feature%22%7D%2C%22debug%22%3A%7B%22target%22%3A%22C4%27%22%2C%22id%22%3A%22debug%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%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%7D%2C%22HEAD%22%3A%7B%22target%22%3A%22debug%22%2C%22id%22%3A%22HEAD%22%7D%7D'
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
|
@ -58,6 +58,7 @@ var commandConfig = {
|
||||||
'-r'
|
'-r'
|
||||||
],
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
command.appendOptionR();
|
||||||
var options = command.getSupportedMap();
|
var options = command.getSupportedMap();
|
||||||
if (!options['-r']) {
|
if (!options['-r']) {
|
||||||
throw new GitError({
|
throw new GitError({
|
||||||
|
@ -197,7 +198,11 @@ var commandConfig = {
|
||||||
|
|
||||||
update: {
|
update: {
|
||||||
regex: /^hg +(update|up)($|\s+)/,
|
regex: /^hg +(update|up)($|\s+)/,
|
||||||
|
options: [
|
||||||
|
'-r'
|
||||||
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
command.appendOptionR();
|
||||||
return {
|
return {
|
||||||
vcs: 'git',
|
vcs: 'git',
|
||||||
name: 'checkout'
|
name: 'checkout'
|
||||||
|
@ -207,7 +212,11 @@ var commandConfig = {
|
||||||
|
|
||||||
backout: {
|
backout: {
|
||||||
regex: /^hg +backout($|\s+)/,
|
regex: /^hg +backout($|\s+)/,
|
||||||
|
options: [
|
||||||
|
'-r'
|
||||||
|
],
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
command.appendOptionR();
|
||||||
return {
|
return {
|
||||||
vcs: 'git',
|
vcs: 'git',
|
||||||
name: 'revert'
|
name: 'revert'
|
||||||
|
@ -231,9 +240,6 @@ var commandConfig = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// TODO rebase :OOOO need to graft? engine work
|
|
||||||
// rebase: {
|
|
||||||
|
|
||||||
pull: {
|
pull: {
|
||||||
regex: /^hg +pull($|\s+)/,
|
regex: /^hg +pull($|\s+)/,
|
||||||
delegate: function(engine, command) {
|
delegate: function(engine, command) {
|
||||||
|
|
|
@ -55,6 +55,18 @@ var Command = Backbone.Model.extend({
|
||||||
return string.replace(/\./g, 'HEAD');
|
return string.replace(/\./g, 'HEAD');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since mercurial always wants revisions with
|
||||||
|
* -r, we want to just make these general
|
||||||
|
* args for git
|
||||||
|
*/
|
||||||
|
appendOptionR: function() {
|
||||||
|
var rOptions = this.getSupportedMap()['-r'] || [];
|
||||||
|
this.setGeneralArgs(
|
||||||
|
this.getGeneralArgs().concat(rOptions)
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
mapDotToHead: function() {
|
mapDotToHead: function() {
|
||||||
var generalArgs = this.getGeneralArgs();
|
var generalArgs = this.getGeneralArgs();
|
||||||
var options = this.getSupportedMap();
|
var options = this.getSupportedMap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue