[PATCH 1 of 3] keyword: really clean up kwdemo temp tree

Christian Ebert blacktrash at gmx.net
Sat Aug 2 08:48:31 UTC 2014


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1406969051 -3600
#      Sat Aug 02 09:44:11 2014 +0100
# Node ID 74bfbf5ddd132a286b54d6acefdf3d8628390423
# Parent  3467cf39aae688e844d5c1c22b7daa85c590bef9
keyword: really clean up kwdemo temp tree

diff -r 3467cf39aae6 -r 74bfbf5ddd13 hgext/keyword.py
--- a/hgext/keyword.py	Fri Aug 01 18:32:52 2014 -0500
+++ b/hgext/keyword.py	Sat Aug 02 09:44:11 2014 +0100
@@ -87,7 +87,7 @@ from mercurial import localrepo, match, 
 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 @@ def demo(ui, repo, *args, **opts):
     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,


More information about the Mercurial-devel mailing list