# HG changeset patch # User Olaf Wintermann # Date 1504801110 -7200 # Node ID c517502d3e38fe1363cb11ea50efa58dd6f7b7b9 # Parent 755b8198b0715f2ec9e341fe8e7fed95ac3283be adds dav-sync archive command diff -r 755b8198b071 -r c517502d3e38 dav/sync.c --- a/dav/sync.c Tue Sep 05 17:25:09 2017 +0200 +++ b/dav/sync.c Thu Sep 07 18:18:30 2017 +0200 @@ -100,7 +100,9 @@ if(!strcmp(cmd, "pull")) { ret = cmd_pull(args); } else if(!strcmp(cmd, "push")) { - ret = cmd_push(args); + ret = cmd_push(args, FALSE); + } else if(!strcmp(cmd, "archive")) { + ret = cmd_push(args, TRUE); } else if(!strcmp(cmd, "resolve-conflicts")) { ret = cmd_resolve_conflicts(args); } else if(!strcmp(cmd, "delete-conflicts")) { @@ -142,6 +144,7 @@ fprintf(stderr, "Commands:\n"); fprintf(stderr, " pull [-cld] \n"); fprintf(stderr, " push [-cld] \n"); + fprintf(stderr, " archive [-cld] \n"); fprintf(stderr, " resolve-conflicts \n"); fprintf(stderr, " delete-conflicts \n"); fprintf(stderr, " trash-info \n"); @@ -735,7 +738,7 @@ return ucx_map_cstr_get(db->conflict, res->path) ? 1 : 0; } -int cmd_push(CmdArgs *a) { +int cmd_push(CmdArgs *a, DavBool archive) { if(a->argc != 1) { fprintf(stderr, "Too %s arguments\n", a->argc < 1 ? "few" : "many"); return -1; @@ -878,7 +881,7 @@ } // delete all removed files - if(ret == 0) { + if(ret == 0 && !archive) { UcxMapIterator i = ucx_map_iterator(db->resources); LocalResource *local; UCX_MAP_FOREACH(key, local, i) { @@ -935,11 +938,13 @@ char *str_delete = sync_delete == 1 ? "file" : "files"; char *str_skipped = sync_delete == 1 ? "file" : "files"; char *str_error = sync_error == 1 ? "error" : "errors"; - printf("Result: %d %s pushed, %d %s deleted, %d %s skipped, %d %s\n", - sync_success, str_success, - sync_delete,str_delete, - sync_skipped,str_skipped, - sync_error, str_error); + + printf("Result: %d %s pushed, ", sync_success, str_success); + if(!archive) { + printf("%d %s deleted, ", sync_delete, str_delete); + } + printf("%d %s skipped, %d %s\n", + sync_skipped, str_skipped, sync_error, str_error); } return ret; diff -r 755b8198b071 -r c517502d3e38 dav/sync.h --- a/dav/sync.h Tue Sep 05 17:25:09 2017 +0200 +++ b/dav/sync.h Thu Sep 07 18:18:30 2017 +0200 @@ -46,7 +46,7 @@ void print_usage(char *cmd); int cmd_pull(CmdArgs *args); -int cmd_push(CmdArgs *args); +int cmd_push(CmdArgs *args, DavBool archive); int sync_get_resource( CmdArgs *a, diff -r 755b8198b071 -r c517502d3e38 dav/version.h --- a/dav/version.h Tue Sep 05 17:25:09 2017 +0200 +++ b/dav/version.h Thu Sep 07 18:18:30 2017 +0200 @@ -29,7 +29,7 @@ #ifndef VERSION_H #define VERSION_H -#define DAV_VERSION "1.0.0" +#define DAV_VERSION "1.0 dev" #endif /* VERSION_H */