Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Junming
jio
Commits
f75085c4
Commit
f75085c4
authored
Jan 08, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
isRevisionALeaf method updated
parent
f1a032a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
7 deletions
+29
-7
src/jio.storage/revisionstorage.js
src/jio.storage/revisionstorage.js
+29
-7
No files found.
src/jio.storage/revisionstorage.js
View file @
f75085c4
...
...
@@ -318,14 +318,36 @@ jIO.addStorageType('revision', function (spec, my) {
* @param {array} leaves all leaves on tree
* @return {boolean} true/false
*/
priv
.
isRevisionALeaf
=
function
(
revision
,
leaves
)
{
var
i
;
for
(
i
=
0
;
i
<
leaves
.
length
;
i
+=
1
)
{
if
(
leaves
[
i
]
===
revision
){
return
true
;
priv
.
isRevisionALeaf
=
function
(
document_tree
,
revision
)
{
var
i
,
result
,
search
;
result
=
undefined
;
// search method fills "result" with the good revs info
search
=
function
(
document_tree
)
{
var
i
;
if
(
typeof
document_tree
.
rev
!==
"
undefined
"
)
{
// node is not root
if
(
document_tree
.
rev
===
revision
)
{
if
(
document_tree
.
children
.
length
===
0
)
{
// This node is a leaf
result
=
true
return
;
}
result
=
false
;
return
;
}
}
}
return
false
;
// This node has children
for
(
i
=
0
;
i
<
document_tree
.
children
.
length
;
i
+=
1
)
{
// searching deeper to find the good rev
search
(
document_tree
.
children
[
i
]);
if
(
result
!==
undefined
)
{
// The result is already found
return
;
}
}
};
search
(
document_tree
);
return
result
||
false
;
};
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment