[BUG] Can't remove non-existant file

Aaron Bentley aaron.bentley at utoronto.ca
Thu May 26 15:15:42 BST 2005


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

Hi again,

If we apply the fix from my "half-constructed Branch" email, we still
can't remove a non existant file.

abentley at troll:~/bzrtools2$ bzr remove .be
bzr: error: u'/home/abentley/bzrtools2/.be' does not exist
~  at /home/abentley/bzr.dev/bzrlib/branch.py:64 in find_branch_root()
~  see ~/.bzr.log for debug information

This comes from the fact that you determine the branch root from the
first parameter, not the cwd.

My knee-jerk reaction is to do os.path.dirname() on the argument to
find_branch_root.  That would fix this case, but what if I tried this:
$ bzr remove .be/bugs

Now neither the argument, nor its parent directory exists.  Greaaaat.

So on the one hand, we could recursively scan up until we hit a parent
directory that *does* exist.  But that can cause typos to have
exceedingly weird results-- we can wind up in a versioned directory
several levels higher.

I think a possibly-sane approach would be to use tree-root of the cwd as
a stop-directory for the scan.  But that would mean that you'd never be
able to remove files in a different working tree from the cwd's tree.
(Except children of the cwd).

I think this is all way too heuristic to have in the Branch constructor.
~  I'd be much happier to see factory functions/methods called
init_branch and find_branch instead of the init_branch and find_branch
constructor options.

As a bonus, that would also solve the "half-constructed" issue.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCldoO0F+nu1YWqI0RAmpiAJ4hjCTbKpmPRfkUTDmkX7rBbnaVagCfYSfZ
KUWQyULh5FGjGj1nEIPoQ+M=
=fZyv
-----END PGP SIGNATURE-----




More information about the bazaar mailing list