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
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
fa9abed5
Commit
fa9abed5
authored
Jan 08, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replicate revision, remove method, bugfixes
parent
5f757590
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
8 deletions
+16
-8
src/jio.storage/revisionstorage.js
src/jio.storage/revisionstorage.js
+6
-4
test/jiotests.js
test/jiotests.js
+10
-4
No files found.
src/jio.storage/revisionstorage.js
View file @
fa9abed5
...
@@ -660,9 +660,9 @@ jIO.addStorageType('revision', function (spec, my) {
...
@@ -660,9 +660,9 @@ jIO.addStorageType('revision', function (spec, my) {
f
.
removeDocument
=
function
(
docid
,
doctree
)
{
f
.
removeDocument
=
function
(
docid
,
doctree
)
{
if
(
command
.
getOption
(
"
keep_revision_history
"
)
!==
true
)
{
if
(
command
.
getOption
(
"
keep_revision_history
"
)
!==
true
)
{
if
(
command
.
getAttachmentId
()
===
undefined
){
if
(
command
.
getAttachmentId
()
===
undefined
){
// update tree
// update tree
priv
.
postToDocumentTree
(
doctree
,
command
.
getDoc
(),
true
);
revs_info
=
priv
.
postToDocumentTree
(
doctree
,
command
.
getDoc
(),
true
);
// remove revision
// remove revision
that
.
addJob
(
that
.
addJob
(
...
@@ -671,17 +671,19 @@ jIO.addStorageType('revision', function (spec, my) {
...
@@ -671,17 +671,19 @@ jIO.addStorageType('revision', function (spec, my) {
docid
,
docid
,
option
,
option
,
function
(
response
)
{
function
(
response
)
{
// put tree
// put tree
doctree
.
_id
=
command
.
getDocId
()
+
priv
.
doctree_suffix
;
that
.
addJob
(
that
.
addJob
(
"
put
"
,
"
put
"
,
priv
.
substorage
,
priv
.
substorage
,
doctree
,
doctree
,
command
.
cloneOption
(),
command
.
cloneOption
(),
function
(
response
)
{
function
(
response
)
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
docid
,
"
id
"
:
command
.
getDocId
()
,
"
rev
"
:
revs_info
[
0
].
rev
"
rev
"
:
revs_info
[
0
].
rev
});
});
},
},
...
...
test/jiotests.js
View file @
fa9abed5
...
@@ -1503,7 +1503,7 @@ test ("Remove", function(){
...
@@ -1503,7 +1503,7 @@ test ("Remove", function(){
// 10. remove wrong revision
// 10. remove wrong revision
o
.
spy
(
o
,
"
status
"
,
409
,
"
409 - Removing document (false revision)
"
);
o
.
spy
(
o
,
"
status
"
,
409
,
"
409 - Removing document (false revision)
"
);
o
.
jio
.
remove
({
"
_id
"
:
"
remove1
"
,
"
_rev
"
:
o
.
second_old_rev
},
o
.
f
);
o
.
jio
.
remove
({
"
_id
"
:
"
remove1
"
,
"
_rev
"
:
"
1-rev2
"
},
o
.
f
);
o
.
tick
(
o
);
o
.
tick
(
o
);
o
.
revisions
=
{
"
start
"
:
3
,
"
ids
"
:[
o
.
revisions
=
{
"
start
"
:
3
,
"
ids
"
:[
...
@@ -1515,7 +1515,8 @@ test ("Remove", function(){
...
@@ -1515,7 +1515,8 @@ test ("Remove", function(){
generateRevisionHash
(
o
.
doc_myremove4
,
o
.
revisions
,
true
);
generateRevisionHash
(
o
.
doc_myremove4
,
o
.
revisions
,
true
);
// 11. remove document version with revision
// 11. remove document version with revision
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
remove1
"
,
"
rev
"
:
o
.
second_new_rev
},
o
.
spy
(
o
,
"
value
"
,
{
"
ok
"
:
true
,
"
id
"
:
"
remove1
"
,
"
rev
"
:
o
.
second_new_rev
},
"
Remove document (with revision)
"
);
"
Remove document (with revision)
"
);
o
.
jio
.
remove
({
"
_id
"
:
"
remove1
"
,
"
_rev
"
:
o
.
rev
},
o
.
f
);
o
.
jio
.
remove
({
"
_id
"
:
"
remove1
"
,
"
_rev
"
:
o
.
rev
},
o
.
f
);
o
.
tick
(
o
);
o
.
tick
(
o
);
...
@@ -1525,7 +1526,12 @@ test ("Remove", function(){
...
@@ -1525,7 +1526,12 @@ test ("Remove", function(){
"
status
"
:
"
deleted
"
,
"
status
"
:
"
deleted
"
,
"
children
"
:
[]
"
children
"
:
[]
});
});
/*
o
.
testtree
[
"
children
"
][
1
][
"
children
"
].
push
({
"
rev
"
:
o
.
second_old_rev
,
"
status
"
:
"
available
"
,
"
children
"
:[]
});
deepEqual
(
localstorage
.
getItem
(
deepEqual
(
localstorage
.
getItem
(
"
jio/localstorage/urevrem/arevrem/remove1.revision_tree.json
"
"
jio/localstorage/urevrem/arevrem/remove1.revision_tree.json
"
),
o
.
testtree
,
"
Check document tree
"
);
),
o
.
testtree
,
"
Check document tree
"
);
...
@@ -1542,7 +1548,7 @@ test ("Remove", function(){
...
@@ -1542,7 +1548,7 @@ test ("Remove", function(){
o
.
spy
(
o
,
"
status
"
,
409
,
"
409 - Removing document (no revision)
"
);
o
.
spy
(
o
,
"
status
"
,
409
,
"
409 - Removing document (no revision)
"
);
o
.
jio
.
remove
({
"
_id
"
:
"
remove1
"
},
o
.
f
);
o
.
jio
.
remove
({
"
_id
"
:
"
remove1
"
},
o
.
f
);
o
.
tick
(
o
);
o
.
tick
(
o
);
*/
o
.
jio
.
stop
();
o
.
jio
.
stop
();
});
});
...
...
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