changeset 13298:f715e6bd8091

keyword: inform user about current keywordset in kwdemo The kwdemo --default output now looks roughly like this: configuration using default cvs keywordset [extensions] keyword = [keyword] demo.txt = [keywordset] * section added with this change svn = False [keywordmaps] ...
author Christian Ebert <blacktrash@gmx.net>
date Sun, 23 Jan 2011 03:15:39 +0100
parents 613b8bd2284e
children f24ea9356e7d
files hgext/keyword.py tests/test-keyword.t
diffstat 2 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/keyword.py	Wed Jan 26 12:05:01 2011 +0100
+++ b/hgext/keyword.py	Sun Jan 23 03:15:39 2011 +0100
@@ -355,6 +355,9 @@
     ui.note(_('creating temporary repository at %s\n') % tmpdir)
     repo = localrepo.localrepository(ui, tmpdir, True)
     ui.setconfig('keyword', fn, '')
+    svn = ui.configbool('keywordset', 'svn')
+    # explicitly set keywordset for demo output
+    ui.setconfig('keywordset', 'svn', svn)
 
     uikwmaps = ui.configitems('keywordmaps')
     if args or opts.get('rcfile'):
@@ -362,7 +365,10 @@
         if uikwmaps:
             ui.status(_('\textending current template maps\n'))
         if opts.get('default') or not uikwmaps:
-            ui.status(_('\toverriding default template maps\n'))
+            if svn:
+                ui.status(_('\toverriding default svn keywordset\n'))
+            else:
+                ui.status(_('\toverriding default cvs keywordset\n'))
         if opts.get('rcfile'):
             ui.readconfig(opts.get('rcfile'))
         if args:
@@ -374,7 +380,10 @@
             ui.readconfig(repo.join('hgrc'))
         kwmaps = dict(ui.configitems('keywordmaps'))
     elif opts.get('default'):
-        ui.status(_('\n\tconfiguration using default keyword template maps\n'))
+        if svn:
+            ui.status(_('\n\tconfiguration using default svn keywordset\n'))
+        else:
+            ui.status(_('\n\tconfiguration using default cvs keywordset\n'))
         kwmaps = _defaultkwmaps(ui)
         if uikwmaps:
             ui.status(_('\tdisabling current template maps\n'))
@@ -388,6 +397,7 @@
     reposetup(ui, repo)
     ui.write('[extensions]\nkeyword =\n')
     demoitems('keyword', ui.configitems('keyword'))
+    demoitems('keywordset', ui.configitems('keywordset'))
     demoitems('keywordmaps', kwmaps.iteritems())
     keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n'
     repo.wopener(fn, 'w').write(keywords)
--- a/tests/test-keyword.t	Wed Jan 26 12:05:01 2011 +0100
+++ b/tests/test-keyword.t	Sun Jan 23 03:15:39 2011 +0100
@@ -17,6 +17,8 @@
   keyword =
   [keyword]
   demo.txt = 
+  [keywordset]
+  svn = False
   [keywordmaps]
   Author = {author|user}
   Date = {date|utcdate}
@@ -40,6 +42,8 @@
   keyword =
   [keyword]
   demo.txt = 
+  [keywordset]
+  svn = False
   [keywordmaps]
   Branch = {branches}
   $Branch: demobranch $
@@ -633,6 +637,8 @@
   b = ignore
   demo.txt = 
   i = ignore
+  [keywordset]
+  svn = False
   [keywordmaps]
   Xinfo = {author}: {desc}
   $Xinfo: test: hg keyword configuration and expansion example $