changeset 28458:311472301ef3

keyword: compact writing of temporary kwdemo hgrc
author Christian Ebert <blacktrash@gmx.net>
date Fri, 11 Mar 2016 08:27:11 +0000
parents e6310cdcc4d0
children 3ea62e748a18
files hgext/keyword.py
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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'):