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
Nicolas Wavrant
jio
Commits
2b6d19ea
Commit
2b6d19ea
authored
Jan 07, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove method updated in revisionstorage
parent
55904db0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
83 deletions
+21
-83
src/jio.storage/revisionstorage.js
src/jio.storage/revisionstorage.js
+21
-83
No files found.
src/jio.storage/revisionstorage.js
View file @
2b6d19ea
...
@@ -212,10 +212,6 @@ jIO.addStorageType('revision', function (spec, my) {
...
@@ -212,10 +212,6 @@ jIO.addStorageType('revision', function (spec, my) {
revs_info
=
[],
revs_info
=
[],
selected_node
=
doctree
;
selected_node
=
doctree
;
if
(
doc
.
_rev
===
undefined
&&
priv
.
missing_revision
){
doc
.
_rev
=
priv
.
missing_revision
;
}
selectNode
=
function
(
node
)
{
selectNode
=
function
(
node
)
{
var
i
;
var
i
;
if
(
typeof
node
.
rev
!==
"
undefined
"
)
{
if
(
typeof
node
.
rev
!==
"
undefined
"
)
{
...
@@ -465,7 +461,6 @@ jIO.addStorageType('revision', function (spec, my) {
...
@@ -465,7 +461,6 @@ jIO.addStorageType('revision', function (spec, my) {
doctree
,
doctree
,
command
.
cloneOption
(),
command
.
cloneOption
(),
function
(
response
)
{
function
(
response
)
{
that
.
success
({
that
.
success
({
"
ok
"
:
true
,
"
ok
"
:
true
,
"
id
"
:
docid
,
"
id
"
:
docid
,
...
@@ -684,8 +679,7 @@ jIO.addStorageType('revision', function (spec, my) {
...
@@ -684,8 +679,7 @@ jIO.addStorageType('revision', function (spec, my) {
return
;
return
;
}
}
}
}
// get doctree
// get doctree
that
.
addJob
(
that
.
addJob
(
"
get
"
,
"
get
"
,
priv
.
substorage
,
priv
.
substorage
,
...
@@ -694,91 +688,35 @@ jIO.addStorageType('revision', function (spec, my) {
...
@@ -694,91 +688,35 @@ jIO.addStorageType('revision', function (spec, my) {
function
(
response
)
{
function
(
response
)
{
response
.
_conflicts
=
priv
.
getLeavesFromDocumentTree
(
response
);
response
.
_conflicts
=
priv
.
getLeavesFromDocumentTree
(
response
);
// really necessary...?
if
(
del_rev
===
undefined
)
{
if
(
del_rev
===
undefined
)
{
// single leaf = can be deleted
// no revision provided
if
(
response
.
_conflicts
.
length
===
1
)
{
f
.
removeDocument
(
command
.
getDocId
()
+
"
.
"
+
response
.
_conflicts
[
0
]);
delete
response
.
_conflicts
;
}
else
{
// multiple leaves = only if deleting attachment,
// because unique document.revision/attachment
if
(
typeof
command
.
getAttachmentId
()
===
"
string
"
){
for
(
i
=
0
;
i
<
response
.
_conflicts
.
length
;
i
+=
1
){
del_rev
=
response
.
_conflicts
[
i
];
that
.
addJob
(
"
get
"
,
priv
.
substorage
,
command
.
getDocId
()
+
"
.
"
+
response
.
_conflicts
[
i
],
option
,
function
(
nested_response
)
{
if
(
typeof
nested_response
.
_attachments
===
"
object
"
)
{
if
(
nested_response
.
_attachments
[
command
.
getAttachmentId
()]
!==
undefined
){
revision_found
=
true
;
correct_revision
=
del_rev
;
}
}
if
(
revision_count
===
response
.
_conflicts
.
length
-
1
&&
revision_found
!==
true
){
that
.
error
({
"
status
"
:
404
,
"
statusText
"
:
"
Not Found
"
,
"
error
"
:
"
not_found
"
,
"
message
"
:
"
Attachment not found, please check attachment ID
"
,
"
reason
"
:
"
Incorrect Attachment ID
"
});
return
;
}
if
(
revision_found
===
true
){
priv
.
missing_revision
=
correct_revision
;
delete
response
.
_conflicts
;
f
.
removeDocument
(
command
.
getDocId
()
+
"
.
"
+
correct_revision
+
"
/
"
+
command
.
getAttachmentId
());
}
revision_count
+=
1
;
},
function
(
err
)
{
that
.
error
({
"
status
"
:
404
,
"
statusText
"
:
"
Not Found
"
,
"
error
"
:
"
not_found
"
,
"
message
"
:
"
Attachment not found, please check document ID
"
,
"
reason
"
:
"
Incorrect document ID
"
});
}
);
}
}
else
{
// conflict
// return conflict message here, so user can pick a document version
that
.
error
({
that
.
error
({
"
status
"
:
409
,
"
status
"
:
409
,
"
statusText
"
:
"
Conflict
"
,
"
statusText
"
:
"
Conflict
"
,
"
error
"
:
"
conflict
"
,
"
error
"
:
"
conflict
"
,
"
message
"
:
"
Document update conflict.
"
,
"
message
"
:
"
Document update conflict.
"
,
"
reason
"
:
"
Cannot delete a document without revision when multiple versions exist
"
"
reason
"
:
"
Cannot delete a document without revision
"
});
});
return
;
return
;
}
}
}
else
{
}
else
{
// revision provided
// revision provided
if
(
typeof
command
.
getAttachmentId
()
===
"
string
"
){
if
(
typeof
command
.
getAttachmentId
()
===
"
string
"
){
f
.
removeDocument
(
command
.
getDocId
()
+
"
.
"
+
del_rev
+
"
/
"
+
f
.
removeDocument
(
command
.
getDocId
()
+
"
.
"
+
del_rev
+
"
/
"
+
command
.
getAttachmentId
());
command
.
getAttachmentId
());
}
else
{
}
else
{
if
(
priv
.
isRevisionALeaf
(
del_rev
,
response
.
_conflicts
)){
if
(
del_rev
===
f
.
removeDocument
(
command
.
getDocId
()
+
"
.
"
+
del_rev
);
priv
.
getWinnerRevisionFromDocumentTree
(
response
)[
0
].
rev
){
priv
.
dummy
=
true
;
f
.
removeDocument
(
command
.
getDocId
()
+
"
.
"
+
del_rev
);
}
else
{
}
else
{
that
.
error
({
that
.
error
({
"
status
"
:
409
,
"
status
"
:
409
,
"
statusText
"
:
"
Conflict
"
,
"
statusText
"
:
"
Conflict
"
,
"
error
"
:
"
conflict
"
,
"
error
"
:
"
conflict
"
,
"
message
"
:
"
Document update conflict.
"
,
"
message
"
:
"
Document update conflict.
"
,
"
reason
"
:
"
Trying to remove an outdated
revision
"
"
reason
"
:
"
Trying to remove non-latest
revision
"
});
});
return
;
return
;
}
}
...
@@ -790,7 +728,7 @@ jIO.addStorageType('revision', function (spec, my) {
...
@@ -790,7 +728,7 @@ jIO.addStorageType('revision', function (spec, my) {
"
status
"
:
404
,
"
status
"
:
404
,
"
statusText
"
:
"
Not Found
"
,
"
statusText
"
:
"
Not Found
"
,
"
error
"
:
"
not_found
"
,
"
error
"
:
"
not_found
"
,
"
message
"
:
"
Document tree not found, please check
document ID
"
,
"
message
"
:
"
Document tree not found, please check
document ID
"
,
"
reason
"
:
"
Incorrect document ID
"
"
reason
"
:
"
Incorrect document ID
"
});
});
return
;
return
;
...
...
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