Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
preetwinder
jio
Commits
f75085c4
Commit
f75085c4
authored
12 years ago
by
Tristan Cavelier
Browse files
Options
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) {
...
@@ -318,14 +318,36 @@ jIO.addStorageType('revision', function (spec, my) {
* @param {array} leaves all leaves on tree
* @param {array} leaves all leaves on tree
* @return {boolean} true/false
* @return {boolean} true/false
*/
*/
priv
.
isRevisionALeaf
=
function
(
revision
,
leaves
)
{
priv
.
isRevisionALeaf
=
function
(
document_tree
,
revision
)
{
var
i
;
var
i
,
result
,
search
;
for
(
i
=
0
;
i
<
leaves
.
length
;
i
+=
1
)
{
result
=
undefined
;
if
(
leaves
[
i
]
===
revision
){
// search method fills "result" with the good revs info
return
true
;
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
;
}
}
}
}
// This node has children
return
false
;
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
;
};
};
/**
/**
...
...
This diff is collapsed.
Click to expand it.
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