[MERGE] Fix ``bzr rm`` to not delete modified and ignored files
John Arbash Meinel
john at arbash-meinel.com
Wed Nov 28 17:31:59 GMT 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Lukáš Lalinský wrote:
> This is a fix for #172598, all details are at
> https://bugs.launchpad.net/bzr/+bug/172598. The problem was in fairly
> complex condition with multiple and/or -- ignored files were always
> marked as safe to delete, even if they contain uncommitted changes. I've
> split the condition into multiple ifs, I think it's more readable this
> way.
>
> Lukas
>
>
+ # Unknown ...
+ if versioned == (False, False):
+ # ... but not ignored
+ if not self.is_ignored(path[1]):
+ has_changed_files = True
+ break
+ # Versioned and changed, but not deleted
+ elif content_change and (kind[1] != None):
has_changed_files = True
break
I would probably rather see the comments inside the if block, so it is obvious
that the test was evaluated to True.
So something like:
if versioned === (False, False):
# The file is unknown
if not self.is_ignored(path[1]):
# But it is not ignored
has_changed_files = True
break
elif content_change and (kind[1] != None):
# Versioned and changed, but not deleted
has_changed_files = True
break
Otherwise I feel like *before* we get to the first if check, we know that the
file is unknown (possibly because it fell through earlier checks).
Since it passes my earlier ad-hoc test, though. I think this is an improvement
and should be merged.
BB:tweak
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHTaYPJdeBCYSNAAMRAj82AJoDps2a+ml0b4s+ecqAWDSD1fCzKQCdGyOB
T8xCJ4CVGdhNwasMS/TfbNk=
=lKM8
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list