mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +02:00
Add getParent method for Commit objects
Add method to retrieve a given parent (not ancestor) of a commit object. If the commit doesn't have the requested parent return null.
This commit is contained in:
parent
e94710ca64
commit
4928e71a4b
1 changed files with 7 additions and 0 deletions
|
@ -1685,6 +1685,13 @@ var Commit = Backbone.Model.extend({
|
|||
this.get('gitVisuals').addEdge(this.get('id'), parent.get('id'));
|
||||
},
|
||||
|
||||
getParent: function(parentNum) {
|
||||
if (this && this.attributes && this.attributes.parents)
|
||||
return this.attributes.parents[parentNum];
|
||||
else
|
||||
return null;
|
||||
},
|
||||
|
||||
isMainParent: function(parent) {
|
||||
var index = this.get('parents').indexOf(parent);
|
||||
return index === 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue