hgkw/keyword.py
branchstable
changeset 660 583a0371249c
parent 656 89e0584cdc5c
child 662 25e813ce68e2
equal deleted inserted replaced
657:fcd29bd314be 660:583a0371249c
   286 
   286 
   287     See "hg help templates" for information on templates and filters.
   287     See "hg help templates" for information on templates and filters.
   288     '''
   288     '''
   289     def demoitems(section, items):
   289     def demoitems(section, items):
   290         ui.write('[%s]\n' % section)
   290         ui.write('[%s]\n' % section)
   291         for k, v in items:
   291         for k, v in sorted(items):
   292             ui.write('%s = %s\n' % (k, v))
   292             ui.write('%s = %s\n' % (k, v))
   293 
   293 
   294     msg = 'hg keyword config and expansion example'
   294     msg = 'hg keyword config and expansion example'
   295     fn = 'demo.txt'
   295     fn = 'demo.txt'
   296     branchname = 'demobranch'
   296     branchname = 'demobranch'
   334             extension = '%s = %s' % (k, v)
   334             extension = '%s = %s' % (k, v)
   335             break
   335             break
   336     ui.write('[extensions]\n%s\n' % extension)
   336     ui.write('[extensions]\n%s\n' % extension)
   337     demoitems('keyword', ui.configitems('keyword'))
   337     demoitems('keyword', ui.configitems('keyword'))
   338     demoitems('keywordmaps', kwmaps.iteritems())
   338     demoitems('keywordmaps', kwmaps.iteritems())
   339     keywords = '$' + '$\n$'.join(kwmaps.keys()) + '$\n'
   339     keywords = '$' + '$\n$'.join(sorted(kwmaps.keys())) + '$\n'
   340     repo.wopener(fn, 'w').write(keywords)
   340     repo.wopener(fn, 'w').write(keywords)
   341     repo.add([fn])
   341     repo.add([fn])
   342     path = repo.wjoin(fn)
   342     path = repo.wjoin(fn)
   343     ui.note(_('\nkeywords written to %s:\n') % path)
   343     ui.note(_('\nkeywords written to %s:\n') % path)
   344     ui.note(keywords)
   344     ui.note(keywords)