keyword: really clean up kwdemo temp tree
authorChristian Ebert <blacktrash@gmx.net>
Sat, 02 Aug 2014 09:44:11 +0100
changeset 21981 897bee697d51
parent 21980 f4e5753745e9
child 21982 97d5aca9bb66
keyword: really clean up kwdemo temp tree
hgext/keyword.py
--- 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,