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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
preetwinder
jio
Commits
fb26b7e0
Commit
fb26b7e0
authored
Dec 20, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getWinnerRevisionFromDocumentTree added
parent
f87b8f3c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
src/jio.storage/intro.js
src/jio.storage/intro.js
+30
-0
No files found.
src/jio.storage/intro.js
View file @
fb26b7e0
...
...
@@ -410,6 +410,36 @@ var utilities = {
return
{
"
children
"
:
synchronize
(
tree_list
)};
},
/**
* Gets the winner revision from a document tree
* @method getWinnerRevisionFromDocumentTree
* @param {object} document_tree The document tree
* @return {string} The winner revision
*/
getWinnerRevisionFromDocumentTree
:
function
(
document_tree
)
{
var
i
,
result
,
search
;
result
=
{
"
deep
"
:
-
1
,
"
revision
"
:
''
};
// search method fills "result" with the winner revision
search
=
function
(
document_tree
,
deep
)
{
var
i
;
if
(
document_tree
.
children
.
length
===
0
)
{
// This node is a leaf
if
(
result
.
deep
<
deep
)
{
// The leaf is deeper than result
result
=
{
"
deep
"
:
deep
,
"
revision
"
:
document_tree
.
rev
};
}
return
;
}
// This node has children
for
(
i
=
0
;
i
<
document_tree
.
children
.
length
;
i
+=
1
)
{
// searching deeper to find the deeper leaf
search
(
document_tree
.
children
[
i
],
deep
+
1
);
}
};
search
(
document_tree
,
0
);
return
result
.
rev
;
},
getActiveLeaves
:
function
(
docTreeNode
)
{
var
activeLeaves
=
utilities
.
getLeavesOnTree
(
docTreeNode
);
...
...
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