dav/sync.c

changeset 566
9a88920b15d8
parent 565
26898e00ddff
child 567
b0ce8b27978b
equal deleted inserted replaced
565:26898e00ddff 566:9a88920b15d8
693 ucx_map_rehash(lres_removed); 693 ucx_map_rehash(lres_removed);
694 } 694 }
695 } 695 }
696 } 696 }
697 697
698 //
699 // BEGIN PULL
700 //
701
698 // the first thing we need are all directories to put the files in 702 // the first thing we need are all directories to put the files in
699 UCX_FOREACH(elm, res_mkdir) { 703 UCX_FOREACH(elm, res_mkdir) {
700 DavResource *res = elm->data; 704 DavResource *res = elm->data;
701 char *local_path = create_local_path(dir, res->path); 705 char *local_path = create_local_path(dir, res->path);
702 if(sys_mkdir(local_path) && errno != EEXIST) { 706 if(sys_mkdir(local_path) && errno != EEXIST) {
708 } 712 }
709 713
710 // we need a map for all conflicts for fast lookups 714 // we need a map for all conflicts for fast lookups
711 UcxMap *conflicts = ucx_map_new(ucx_list_size(res_conflict)+16); 715 UcxMap *conflicts = ucx_map_new(ucx_list_size(res_conflict)+16);
712 UCX_FOREACH(elm, res_conflict) { 716 UCX_FOREACH(elm, res_conflict) {
713 sync_conflict++;
714 DavResource *res = elm->data; 717 DavResource *res = elm->data;
715 ucx_map_cstr_put(conflicts, res->path, res); 718 ucx_map_cstr_put(conflicts, res->path, res);
716 } 719 }
717 720
718 // download all new, modified and conflict files 721 // download all new, modified and conflict files
725 } 728 }
726 729
727 DavBool issplit = dav_get_property_ns(res, DAV_NS, "split") ? 1 : 0; 730 DavBool issplit = dav_get_property_ns(res, DAV_NS, "split") ? 1 : 0;
728 if(ucx_map_cstr_get(conflicts, res->path)) { 731 if(ucx_map_cstr_get(conflicts, res->path)) {
729 rename_conflict_file(dir, db, res->path, issplit); 732 rename_conflict_file(dir, db, res->path, issplit);
733 sync_conflict++;
730 } 734 }
731 735
732 // download the resource 736 // download the resource
733 if(sync_get_resource(a, dir, res->path, res, db, &sync_success)) { 737 if(sync_get_resource(a, dir, res->path, res, db, &sync_success)) {
734 fprintf(stderr, "resource download failed: %s\n", res->path); 738 fprintf(stderr, "resource download failed: %s\n", res->path);

mercurial