[BUG] status incorrectly recurses into subtrees

Robert Collins robertc at robertcollins.net
Fri Mar 16 09:11:09 GMT 2007


On Thu, 2007-03-15 at 18:40 -0400, Aaron Bentley wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Oh dear, now I've found one that applies to the standard "status" command:
> 
> $ bzr init foo --dirstate-with-subtree
> $ mkdir foo/bar
> $ bzr add foo/bar
> added bar
> $ touch foo/bar/baz
> $ bzr init foo/bar --dirstate-with-subtree
> $ bzr status foo
> +N  bar+
> ?   bar/baz
> 
> $ bzr commit foo
> bzr: ERROR: Commit refused because there are unknown files in the
> working tree.
> abentley at lappy:~$ bzr commit foo --no-strict
> added bar
> Committed revision 1.
> 
> abentley at lappy:~$ bzr status foo
> 
> Freakishly, committing makes the unknown file stop being shown.
> 
> Also note that because WorkingTree4.extras is buggy, commit --strict
> also fails.

I'm partway through fixing this, primarily in terms of analysis. If
someone else wants to tackle it over my weekend, please feel free,
otherwise I'll get it done Monday.

The root cause is that _iter_changes trusts that the data from
tree.inventory._iter_entries_by_dir is correct, when in fact its not
(and never has been), but now the requirement that we not visit
directories that are not there in terms of unknowns, shows up.

While tree.walkdirs is nearly right to be a compelling fix to this, its
not right yet, and I think a less intrusive fix is appropriate for now:
Firstly InterTree._iter_changes it should check unversioned paths
against specific_files before outputting it (which will fix the first
issue Aaron encountered), and secondly as Aaron says, 'tree.extras'
should be changed to not trust the inventory as the primary list of
directories.

The second point needs additional tests: the ones I have planned are:
 - when a file becomes a dir (but the inventory hasn't been notified),
tree.extras lists its contents.
 - when a link/file/dir becomes a subtree, extras does not list its
contents.
tree.walkdirs should be useful here, though the 'dont iterate into
unwanted dirs' issue will need to be fixed - stacked walkdirs are a
problem at the moment, because the interface at the bottom layer
(osutils.walkdirs) (delete a row to not visit it) is fugly and not
exposed at the top layer (tree.walkdirs) - a better api is to have a
separate list that one appends to to skip a directory.

-Rob


-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20070316/75158e71/attachment.pgp 


More information about the bazaar mailing list