[Unison-hackers] Treat directory as atomic?

Benjamin Pierce bcpierce at cis.upenn.edu
Tue May 1 09:00:23 EDT 2007


> It would be great to be able to add patterns to an "atomic" list.   
> Something on the atomic list would be treated as a leaf of  
> synchronization even if it is a directory.
>
> There are many examples of directories that should be treated  
> atomically: for example, the fsfs database for my subversion  
> repository.  Or, on the Macintosh, by convention many "files" are  
> represented by directories -- such as keynote presentations (.key).
>
> Any ideas?  Apologies if I've missed some way to do this with the  
> current options.  If someone wise could give me a bit of high-level  
> advice on how to implement this feature, I could maybe give it a shot.

One fairly simple way to add this feature (which, I agree, would be  
useful) could be to treat the "atomic" preference simply as a way of  
*preventing* propagation of changes when two files have been changed  
on different hosts within an atomic directory.  This would be pretty  
easy to implement because it would only involve changing the  
"proposed synchronization direction" of these files from their  
"natural" directions to "no recommendation," and this can be done in  
a postprocessing step after update detection and reconciliation are  
all finished (similarly to -prefer and -force).  Look at the function  
overrideReconcilerChoices in recon.ml.

One slightly tricky bit, though, will be figuring out how to show the  
user *why* these files are being marked "no recommendation": people  
are going to forget what patterns they've put in their "atomic" list,  
so the user interface is going to have to make it clear somehow.

     - Benjamin




More information about the Unison-hackers mailing list