Rev 168: Start looking at using parent_id to lookup in http://bazaar.launchpad.net/~jameinel/bzr-explorer/wt_model

John Arbash Meinel john at arbash-meinel.com
Tue Jul 7 22:39:39 BST 2009


At http://bazaar.launchpad.net/~jameinel/bzr-explorer/wt_model

------------------------------------------------------------
revno: 168
revision-id: john at arbash-meinel.com-20090707213934-ck04k1uiy5jlimg4
parent: john at arbash-meinel.com-20090707213728-1p71ophh8c5genbk
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: wt_model
timestamp: Tue 2009-07-07 16:39:34 -0500
message:
  Start looking at using parent_id to lookup
  
  However, this won't work for unversioned dirs, so we should reconsider.
-------------- next part --------------
=== modified file 'lib/wt_model.py'
--- a/lib/wt_model.py	2009-07-07 21:37:28 +0000
+++ b/lib/wt_model.py	2009-07-07 21:39:34 +0000
@@ -72,7 +72,7 @@
                         dir_items[f_id] = wt_item
         finally:
             wt.unlock()
-        return root_wt_item
+        return root_wt_item, dir_items
 
 
 class WorkingTreeModel(QtCore.QAbstractItemModel):
@@ -89,7 +89,7 @@
     def __init__(self, wt, parent=None):
         QtCore.QAbstractItemModel.__init__(self, parent)
         self._wt = wt
-        self._root_wt_item = _WTItem.create_from_wt(self._wt)
+        self._root_wt_item, self._dir_items = _WTItem.create_from_wt(self._wt)
 
     def index(self, row, column, parent=None):
         """Return the QModelIndex for the given item.

=== modified file 'tests/test_wt_model.py'
--- a/tests/test_wt_model.py	2009-07-07 21:37:28 +0000
+++ b/tests/test_wt_model.py	2009-07-07 21:39:34 +0000
@@ -121,7 +121,7 @@
         self.build_tree(['a_file'])
         wt.add(['a_file'], ['file-id'])
         wt.set_root_id('root-id')
-        root_item = wt_model._WTItem.create_from_wt(wt)
+        root_item, _ = wt_model._WTItem.create_from_wt(wt)
         self.assertIsInstance(root_item, wt_model._WTItem)
         self.assertEqual('', root_item.path)
         self.assertEqual('', root_item.name)
@@ -143,7 +143,7 @@
         self.build_tree(['a_file', 'unversioned-file'])
         wt.set_root_id('root-id')
         wt.add(['a_file'], ['file-id'])
-        root_item = wt_model._WTItem.create_from_wt(wt)
+        root_item, _ = wt_model._WTItem.create_from_wt(wt)
         self.assertIsInstance(root_item, wt_model._WTItem)
         self.assertEqual('', root_item.path)
         self.assertEqual('', root_item.name)
@@ -174,7 +174,7 @@
         wt.set_root_id('root-id')
         wt.add(['dir', 'dir/subdir', 'dir/subdir/a_file'],
                ['dir-id', 'subdir-id', 'file-id'])
-        root_item = wt_model._WTItem.create_from_wt(wt)
+        root_item, _ = wt_model._WTItem.create_from_wt(wt)
         self.assertIsInstance(root_item, wt_model._WTItem)
         self.assertEqual('root-id', root_item.file_id)
         self.assertIs(None, root_item.parent_id)



More information about the bazaar-commits mailing list