hgkw/keyword.py
branch0.9.2compat
changeset 664 c339bd5b183b
parent 658 efcbed613548
child 672 0d7642e39cfe
equal deleted inserted replaced
658:efcbed613548 664:c339bd5b183b
   249     '''
   249     '''
   250     templates = {
   250     templates = {
   251         'Revision': '{node|short}',
   251         'Revision': '{node|short}',
   252         'Author': '{author|user}',
   252         'Author': '{author|user}',
   253         'Date': '{date|utcdate}',
   253         'Date': '{date|utcdate}',
   254         'RCSFile': '{file|basename},v',
   254         'RCSfile': '{file|basename},v',
       
   255         'RCSFile': '{file|basename},v', # kept for backwards compatibility
       
   256                                         # with hg-keyword
   255         'Source': '{root}/{file},v',
   257         'Source': '{root}/{file},v',
   256         'Id': '{file|basename},v {node|short} {date|utcdate} {author|user}',
   258         'Id': '{file|basename},v {node|short} {date|utcdate} {author|user}',
   257         'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}',
   259         'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}',
   258     }
   260     }
   259 
   261 
   459     optionally by reading from an additional hgrc file.
   461     optionally by reading from an additional hgrc file.
   460 
   462 
   461     Override current keyword template maps with "default" option.
   463     Override current keyword template maps with "default" option.
   462     '''
   464     '''
   463     def demoitems(section, items):
   465     def demoitems(section, items):
       
   466         items.sort()
   464         ui.write('[%s]\n' % section)
   467         ui.write('[%s]\n' % section)
   465         for k, v in items:
   468         for k, v in items:
   466             ui.write('%s = %s\n' % (k, v))
   469             ui.write('%s = %s\n' % (k, v))
   467 
   470 
   468     msg = 'hg keyword config and expansion example'
   471     msg = 'hg keyword config and expansion example'
   499             extension = '%s = %s' % (k, v)
   502             extension = '%s = %s' % (k, v)
   500             break
   503             break
   501     ui.status(_('\n\tconfig using %s keyword template maps\n') % kwstatus)
   504     ui.status(_('\n\tconfig using %s keyword template maps\n') % kwstatus)
   502     ui.write('[extensions]\n%s\n' % extension)
   505     ui.write('[extensions]\n%s\n' % extension)
   503     demoitems('keyword', ui.configitems('keyword'))
   506     demoitems('keyword', ui.configitems('keyword'))
   504     demoitems('keywordmaps', kwmaps.iteritems())
   507     demoitems('keywordmaps', kwmaps.items())
   505     keywords = '$' + '$\n$'.join(kwmaps.keys()) + '$\n'
   508     kwkeys = kwmaps.keys()
       
   509     kwkeys.sort()
       
   510     keywords = '$' + '$\n$'.join(kwkeys) + '$\n'
   506     repo.wopener(fn, 'w').write(keywords)
   511     repo.wopener(fn, 'w').write(keywords)
   507     repo.add([fn])
   512     repo.add([fn])
   508     path = repo.wjoin(fn)
   513     path = repo.wjoin(fn)
   509     ui.note(_('\n%s keywords written to %s:\n') % (kwstatus, path))
   514     ui.note(_('\n%s keywords written to %s:\n') % (kwstatus, path))
   510     ui.note(keywords)
   515     ui.note(keywords)