Commit by: vajda Modified files: chandler/repository/item/Item.py 1.199 1.200 chandler/repository/persistence/DBRepositoryView.py 1.8 1.9 chandler/repository/persistence/Repository.py 1.95 1.96 chandler/repository/persistence/RepositoryView.py 1.34 1.35
Log message: - added freshOnly optional flag to mapChanges for fix to blocker bug 2588 ViewCVS links: http://cvs.osafoundation.org/index.cgi/chandler/repository/item/Item.py.diff?r1=text&tr1=1.199&r2=text&tr2=1.200 http://cvs.osafoundation.org/index.cgi/chandler/repository/persistence/DBRepositoryView.py.diff?r1=text&tr1=1.8&r2=text&tr2=1.9 http://cvs.osafoundation.org/index.cgi/chandler/repository/persistence/Repository.py.diff?r1=text&tr1=1.95&r2=text&tr2=1.96 http://cvs.osafoundation.org/index.cgi/chandler/repository/persistence/RepositoryView.py.diff?r1=text&tr1=1.34&r2=text&tr2=1.35 Index: chandler/repository/item/Item.py diff -u chandler/repository/item/Item.py:1.199 chandler/repository/item/Item.py:1.200 --- chandler/repository/item/Item.py:1.199 Mon Feb 28 12:28:11 2005 +++ chandler/repository/item/Item.py Wed Mar 2 14:10:00 2005 @@ -1,6 +1,6 @@ -__revision__ = "$Revision: 1.199 $" -__date__ = "$Date: 2005/02/28 20:28:11 $" +__revision__ = "$Revision: 1.200 $" +__date__ = "$Date: 2005/03/02 22:10:00 $" __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation" __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm" @@ -1274,6 +1274,8 @@ Item._monitorsClass.invoke('set', self, attribute) self._lastAccess = _countAccess() + dirty |= Item.FDIRTY + if self._status & Item.DIRTY == 0: view = self.getRepositoryView() if view is not None and not view.isLoading(): @@ -1291,7 +1293,7 @@ self._status |= dirty else: - self._status &= ~(Item.DIRTY | Item.ADIRTY) + self._status &= ~(Item.DIRTY | Item.ADIRTY | Item.FDIRTY) self._values._clearDirties() self._references._clearDirties() if self._children is not None: @@ -2264,27 +2266,27 @@ return False Nil = nil() - DELETED = 0x0001 - VDIRTY = 0x0002 # literal or ref changed - DELETING = 0x0004 - RAW = 0x0008 - ATTACHING = 0x0010 - SCHEMA = 0x0020 - NEW = 0x0040 - STALE = 0x0080 - NDIRTY = 0x0100 # parent or name changed - CDIRTY = 0x0200 # children list changed - RDIRTY = 0x0400 # ref collection changed - CORESCHEMA = 0x0800 # core schema item - CONTAINER = 0x1000 # has children - ADIRTY = 0x2000 # acl(s) changed - PINNED = 0x4000 # auto-refresh, don't stale - NODIRTY = 0x8000 # turn off dirtying - - VMERGED = VDIRTY << 16 - RMERGED = RDIRTY << 16 - NMERGED = NDIRTY << 16 - CMERGED = CDIRTY << 16 + DELETED = 0x00000001 + VDIRTY = 0x00000002 # literal or ref changed + DELETING = 0x00000004 + RAW = 0x00000008 + ATTACHING = 0x00000010 + SCHEMA = 0x00000020 + NEW = 0x00000040 + STALE = 0x00000080 + NDIRTY = 0x00000100 # parent or name changed + CDIRTY = 0x00000200 # children list changed + RDIRTY = 0x00000400 # ref collection changed + CORESCHEMA = 0x00000800 # core schema item + CONTAINER = 0x00001000 # has children + ADIRTY = 0x00002000 # acl(s) changed + PINNED = 0x00004000 # auto-refresh, don't stale + NODIRTY = 0x00008000 # turn off dirtying + FDIRTY = 0x00010000 # fresh dirty since last mapChange call + VMERGED = 0x00020000 + RMERGED = 0x00040000 + NMERGED = 0x00080000 + CMERGED = 0x00100000 VRDIRTY = VDIRTY | RDIRTY DIRTY = VDIRTY | RDIRTY | NDIRTY | CDIRTY Index: chandler/repository/persistence/DBRepositoryView.py diff -u chandler/repository/persistence/DBRepositoryView.py:1.8 chandler/repository/persistence/DBRepositoryView.py:1.9 --- chandler/repository/persistence/DBRepositoryView.py:1.8 Wed Feb 2 22:22:38 2005 +++ chandler/repository/persistence/DBRepositoryView.py Wed Mar 2 14:10:00 2005 @@ -1,6 +1,6 @@ -__revision__ = "$Revision: 1.8 $" -__date__ = "$Date: 2005/02/03 06:22:38 $" +__revision__ = "$Revision: 1.9 $" +__date__ = "$Date: 2005/03/02 22:10:00 $" __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation" __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm" @@ -332,19 +332,25 @@ return itemWriter.writeItem(item, newVersion) - def mapChanges(self, callable): + def mapChanges(self, callable, freshOnly=False): for item in self._log: - if item.isDeleted(): - callable(item, item._version, item._status, [], []) - elif item.isNew(): - callable(item, item._version, item._status, - item._values.keys(), - item._references.keys()) - else: - callable(item, item._version, item._status, - item._values._getDirties(), - item._references._getDirties()) + status = item._status + if not freshOnly or freshOnly and status & Item.FDIRTY: + if freshOnly: + status &= ~Item.FDIRTY + item._status = status + + if item.isDeleted(): + callable(item, item._version, status, [], []) + elif item.isNew(): + callable(item, item._version, status, + item._values.keys(), + item._references.keys()) + else: + callable(item, item._version, status, + item._values._getDirties(), + item._references._getDirties()) def mapHistory(self, callable, fromVersion=0, toVersion=0): Index: chandler/repository/persistence/Repository.py diff -u chandler/repository/persistence/Repository.py:1.95 chandler/repository/persistence/Repository.py:1.96 --- chandler/repository/persistence/Repository.py:1.95 Thu Feb 17 11:59:06 2005 +++ chandler/repository/persistence/Repository.py Wed Mar 2 14:10:00 2005 @@ -1,6 +1,6 @@ -__revision__ = "$Revision: 1.95 $" -__date__ = "$Date: 2005/02/17 19:59:06 $" +__revision__ = "$Revision: 1.96 $" +__date__ = "$Date: 2005/03/02 22:10:00 $" __copyright__ = "Copyright (c) 2003-2004 Open Source Applications Foundation" __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm" @@ -456,9 +456,9 @@ except ValueError: return None - def mapChanges(self, callable): + def mapChanges(self, callable, freshOnly=False): - self.view.mapChanges(callable) + self.view.mapChanges(callable, freshOnly) def mapHistory(self, callable, fromVersion=0, toVersion=0): Index: chandler/repository/persistence/RepositoryView.py diff -u chandler/repository/persistence/RepositoryView.py:1.34 chandler/repository/persistence/RepositoryView.py:1.35 --- chandler/repository/persistence/RepositoryView.py:1.34 Fri Feb 4 12:35:52 2005 +++ chandler/repository/persistence/RepositoryView.py Wed Mar 2 14:10:00 2005 @@ -1,6 +1,6 @@ -__revision__ = "$Revision: 1.34 $" -__date__ = "$Date: 2005/02/04 20:35:52 $" +__revision__ = "$Revision: 1.35 $" +__date__ = "$Date: 2005/03/02 22:10:00 $" __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation" __license__ = "http://osafoundation.org/Chandler_0.1_license_terms.htm" @@ -711,7 +711,7 @@ return self - def mapChanges(self, callable): + def mapChanges(self, callable, freshOnly=False): """ Invoke a callable for every item changed in this view. @@ -727,6 +727,15 @@ - a list of changed literal attribute names - a list of changed references attribute names + + The return value of C{callable} is not used. + + @param callable: the function or method to be invoked. + @type callable: a python callable + @param freshOnly: optionally limit invocation of C{callable} to + items that were changed since last time this method was called or + since the last commit, whichever came last; C{False} by default. + @type freshOnly: boolean """ raise NotImplementedError, "%s.mapChanges" %(type(self)) _______________________________________________ Commits mailing list Commits@osafoundation.org http://lists.osafoundation.org/mailman/listinfo/commits