Patchwork [1,of,2] keyword: use vfs.reljoin and util.unlinkpath to remove kwdemo

login
register
mail settings
Submitter Christian Ebert
Date Jan. 3, 2015, 11:15 a.m.
Message ID <9df29d52665a29faab28.1420283747@1.0.0.127.in-addr.arpa>
Download mbox | patch
Permalink /patch/7311/
State Accepted
Headers show

Comments

Christian Ebert - Jan. 3, 2015, 11:15 a.m.
# HG changeset patch
# User Christian Ebert <blacktrash@gmx.net>
# Date 1420283506 0
#      Sat Jan 03 11:11:46 2015 +0000
# Node ID 9df29d52665a29faab2805f5e771586387cab553
# Parent  3314664606e63e0ae263b71f5210e8153291efe8
keyword: use vfs.reljoin and util.unlinkpath to remove kwdemo

Patch

diff --git a/hgext/keyword.py b/hgext/keyword.py
--- a/hgext/keyword.py
+++ b/hgext/keyword.py
@@ -457,12 +457,9 @@  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, topdown=False):
+    for root, dirs, files in os.walk(tmpdir):
         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)
+            util.unlinkpath(repo.vfs.reljoin(root, f))
 
 @command('kwexpand',
     commands.walkopts,