1680 LocalResource *res = calloc(1, sizeof(LocalResource)); |
1680 LocalResource *res = calloc(1, sizeof(LocalResource)); |
1681 res->path = strdup(path); |
1681 res->path = strdup(path); |
1682 res->etag = NULL; |
1682 res->etag = NULL; |
1683 res->last_modified = s.st_mtime; |
1683 res->last_modified = s.st_mtime; |
1684 res->size = s.st_size; |
1684 res->size = s.st_size; |
|
1685 res->mode = s.st_mode & 07777; |
|
1686 res->uid = s.st_uid; |
|
1687 res->gid = s.st_gid; |
1685 return res; |
1688 return res; |
1686 } else { |
1689 } else { |
1687 *isdir = 1; |
1690 *isdir = 1; |
1688 LocalResource *res = calloc(1, sizeof(LocalResource)); |
1691 LocalResource *res = calloc(1, sizeof(LocalResource)); |
1689 res->path = util_concat_path(path, "/"); |
1692 res->path = util_concat_path(path, "/"); |
1690 res->last_modified = s.st_mtime; |
1693 res->last_modified = s.st_mtime; |
|
1694 res->mode = s.st_mode & 07777; |
|
1695 res->uid = s.st_uid; |
|
1696 res->gid = s.st_gid; |
1691 res->isdirectory = 1; |
1697 res->isdirectory = 1; |
1692 return res; |
1698 return res; |
1693 } |
1699 } |
1694 } |
1700 } |
1695 |
1701 |
2120 #define VBEGIN_ERROR_PROPPATCH 3 |
2126 #define VBEGIN_ERROR_PROPPATCH 3 |
2121 #define VBEGIN_ERROR_CHECKOUT 4 |
2127 #define VBEGIN_ERROR_CHECKOUT 4 |
2122 int versioning_begin(SyncDirectory *dir, DavResource *res, int *exists) { |
2128 int versioning_begin(SyncDirectory *dir, DavResource *res, int *exists) { |
2123 int ret = 0; |
2129 int ret = 0; |
2124 |
2130 |
2125 if(dir->versioning->type == VERSIONING_SIMPLE) { |
2131 if(dir->versioning->type == VERSIONING_SIMPLE && *exists) { |
2126 DavResource *history_collection = dav_resource_new( |
2132 DavResource *history_collection = dav_resource_new( |
2127 res->session, |
2133 res->session, |
2128 dir->versioning->collection); |
2134 dir->versioning->collection); |
2129 |
2135 |
2130 // get the path to the version history collection for this resource |
2136 // get the path to the version history collection for this resource |
2215 if(vcol_path != history_href) { |
2221 if(vcol_path != history_href) { |
2216 free(history_href); |
2222 free(history_href); |
2217 } |
2223 } |
2218 |
2224 |
2219 dav_resource_free(history_collection); |
2225 dav_resource_free(history_collection); |
2220 } else { |
2226 } else if(dir->versioning->type == VERSIONING_DELTAV){ |
2221 // DeltaV is so much easier :) |
2227 // DeltaV is so much easier :) |
2222 if(dav_checkout(res)) { |
2228 if(dav_checkout(res)) { |
2223 ret = VBEGIN_ERROR_CHECKOUT; |
2229 ret = VBEGIN_ERROR_CHECKOUT; |
2224 } |
2230 } |
2225 } |
2231 } |