Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
Aurélien Vermylen
jio
Commits
db110599
Commit
db110599
authored
Dec 26, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
revisionstorage.js private methods improved
parent
670fa773
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
src/jio.storage/revisionstorage.js
src/jio.storage/revisionstorage.js
+21
-2
No files found.
src/jio.storage/revisionstorage.js
View file @
db110599
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
* }
* }
*/
*/
jIO
.
addStorageType
(
'
revision
'
,
function
(
spec
,
my
)
{
jIO
.
addStorageType
(
'
revision
'
,
function
(
spec
,
my
)
{
"
use strict
"
;
var
that
,
priv
=
{};
var
that
,
priv
=
{};
spec
=
spec
||
{};
spec
=
spec
||
{};
that
=
my
.
basicStorage
(
spec
,
my
);
that
=
my
.
basicStorage
(
spec
,
my
);
...
@@ -155,7 +156,9 @@ jIO.addStorageType('revision', function (spec, my) {
...
@@ -155,7 +156,9 @@ jIO.addStorageType('revision', function (spec, my) {
* @return {array} The added document revs_info
* @return {array} The added document revs_info
*/
*/
priv
.
postToDocumentTree
=
function
(
doctree
,
doc
)
{
priv
.
postToDocumentTree
=
function
(
doctree
,
doc
)
{
var
revs_info
=
[],
next_rev
,
selectNode
,
selected_node
=
doctree
;
var
i
,
revs_info
,
next_rev
,
next_rev_str
,
selectNode
,
selected_node
;
revs_info
=
[];
selected_node
=
doctree
;
selectNode
=
function
(
node
)
{
selectNode
=
function
(
node
)
{
var
i
;
var
i
;
if
(
typeof
node
.
rev
!==
"
undefined
"
)
{
if
(
typeof
node
.
rev
!==
"
undefined
"
)
{
...
@@ -192,11 +195,27 @@ jIO.addStorageType('revision', function (spec, my) {
...
@@ -192,11 +195,27 @@ jIO.addStorageType('revision', function (spec, my) {
}
}
next_rev
=
priv
.
generateNextRevision
(
next_rev
=
priv
.
generateNextRevision
(
doc
.
_rev
||
0
,
JSON
.
stringify
(
doc
)
+
JSON
.
stringify
(
revs_info
));
doc
.
_rev
||
0
,
JSON
.
stringify
(
doc
)
+
JSON
.
stringify
(
revs_info
));
next_rev_str
=
next_rev
.
join
(
"
-
"
);
// don't add if the next rev already exists
console
.
log
(
JSON
.
stringify
(
revs_info
));
for
(
i
=
0
;
i
<
selected_node
.
children
.
length
;
i
+=
1
)
{
console
.
log
(
selected_node
.
children
[
i
].
rev
);
if
(
selected_node
.
children
[
i
].
rev
===
next_rev_str
)
{
revs_info
.
unshift
({
"
rev
"
:
next_rev_str
,
"
status
"
:
"
available
"
});
if
(
selected_node
.
children
[
i
].
status
!==
"
available
"
)
{
selected_node
.
children
[
i
].
status
=
"
available
"
;
}
return
revs_info
;
}
}
revs_info
.
unshift
({
revs_info
.
unshift
({
"
rev
"
:
next_rev
.
join
(
'
-
'
),
"
rev
"
:
next_rev
.
join
(
'
-
'
),
"
status
"
:
"
available
"
"
status
"
:
"
available
"
});
});
selected_node
.
children
.
push
({
selected_node
.
children
.
unshift
({
"
rev
"
:
next_rev
.
join
(
'
-
'
),
"
rev
"
:
next_rev
.
join
(
'
-
'
),
"
status
"
:
"
available
"
,
"
status
"
:
"
available
"
,
"
children
"
:
[]
"
children
"
:
[]
...
...
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