Changeset - 42d1f33f2b87
[Not reviewed]
default
0 2 0
Mads Kiilerich - 6 years ago 2019-12-10 12:57:02
mads@kiilerich.com
Grafted from: bee7a9387ad8
changeset: store hexified source hash in context so it is readily available in template

Avoid hex as "encoding" - it is not supported in py3.

Mercurial store source and transplant_source differently ... but that will now
be handled in the controller instead of in the template.
2 files changed with 7 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/changeset.py
Show inline comments
 
@@ -25,6 +25,7 @@ Original author and date, and relevant c
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
import binascii
 
import logging
 
import traceback
 
from collections import OrderedDict, defaultdict
 
@@ -395,6 +396,8 @@ class ChangesetController(BaseRepoContro
 
            c.changeset = c.cs_ranges[0]
 
            c.parent_tmpl = ''.join(['# Parent  %s\n' % x.raw_id
 
                                     for x in c.changeset.parents])
 
            c.changeset_graft_source_hash = c.changeset.extra.get(b'source', b'')
 
            c.changeset_transplant_source_hash = binascii.hexlify(c.changeset.extra.get(b'transplant_source', b''))
 
        if method == 'download':
 
            response.content_type = 'text/plain'
 
            response.content_disposition = 'attachment; filename=%s.diff' \
kallithea/templates/changeset/changeset.html
Show inline comments
 
@@ -90,16 +90,14 @@ ${self.repo_context_bar('changelog', c.c
 
                         <span><b>${h.person(c.changeset.author,'full_name_and_username')}</b> - ${h.age(c.changeset.date,True)} ${h.fmt_date(c.changeset.date)}</span><br/>
 
                         <span>${h.email_or_none(c.changeset.author)}</span><br/>
 
                     </div>
 
                     <% rev = c.changeset.extra.get('source') %>
 
                     %if rev:
 
                     %if c.changeset_graft_source_hash:
 
                     <div>
 
                       ${_('Grafted from:')} ${h.link_to(h.short_id(rev),h.url('changeset_home',repo_name=c.repo_name,revision=rev), class_="changeset_hash")}
 
                       ${_('Grafted from:')} ${h.link_to(h.short_id(c.changeset_graft_source_hash),h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset_graft_source_hash), class_="changeset_hash")}
 
                     </div>
 
                     %endif
 
                     <% rev = c.changeset.extra.get('transplant_source', '').encode('hex') %>
 
                     %if rev:
 
                     %if c.changeset_transplant_source_hash:
 
                     <div>
 
                       ${_('Transplanted from:')} ${h.link_to(h.short_id(rev),h.url('changeset_home',repo_name=c.repo_name,revision=rev), class_="changeset_hash")}
 
                       ${_('Transplanted from:')} ${h.link_to(h.short_id(c.changeset_transplant_source_hash),h.url('changeset_home',repo_name=c.repo_name,revision=c.changeset_transplant_source_hash), class_="changeset_hash")}
 
                     </div>
 
                     %endif
 

	
0 comments (0 inline, 0 general)