[Unison-hackers] text ui: nothing is logged when there is nothing to propagate

Benjamin C. Pierce bcpierce at cis.upenn.edu
Sun Mar 10 12:29:37 EDT 2013


Yes, adding similar information for failed paths sounds like a good idea.  Do add that if you are feeling energetic… :-)

   - B


On Mar 10, 2013, at 11:22 AM, Alan Schmitt <alan.schmitt at polytechnique.org> wrote:

> Benjamin C. Pierce writes:
> 
>> Yes, please go ahead with all of them. My only tiny comment is that
>> the new preference should be marked "advanced" (by putting a * at the
>> beginning of its long description, IIRC).
> 
> OK, I made that change (it's a '!' at the beginning of the short
> description, by the way).
> 
> I also modified the way I display the reasons for errors or skips: it's
> inside the log if items are transferred, and in any case it's in the
> summary at the end. This makes it easier to grep.
> 
> This is for instance what I get in the log after a small test:
> 
> If nothing was transferred:
> 
> Synchronization complete at 15:59:42  (0 item transferred, 2 skipped, 0 failed)
>  skipped: fable.pdf (would transfer a file of size greater than maxsizethreshold)
>  skipped: fine-esop.pdf (skip requested)
> 
> 
> If something was transferred:
> 
> UNISON 2.46.13 started propagating changes at 16:09:09.24 on 10 Mar 2013
> [CONFLICT] Skipping fable.pdf
>  would transfer a file of size greater than maxsizethreshold
> [BGN] Deleting fine-esop.pdf from /Users/schmitta/tmp/unison_test/a
> [END] Deleting fine-esop.pdf
> UNISON 2.46.13 finished propagating changes at 16:09:09.25 on 10 Mar 2013
> 
> 
> Synchronization complete at 16:09:09  (1 item transferred, 1 skipped, 0 failed)
>  skipped: fable.pdf (would transfer a file of size greater than maxsizethreshold)
> 
> 
> We could also add this information for failed paths, by changing the
> 'doTransport' function. This way one would know in the summary why there
> was a problem, instead of having to go hunt into the log. Let me know if
> you want me to add this.
> 
> 
> Here is the modified uitext patch.
> 
> diff --git a/src/uitext.ml b/src/uitext.ml
> index 5fca0d9..364cb07 100644
> --- a/src/uitext.ml
> +++ b/src/uitext.ml
> @@ -578,9 +578,12 @@ let rec interactAndPropagateChanges reconItemList
>     if skipped>0 then
>       Safelist.iter
>         (fun ri ->
> -        if problematic ri then
> -          alwaysDisplayAndLog
> -            ("  skipped: " ^ (Path.toString ri.path1)))
> +         match ri.replicas with
> +           Problem r
> +         | Different {rc1 = _; rc2 = _; direction = Conflict r; default_direction = _} ->
> +            alwaysDisplayAndLog (Printf.sprintf "  skipped: %s (%s)"
> +                                                (Path.toString ri.path1) r)
> +         | _ -> ())
>         newReconItemList;
>     if partials>0 then
>       Safelist.iter
> @@ -604,6 +607,25 @@ let rec interactAndPropagateChanges reconItemList
>     if !Update.foundArchives && Prefs.read Uicommon.repeat = "" then
>       Update.commitUpdates ();
>     display "No updates to propagate\n";
> +    if skipped > 0 then begin
> +      let summary =
> +        Printf.sprintf
> +          "Synchronization complete at %s  (0 item transferred, %d skipped, 0 failed)"
> +          (let tm = Util.localtime (Util.time()) in
> +           Printf.sprintf "%02d:%02d:%02d"
> +                          tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec)
> +          skipped in
> +      Trace.log (summary ^ "\n");
> +      Safelist.iter
> +        (fun ri ->
> +         match ri.replicas with
> +           Problem r
> +         | Different {rc1 = _; rc2 = _; direction = Conflict r; default_direction = _} ->
> +            alwaysDisplayAndLog (Printf.sprintf "  skipped: %s (%s)"
> +                                                (Path.toString ri.path1) r)
> +         | _ -> ())
> +        newReconItemList
> +      end;
>     (skipped > 0, false, false, [])
>   end else if proceed=ProceedImmediately then begin
>     doit()
> 
> 
> Alan
> _______________________________________________
> Unison-hackers mailing list
> Unison-hackers at lists.seas.upenn.edu
> http://lists.seas.upenn.edu/mailman/listinfo/unison-hackers



More information about the Unison-hackers mailing list