harmonizes output of push and pull

Wed, 10 Apr 2019 12:54:24 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 10 Apr 2019 12:54:24 +0200
changeset 561
5e6df4f502d3
parent 560
a816e805e5db
child 562
78a25071ed88

harmonizes output of push and pull
pull gets conflict counter, push uses the term conflict instead of skipped (the output also says conflict: ...)

dav/sync.c file | annotate | diff | comparison | revisions
--- a/dav/sync.c	Wed Apr 10 11:03:37 2019 +0200
+++ b/dav/sync.c	Wed Apr 10 12:54:24 2019 +0200
@@ -580,6 +580,7 @@
     int sync_success = 0;
     int sync_delete = 0;
     int sync_error = 0;
+    int sync_conflict = 0;
     
     UcxList *res_modified = NULL;
     UcxList *res_new = NULL;
@@ -701,6 +702,7 @@
     // we need a map for all conflicts for fast lookups
     UcxMap *conflicts = ucx_map_new(ucx_list_size(res_conflict)+16);
     UCX_FOREACH(elm, res_conflict) {
+        ++sync_conflict;
         DavResource *res = elm->data;
         ucx_map_cstr_put(conflicts, res->path, res);
     }
@@ -814,9 +816,11 @@
         char *str_success = sync_success == 1 ? "file" : "files";
         char *str_delete = sync_delete == 1 ? "file" : "files";
         char *str_error = sync_error == 1 ? "error" : "errors";
-        printf("Result: %d %s pulled, %d %s deleted, %d %s\n",
+        char *str_conflict = sync_conflict == 1 ? "conflict" : "conflicts";
+        printf("Result: %d %s pulled, %d %s deleted, %d %s, %d %s\n",
                 sync_success, str_success,
                 sync_delete,str_delete,
+                sync_conflict, str_conflict,
                 sync_error, str_error);
     }
     
@@ -1516,7 +1520,7 @@
     
     int sync_success = 0;
     int sync_delete = 0;
-    int sync_skipped = 0;
+    int sync_conflict = 0;
     int sync_error = 0;
     
     UcxList *ls_new = NULL;
@@ -1566,6 +1570,7 @@
             continue;
         }
         
+        // skip conflict backups silently
         if(res_isconflict(db, local_res)) {
             ls_conflict = ucx_list_append(ls_conflict, local_res);
             continue;
@@ -1728,7 +1733,7 @@
                 nullfree(local_res->hash);
                 local_res->hash = NULL;
                 local_res->skipped = TRUE;
-                sync_skipped++;
+                ++sync_conflict;
             } else {
                 printf("put: %s\n", local_res->path);
                 if(sync_put_resource(dir, res, local_res, &sync_success)) {
@@ -1764,7 +1769,7 @@
             nullfree(local->hash);
             local->hash = NULL;
             local->skipped = TRUE;
-            sync_skipped++;
+            ++sync_conflict;
         } else {
             DavResource *origin_res = dav_resource_new(sn, local->origin->path);
             int origin_changed = remote_resource_is_changed(
@@ -1876,15 +1881,15 @@
     if(ret != -2) {
         char *str_success = sync_success == 1 ? "file" : "files";
         char *str_delete = sync_delete == 1 ? "file" : "files";
-        char *str_skipped = sync_delete == 1 ? "file" : "files";
+        char *str_conflict = sync_conflict == 1 ? "conflict" : "conflicts";
         char *str_error = sync_error == 1 ? "error" : "errors";
         
         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);
+        printf("%d %s, %d %s\n",
+                sync_conflict, str_conflict, sync_error, str_error);
     }
     
     return ret;

mercurial