mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-02 02:34:26 +02:00
Support range operator in revision range (log and rev-list)
This commit is contained in:
parent
9b4b6627b6
commit
44e7596381
2 changed files with 25 additions and 0 deletions
|
@ -317,6 +317,18 @@ describe('Git', function() {
|
||||||
expect(commandMsg).toBe('C6\n');
|
expect(commandMsg).toBe('C6\n');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('range between branches', function() {
|
||||||
|
runCommand(SETUP + 'git rev-list left..right', function(commandMsg) {
|
||||||
|
expect(commandMsg).toBe('C5\nC4\n');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('range between commits', function() {
|
||||||
|
runCommand(SETUP + 'git rev-list C3..C5', function(commandMsg) {
|
||||||
|
expect(commandMsg).toBe('C5\nC4\n');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3079,6 +3079,18 @@ function RevisionRange(engine, specifiers) {
|
||||||
this.processSpecifiers(specifiers);
|
this.processSpecifiers(specifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var rangeRegex = /^(.*)\.\.(.*)$/;
|
||||||
|
|
||||||
|
RevisionRange.prototype.processAsRange = function(specifier) {
|
||||||
|
var match = specifier.match(rangeRegex);
|
||||||
|
if(!match) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
this.tipsToExclude.push(match[1]);
|
||||||
|
this.tipsToInclude.push(match[2]);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
RevisionRange.prototype.processAsExclusion = function(specifier) {
|
RevisionRange.prototype.processAsExclusion = function(specifier) {
|
||||||
if(!specifier.startsWith('^')) {
|
if(!specifier.startsWith('^')) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -3095,6 +3107,7 @@ RevisionRange.prototype.processAsInclusion = function(specifier) {
|
||||||
RevisionRange.prototype.processSpecifiers = function(specifiers) {
|
RevisionRange.prototype.processSpecifiers = function(specifiers) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var processors = [
|
var processors = [
|
||||||
|
this.processAsRange,
|
||||||
this.processAsExclusion
|
this.processAsExclusion
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue