[PATCH] osutils.rmtree + test

Martin Pool mbp at sourcefrog.net
Mon Jan 23 09:10:29 GMT 2006


On 22 Jan 2006, John A Meinel <john at arbash-meinel.com> wrote:

> I'm not 100% that we want 'always-works'. I know we switched from having
> branch entries being readonly so we could let people do 'rm -r' and not
> have to use '-f'. I also don't want us to suppress other errors because
> we always delete everything.
> 
> I *am* 100% that we should be able to delete the testing tree. We know
> we put everything in there, and it is okay to delete it all.

I agree.

> I also can say that we are just trying to provide the expected
> functionality to 'rmtree'. On Linux it does delete everything, we expect
> that, so it is only used where it is safe. So we are just bringing that
> into win32.

Actually it's not quite like that: it will fail on Linux if a
*directory* is readonly.  (Which reflects the underlying filesystem: on
Unix you can delete a readonly file if its directory is writeable, on
Windows not.)

Perhaps we should give rmtree an optional parameter saying whether to
force deletion?  At any rate the callback is not win32-specific, it will
get called for directories on Unix.

> > First part of patch (rmtree-test.diff) provide rmtree stub and test.
> > Second part of patch (rmtree-osutils.diff) provide rmtree implementation
> > for windows that can delete readonly files and dirs. Also this patch
> > change all internal usage of shutil.rmtree to osutils.rmtree.

Looks good, and thanks for the nice test.

-- 
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060123/50ed9a9b/attachment.pgp 


More information about the bazaar mailing list