non-recursive status of a directory?

John Arbash Meinel john at arbash-meinel.com
Tue Jun 3 18:52:20 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Hammond wrote:
| I'm looking for a way to perform a non-recursive iter_changes() or
| changes_from() on a directory.  I'll try and explain my requirements: for
| Tortoise, I'd like the fastest possible way to say "give me the status of
| this one directory in a working tree".  I'd like to know about "missing"
| items in the directory, and I'd like to know an "immediate" status of any
| child directories (eg, if the directory has been added), but do *not* need a
| recursive status for children of the directory; the tortoise code will
| manage walking and watching subdirectories in the background in order to
| keep Windows explorer both responsive and accurate.
|
| Digging around a little, I noticed the builtin "status" command has adding a
| '--no-recurse' as a TODO comment, which gives me some hope.  I dug around in
| workingtree and it doesn't seem too hard to implement there, but then it was
| pointed out that workingtree_4 is what I should be looking at, and that
| looks a little trickier.
|
| So I guess I've a couple of questions:
|
| * Does my requirement make sense?
| * Any ideas how I can help to move towards it?
|
| Thanks,
|
| Mark

So, what you actually want is '--partial-recurse' or '--max-depth=1'. Because
you want to give a directory, and get the values for all children, but not for
their children.

If you knew all the entries, you could do:

tree.iter_changes(specific_files=[names, for, all the files, in the directory], r)

That doesn't help you much for missing files, and any directories you supply
will be recursively searched.

It isn't particularly hard to do what you want, we just haven't had a specific
use case for it, and thus haven't implemented it. WT4.iter_changes() in
particular is rather crufty in deference to performance. I've certainly
considered rewriting it to be more 'obvious', and just create a pyrex/C
extension as the optimized form.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhFhNQACgkQJdeBCYSNAAO1PwCgwMo/7ssMBMpdzJ6WljtiLmW1
EjYAoM9meWtyB6i/yPbIOUDIFPsDU6fj
=wYSo
-----END PGP SIGNATURE-----



More information about the bazaar mailing list