keyword: compact writing of temporary kwdemo hgrc
authorChristian Ebert <blacktrash@gmx.net>
Fri, 11 Mar 2016 08:27:11 +0000
changeset 28458 311472301ef3
parent 28457 e6310cdcc4d0
child 28459 3ea62e748a18
keyword: compact writing of temporary kwdemo hgrc
hgext/keyword.py
--- a/hgext/keyword.py	Thu Mar 10 23:46:19 2016 +0800
+++ b/hgext/keyword.py	Fri Mar 11 08:27:11 2016 +0000
@@ -430,10 +430,8 @@
             ui.readconfig(opts.get('rcfile'))
         if args:
             # simulate hgrc parsing
-            rcmaps = ['[keywordmaps]\n'] + [a + '\n' for a in args]
-            fp = repo.vfs('hgrc', 'w')
-            fp.writelines(rcmaps)
-            fp.close()
+            rcmaps = '[keywordmaps]\n%s\n' % '\n'.join(args)
+            repo.vfs.write('hgrc', rcmaps)
             ui.readconfig(repo.join('hgrc'))
         kwmaps = dict(ui.configitems('keywordmaps'))
     elif opts.get('default'):