mercurial/templater.py
changeset 3190 e18c3d08528d
parent 2874 3d6efcbbd1c9
child 3194 1749987b29e3
equal deleted inserted replaced
3189:f3b939444c72 3190:e18c3d08528d
   328     '''format changeset information.'''
   328     '''format changeset information.'''
   329 
   329 
   330     def __init__(self, ui, repo, mapfile, dest=None):
   330     def __init__(self, ui, repo, mapfile, dest=None):
   331         self.t = templater(mapfile, common_filters,
   331         self.t = templater(mapfile, common_filters,
   332                            cache={'parent': '{rev}:{node|short} ',
   332                            cache={'parent': '{rev}:{node|short} ',
   333                                   'manifest': '{rev}:{node|short}'})
   333                                   'manifest': '{rev}:{node|short}',
       
   334                                   'filecopy': '{name} ({source})'})
   334         self.ui = ui
   335         self.ui = ui
   335         self.dest = dest
   336         self.dest = dest
   336         self.repo = repo
   337         self.repo = repo
   337 
   338 
   338     def use_template(self, t):
   339     def use_template(self, t):
   353 
   354 
   354     def write_header(self, thing):
   355     def write_header(self, thing):
   355         self.write(thing, header=True)
   356         self.write(thing, header=True)
   356 
   357 
   357     def show(self, rev=0, changenode=None, brinfo=None, changes=None,
   358     def show(self, rev=0, changenode=None, brinfo=None, changes=None,
   358              **props):
   359              copies=None, **props):
   359         '''show a single changeset or file revision'''
   360         '''show a single changeset or file revision'''
   360         log = self.repo.changelog
   361         log = self.repo.changelog
   361         if changenode is None:
   362         if changenode is None:
   362             changenode = log.node(rev)
   363             changenode = log.node(rev)
   363         elif not rev:
   364         elif not rev:
   470             def showfiles(**args):
   471             def showfiles(**args):
   471                 for x in showlist('file', changes[3], **args): yield x
   472                 for x in showlist('file', changes[3], **args): yield x
   472             showadds = ''
   473             showadds = ''
   473             showdels = ''
   474             showdels = ''
   474 
   475 
       
   476         copies = [{'name': x[0], 'source': x[1]}
       
   477                   for x in copies]
       
   478         def showcopies(**args):
       
   479             for x in showlist('file_copy', copies, plural='file_copies',
       
   480                               **args):
       
   481                 yield x
       
   482 
   475         defprops = {
   483         defprops = {
   476             'author': changes[1],
   484             'author': changes[1],
   477             'branches': showbranches,
   485             'branches': showbranches,
   478             'date': changes[2],
   486             'date': changes[2],
   479             'desc': changes[4],
   487             'desc': changes[4],
   480             'file_adds': showadds,
   488             'file_adds': showadds,
   481             'file_dels': showdels,
   489             'file_dels': showdels,
   482             'files': showfiles,
   490             'files': showfiles,
       
   491             'file_copies': showcopies,
   483             'manifest': showmanifest,
   492             'manifest': showmanifest,
   484             'node': hex(changenode),
   493             'node': hex(changenode),
   485             'parents': showparents,
   494             'parents': showparents,
   486             'rev': rev,
   495             'rev': rev,
   487             'tags': showtags,
   496             'tags': showtags,