conduit r1750 - in trunk: . conduit conduit/dataproviders conduit/datatypes conduit/modules/EvolutionModule



Author: jstowers
Date: Mon Oct  6 20:05:08 2008
New Revision: 1750
URL: http://svn.gnome.org/viewvc/conduit?rev=1750&view=rev

Log:
2008-10-06  Matt Colyer <matt colyer name>

	* conduit/DeltaProvider.py:
	* conduit/MappingDB.py:
	* conduit/dataproviders/SimpleFactory.py:
	* conduit/dataproviders/VolumeFactory.py:
	* conduit/datatypes/__init__.py:
	* conduit/modules/EvolutionModule/EvolutionModule.py: Many small tidy ups.



Modified:
   trunk/ChangeLog
   trunk/conduit/DeltaProvider.py
   trunk/conduit/MappingDB.py
   trunk/conduit/dataproviders/SimpleFactory.py
   trunk/conduit/dataproviders/VolumeFactory.py
   trunk/conduit/datatypes/__init__.py
   trunk/conduit/modules/EvolutionModule/EvolutionModule.py

Modified: trunk/conduit/DeltaProvider.py
==============================================================================
--- trunk/conduit/DeltaProvider.py	(original)
+++ trunk/conduit/DeltaProvider.py	Mon Oct  6 20:05:08 2008
@@ -57,7 +57,7 @@
         for i in allItems[:]:
             if i in rids:
                 data = self.me.module.get(i)
-                if data.get_rid() != rids[i]:
+                if data.get_rid().get_hash() != rids[i].get_hash():
                     log.debug("Modified: Actual:%s v DB:%s" % (data.get_rid(), rids[i]))
                     modified.append(i)
                 del(rids[i])

Modified: trunk/conduit/MappingDB.py
==============================================================================
--- trunk/conduit/MappingDB.py	(original)
+++ trunk/conduit/MappingDB.py	Mon Oct  6 20:05:08 2008
@@ -94,14 +94,15 @@
             os.unlink(filename)
             self._open_db_and_check_structure(filename)
 
-    def get_mapping_from_objects(self, sourceDataLUID, sinkDataLUID, sinkUID):
+    def get_mapping_from_objects(self, LUID1, LUID2, UID):
         
-        sql = "SELECT * FROM mappings WHERE sourceDataLUID = ? AND sinkDataLUID = ? AND sinkUID = ?"
-        res = self._db.select_one(sql, (sourceDataLUID, sinkDataLUID, sinkUID))
+        # Check in both directions, as a conflict resolution can reverse the direction of the mapping
+        sql = "SELECT * FROM mappings WHERE (sourceUID = ? OR sinkUID = ? ) AND ((sinkDataLUID = ? AND sourceDataLUID = ?) OR (sourceDataLUID = ? AND sinkDataLUID = ?))"
+        res = self._db.select_one(sql, (UID, UID, LUID1, LUID2, LUID1, LUID2))
         
         #a mapping is always returned relative to the source -> sink
         #order in which it was called.
-        if (res[5] == sinkUID):
+        if (res[5] == UID):
             m = Mapping(
                     res[0],
                     sourceUID=res[1],

Modified: trunk/conduit/dataproviders/SimpleFactory.py
==============================================================================
--- trunk/conduit/dataproviders/SimpleFactory.py	(original)
+++ trunk/conduit/dataproviders/SimpleFactory.py	Mon Oct  6 20:05:08 2008
@@ -25,6 +25,7 @@
         self.items[key] = idxs
 
     def item_removed(self, key):
+        log.info("Item Removed: %s" % key)
         if key in self.items:
             for idx in self.items[key]:
                 self.emit_removed(idx)

Modified: trunk/conduit/dataproviders/VolumeFactory.py
==============================================================================
--- trunk/conduit/dataproviders/VolumeFactory.py	(original)
+++ trunk/conduit/dataproviders/VolumeFactory.py	Mon Oct  6 20:05:08 2008
@@ -37,7 +37,7 @@
         return True
 
     def _volume_unmounted_cb(self, monitor, device_udi):
-        log.info("Volume mounted, udi: %s" % device_udi)
+        log.info("Volume unmounted, udi: %s" % device_udi)
         if device_udi :
             if self.is_interesting(device_udi, self._get_properties(device_udi)):
                 self.item_removed(device_udi)

Modified: trunk/conduit/datatypes/__init__.py
==============================================================================
--- trunk/conduit/datatypes/__init__.py	(original)
+++ trunk/conduit/datatypes/__init__.py	Mon Oct  6 20:05:08 2008
@@ -78,12 +78,3 @@
         self.mtime = data['mtime']
         self.hash = data['hash']
 
-
-def compare_mtimes_and_hashes(data1, data2):
-    """
-    Compares data based upon its mtime and hashes only
-    """
-    mtime1 = data1.get_mtime()
-    mtime2 = data2.get_mtime()
-    hash1 = data1.get_hash()
-    hash2 = data2.get_hash()

Modified: trunk/conduit/modules/EvolutionModule/EvolutionModule.py
==============================================================================
--- trunk/conduit/modules/EvolutionModule/EvolutionModule.py	(original)
+++ trunk/conduit/modules/EvolutionModule/EvolutionModule.py	Mon Oct  6 20:05:08 2008
@@ -340,7 +340,6 @@
 
         note.set_UID(obj.get_uid())
         note.set_mtime(mtime)
-        print note.get_note_string()
         return note
 
     def _create_object(self, note):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]