[PATCH RESEND] keyword: use wvfs.rmtree to remove kwdemo directory

Matt Mackall mpm at selenic.com
Sat May 2 16:48:31 CDT 2015


On Sat, 2015-05-02 at 08:34 +0100, Christian Ebert wrote:
> * Pierre-Yves David on Friday, May 01, 2015 at 16:56:28 -0700
> > On 05/01/2015 04:21 PM, Christian Ebert wrote:
> >> # HG changeset patch
> >> # User Christian Ebert <blacktrash at gmx.net>
> >> # Date 1429364366 -7200
> >> #      Sat Apr 18 15:39:26 2015 +0200
> >> # Node ID 7d7445e0ea622532c20a8a8fa5a00e582fe96c38
> >> # Parent  2ee10789d66b9ca500a7bfb1b3e031e04cdc4fb7
> >> keyword: use wvfs.rmtree to remove kwdemo directory
> >> 
> >> diff --git a/hgext/keyword.py b/hgext/keyword.py
> >> --- a/hgext/keyword.py
> >> +++ b/hgext/keyword.py
> >> @@ -457,9 +457,7 @@ def demo(ui, repo, *args, **opts):
> >>     repo.commit(text=msg)
> >>     ui.status(_('\n\tkeywords expanded\n'))
> >>     ui.write(repo.wread(fn))
> >> -    for root, dirs, files in os.walk(tmpdir):
> >> -        for f in files:
> >> -            util.unlinkpath(repo.vfs.reljoin(root, f))
> >> +    repo.wvfs.rmtree()
> > 
> > rmtree with no argument?
> 
> Yes, the entire self repo/tmpdir, like in subrepo.py.
> 
> At least that what happens, and it should.

That's quite a scary API, now that you've drawn it to my attention.
Makes it a little too easy to accidentally delete repositories. We
probably shouldn't have a default arg there.. and we might even consider
not accepting empty strings.

-- 
Mathematics is the supreme nostalgia of our time.




More information about the Mercurial-devel mailing list