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
Douglas
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) {
revs_info
=
[],
selected_node
=
doctree
;
if
(
doc
.
_rev
===
undefined
&&
priv
.
missing_revision
){
doc
.
_rev
=
priv
.
missing_revision
;
}
selectNode
=
function
(
node
)
{
var
i
;
if
(
typeof
node
.
rev
!==
"
undefined
"
)
{
...
...
@@ -465,7 +461,6 @@ jIO.addStorageType('revision', function (spec, my) {
doctree
,
command
.
cloneOption
(),
function
(
response
)
{
that
.
success
({
"
ok
"
:
true
,
"
id
"
:
docid
,
...
...
@@ -684,8 +679,7 @@ jIO.addStorageType('revision', function (spec, my) {
return
;
}
}
// get doctree
// get doctree
that
.
addJob
(
"
get
"
,
priv
.
substorage
,
...
...
@@ -694,91 +688,35 @@ jIO.addStorageType('revision', function (spec, my) {
function
(
response
)
{
response
.
_conflicts
=
priv
.
getLeavesFromDocumentTree
(
response
);
// really necessary...?
if
(
del_rev
===
undefined
)
{
// single leaf = can be deleted
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
// no revision provided
that
.
error
({
"
status
"
:
409
,
"
statusText
"
:
"
Conflict
"
,
"
error
"
:
"
conflict
"
,
"
message
"
:
"
Document update conflict.
"
,
"
reason
"
:
"
Cannot delete a document without revision when multiple versions exist
"
"
reason
"
:
"
Cannot delete a document without revision
"
});
return
;
}
}
}
else
{
// revision provided
if
(
typeof
command
.
getAttachmentId
()
===
"
string
"
){
f
.
removeDocument
(
command
.
getDocId
()
+
"
.
"
+
del_rev
+
"
/
"
+
command
.
getAttachmentId
());
}
else
{
if
(
priv
.
isRevisionALeaf
(
del_rev
,
response
.
_conflicts
)){
f
.
removeDocument
(
command
.
getDocId
()
+
"
.
"
+
del_rev
);
if
(
del_rev
===
priv
.
getWinnerRevisionFromDocumentTree
(
response
)[
0
].
rev
){
priv
.
dummy
=
true
;
f
.
removeDocument
(
command
.
getDocId
()
+
"
.
"
+
del_rev
);
}
else
{
that
.
error
({
"
status
"
:
409
,
"
statusText
"
:
"
Conflict
"
,
"
error
"
:
"
conflict
"
,
"
message
"
:
"
Document update conflict.
"
,
"
reason
"
:
"
Trying to remove an outdated
revision
"
"
reason
"
:
"
Trying to remove non-latest
revision
"
});
return
;
}
...
...
@@ -790,7 +728,7 @@ jIO.addStorageType('revision', function (spec, my) {
"
status
"
:
404
,
"
statusText
"
:
"
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
"
});
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