[Merge] workingtree.walkdirs to support walking an empty directory
mbp at canonical.com
Thu Jul 12 09:11:47 BST 2007
Martin Pool has voted -1.
Status is now: Vetoed
That sounds like a good thing to fix, thanks.
+ class DirBlock:
I don't understand why DirBlock is inside the test class. Our general
practice is to define classes at the top level so it's clear they're not
coupled to another class and so the indented blocks are less long --
even if they're only used from one other class.
A comment on this class would be good - that it gives you an object
representation of the tuples returned by dirstate. (Stated like that
it's more clear that other tests might want to use it.)
- if current_disk[top_strip_len:] == '':
+ if (current_disk[top_strip_len:] == '' and
+ len(current_disk) > 0):
Sorry I don't understand how this works - can you explain?
+ tree, expected_dirblocks = self.get_tree(self.added, prefix)
+ for dirinfo, dirblock in tree.walkdirs(prefix):
+ result.append((dirinfo, list(dirblock)))
+ # check each return value for debugging ease.
+ for pos, item in enumerate(expected_dirblocks):
+ result_pos = 
+ if len(result) > pos:
+ result_pos = result[pos]
+ self.assertEqual(item, result_pos)
+ self.assertEqual(len(expected_dirblocks), len(result))
It looks like all this is repeated between the two methods and could be
For details, see:
More information about the bazaar