mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 08:50:06 +02:00
Implement log using RevisionRange
This changes the implementation of the "log" command to use the RevisionRange functionality. RevisionRange sorts the results in order of reverse create time, to match real git. This is a change from the previous implementation of log, which essentially produced a breadth-first ordering.
This commit is contained in:
parent
8529a3aac7
commit
b9f8e19162
4 changed files with 49 additions and 51 deletions
|
@ -126,18 +126,14 @@ var Command = Backbone.Model.extend({
|
|||
oneArgImpliedHead: function(args, option) {
|
||||
this.validateArgBounds(args, 0, 1, option);
|
||||
// and if it's one, add a HEAD to the back
|
||||
if (args.length === 0) {
|
||||
args.push('HEAD');
|
||||
}
|
||||
this.impliedHead(args, 0);
|
||||
},
|
||||
|
||||
twoArgsImpliedHead: function(args, option) {
|
||||
// our args we expect to be between 1 and 2
|
||||
this.validateArgBounds(args, 1, 2, option);
|
||||
// and if it's one, add a HEAD to the back
|
||||
if (args.length == 1) {
|
||||
args.push('HEAD');
|
||||
}
|
||||
this.impliedHead(args, 1);
|
||||
},
|
||||
|
||||
oneArgImpliedOrigin: function(args) {
|
||||
|
@ -151,6 +147,12 @@ var Command = Backbone.Model.extend({
|
|||
this.validateArgBounds(args, 0, 2);
|
||||
},
|
||||
|
||||
impliedHead: function(args, min) {
|
||||
if(args.length == min) {
|
||||
args.push('HEAD');
|
||||
}
|
||||
},
|
||||
|
||||
// this is a little utility class to help arg validation that happens over and over again
|
||||
validateArgBounds: function(args, lower, upper, option) {
|
||||
var what = (option === undefined) ?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue