[Unison-hackers] [unison-svn] r520 - trunk/src
schmitta at seas.upenn.edu
schmitta at seas.upenn.edu
Mon Mar 11 04:41:38 EDT 2013
Author: schmitta
Date: 2013-03-11 04:41:38 -0400 (Mon, 11 Mar 2013)
New Revision: 520
Modified:
trunk/src/recon.ml
Log:
Adding the maxsizethreshold option which prevents the transfer of files larger than the size specified (in Kb)
Modified: trunk/src/recon.ml
===================================================================
--- trunk/src/recon.ml 2013-03-11 08:41:33 UTC (rev 519)
+++ trunk/src/recon.ml 2013-03-11 08:41:38 UTC (rev 520)
@@ -211,6 +211,15 @@
It is recommended to use {\\tt BelowPath} \
patterns when selecting a directory and all its contents.")
+let maxSizeThreshold =
+ Prefs.createInt "maxsizethreshold" (-1)
+ "!prevent transfer of files bigger than this (if >=0, in Kb)"
+ ("A number indicating above what filesize (in kilobytes) Unison should "
+ ^ "flag a conflict instead of transferring the file. "
+ ^ "This conflict remains even in the presence of force or prefer options. "
+ ^ "A negative number will allow every transfer independently of the size. "
+ ^ "The default is -1. ")
+
let partialCancelPref actionKind =
match actionKind with
`DELETION -> noDeletionPartial
@@ -236,10 +245,17 @@
||
List.mem root2 (Pred.assoc_all (partialCancelPref kind) path)
in
+ let testSize rc =
+ Prefs.read maxSizeThreshold >= 0
+ && Props.length rc.desc >=
+ Uutil.Filesize.ofInt64
+ (Int64.mul (Int64.of_int 1000)
+ (Int64.of_int (Prefs.read maxSizeThreshold)))
+ in
match actionKind rc1 rc2 with
- `UPDATE -> test `UPDATE
+ `UPDATE -> test `UPDATE || testSize rc1
| `DELETION -> test `UPDATE || test `DELETION
- | `CREATION -> test `CREATION
+ | `CREATION -> test `CREATION || testSize rc1
let filterRi root1 root2 ri =
match ri.replicas with
More information about the Unison-hackers
mailing list