changeset 21981:897bee697d51

keyword: really clean up kwdemo temp tree
author Christian Ebert <blacktrash@gmx.net>
date Sat, 02 Aug 2014 09:44:11 +0100
parents f4e5753745e9
children 97d5aca9bb66
files hgext/keyword.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/keyword.py	Sat Jul 26 14:54:36 2014 -0700
+++ b/hgext/keyword.py	Sat Aug 02 09:44:11 2014 +0100
@@ -87,7 +87,7 @@
 from mercurial import scmutil, pathutil
 from mercurial.hgweb import webcommands
 from mercurial.i18n import _
-import os, re, shutil, tempfile
+import os, re, tempfile
 
 cmdtable = {}
 command = cmdutil.command(cmdtable)
@@ -450,7 +450,12 @@
     repo.commit(text=msg)
     ui.status(_('\n\tkeywords expanded\n'))
     ui.write(repo.wread(fn))
-    shutil.rmtree(tmpdir, ignore_errors=True)
+    for root, dirs, files in os.walk(tmpdir, topdown=False):
+        for f in files:
+            util.unlink(os.path.join(root, f))
+        for d in dirs:
+            os.rmdir(os.path.join(root, d))
+    os.rmdir(tmpdir)
 
 @command('kwexpand',
     commands.walkopts,