]> code.delx.au - offlineimap/commitdiff
diffCollection now works with values
authorJohn Goerzen <jgoerzen@complete.org>
Thu, 29 May 2008 06:16:42 +0000 (01:16 -0500)
committerJohn Goerzen <jgoerzen@complete.org>
Thu, 29 May 2008 06:16:42 +0000 (01:16 -0500)
src/Data/Syncable.hs

index 97ec0f911d5a44aa1afcc82177834ed453753373..fcafda1e9d242c75435caaf6e8bead061ab3350e 100644 (file)
@@ -132,13 +132,15 @@ syncBiDir masterstate childstate lastchildstate =
 
 {- | Compares two SyncCollections, and returns the commands that, when
 applied to the first collection, would yield the second. -}
-diffCollection :: (Ord k, Show k, Show v) => 
+diffCollection :: (Ord k, Show k, Eq v, Show v) => 
                   SyncCollection k v
                -> SyncCollection k v
                -> [SyncCommand k v]
 diffCollection coll1 coll2 = 
     (map DeleteItem . findDeleted coll2 coll1 $ coll1) ++
-    (map (pairToFunc CopyItem) . findAdded coll2 coll1 $ coll1)
+    (map (pairToFunc CopyItem) . findAdded coll2 coll1 $ coll1) ++
+    (map (pairToFunc ModifyContent) . Map.toList .
+         findModified coll1 coll2 $ coll1)
 
 {- | Returns a list of keys that exist in state2 and lastchildstate
 but not in state1 -}