[BUG] Can't remove non-existant file

Aaron Bentley aaron.bentley at utoronto.ca
Thu May 26 17:43:04 BST 2005


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

John Arbash Meinel wrote:
|>This comes from the fact that you determine the branch root from the
|>first parameter, not the cwd.
|
|
| Actually, it generally calls os.path.realpath() which doesn't care if
| the file exists or not. Or it at least calls os.path.abspath() which
| also doesn't care.

Well, that's one way of looking at it.  I'm saying that the problem is
that it's harder to find the correct branch for a non-existent file than
it is to find the correct branch for the cwd.

| The specific problem is actually that lines 63 & 64 just should not be
| there:
|     if not os.path.exists(f):
|         raise BzrError('%r does not exist' % f)

The reason I added that error was because this happened to me:
$ bzr merge ~/arch/mistyped-branch-name .
$ bzr status
ALL FILES REMOVED

Huh?

| It explicitly checks if a file exists, when really it should just wait
| for the while True: loop to fail.

That it what it used to do.  As a result, it found ~/arch, which was a
versioned directory with no source files.  It applied the difference
between that dir and the cwd, and therefore removed everything.
Perfectly reasonable, if you accept that it should find ~/arch in the
first place.

| I don't think there is a problem to say find_branch_root() of a file
| that doesn't exist, but may in the near future (recent past).

The problem is trying to come up with a set of rules that work in all
cases and don't surprise users.

|>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 guess that would mean that find_branch_root would be on '.', not on
| the supplied filename.

No, Martin doesn't want to do that.  He wants "bzr add
~/totally/different/directory" to work, so logically, "bzr remove
~/totally/different/directory" should also work.

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

iD8DBQFClfyX0F+nu1YWqI0RAr5XAKCA+mj9ZGaXHgvbGd2PHW+1R9C32gCfReB0
gjrcSoMbaph/9inQAmctgz8=
=HWXH
-----END PGP SIGNATURE-----




More information about the bazaar mailing list