changeset 2958:c0a6a2e6bb2e beta

Use lightweight revisions in journal by default
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 23 Oct 2012 18:21:56 +0200
parents 15dc5b2ff672
children db40558e8914
files rhodecode/controllers/admin/settings.py rhodecode/lib/base.py rhodecode/lib/helpers.py rhodecode/lib/hooks.py rhodecode/templates/admin/settings/settings.html rhodecode/templates/pullrequests/pullrequest_show.html
diffstat 6 files changed, 29 insertions(+), 33 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/admin/settings.py	Tue Oct 23 18:10:07 2012 +0200
+++ b/rhodecode/controllers/admin/settings.py	Tue Oct 23 18:21:56 2012 +0200
@@ -202,11 +202,6 @@
                     form_result['rhodecode_lightweight_dashboard']
                 Session().add(sett4)
 
-                sett5 = RhodeCodeSetting.get_by_name_or_create('lightweight_journal')
-                sett5.app_settings_value = \
-                    form_result['rhodecode_lightweight_journal']
-                Session().add(sett5)
-
                 Session().commit()
                 set_rhodecode_config(config)
                 h.flash(_('Updated visualisation settings'),
--- a/rhodecode/lib/base.py	Tue Oct 23 18:10:07 2012 +0200
+++ b/rhodecode/lib/base.py	Tue Oct 23 18:21:56 2012 +0200
@@ -248,7 +248,6 @@
         c.visual.show_private_icon = str2bool(rc_config.get('rhodecode_show_private_icon'))
         c.visual.stylify_metatags = str2bool(rc_config.get('rhodecode_stylify_metatags'))
         c.visual.lightweight_dashboard = str2bool(rc_config.get('rhodecode_lightweight_dashboard'))
-        c.visual.lightweight_journal = str2bool(rc_config.get('rhodecode_lightweight_dashboard'))
 
         c.repo_name = get_repo_slug(request)
         c.backends = BACKENDS.keys()
--- a/rhodecode/lib/helpers.py	Tue Oct 23 18:10:07 2012 +0200
+++ b/rhodecode/lib/helpers.py	Tue Oct 23 18:21:56 2012 +0200
@@ -64,7 +64,7 @@
 
 def html_escape(text):
     """Produce entities within text."""
-    return "".join(html_escape_table.get(c,c) for c in text)
+    return "".join(html_escape_table.get(c, c) for c in text)
 
 
 def shorter(text, size=20):
@@ -491,7 +491,7 @@
     return value
 
 
-def action_parser(user_log, feed=False, parse_cs=True):
+def action_parser(user_log, feed=False, parse_cs=False):
     """
     This helper will action_map the specified string action into translated
     fancy names with icons and links
@@ -500,9 +500,7 @@
     :param feed: use output for feeds (no html and fancy icons)
     :param parse_cs: parse Changesets into VCS instances
     """
-    from pylons import tmpl_context as c
-    if c.visual.lightweight_journal:
-        parse_cs = False
+
     action = user_log.action
     action_params = ' '
 
@@ -522,42 +520,42 @@
         repo_name = user_log.repository.repo_name
 
         def lnk(rev, repo_name):
-
             if isinstance(rev, BaseChangeset) or isinstance(rev, AttributeDict):
-                if rev.revision:
-                    lbl = 'r%s:%s' % (rev.revision, rev.short_id)
-                else:
-                    lbl = '%s' % (rev.short_id)
+                lbl = '%s' % (rev.short_id[:8])
                 _url = url('changeset_home', repo_name=repo_name,
                            revision=rev.raw_id)
-                title = tooltip(rev.message) if parse_cs else ''
+                title = tooltip(rev.message)
             else:
+                ## changeset cannot be found/striped/removed etc.
                 lbl = ('%s' % rev)[:12]
                 _url = '#'
                 title = _('Changeset not found')
-
-            return link_to(lbl, _url, title=title, 
-                           class_='tooltip' if parse_cs else '',)
+            if parse_cs:
+                return link_to(lbl, _url, title=title, class_='tooltip')
+            return link_to(lbl, _url, raw_id=rev.raw_id, class_='journal-cs')
 
         revs = []
         if len(filter(lambda v: v != '', revs_ids)) > 0:
-            if parse_cs:
-                repo = user_log.repository.scm_instance
+            repo = None
             for rev in revs_ids[:revs_top_limit]:
+                # we want parsed changesets, or new log store format is bad
                 if parse_cs:
                     try:
-                        rev = repo.get_changeset(rev)
-                        revs.append(rev)
+                        if repo is None:
+                            repo = user_log.repository.scm_instance
+                        _rev = repo.get_changeset(rev)
+                        revs.append(_rev)
                     except ChangesetDoesNotExistError:
                         log.error('cannot find revision %s in this repo' % rev)
                         revs.append(rev)
                         continue
                 else:
-                    rev = AttributeDict({
+                    _rev = AttributeDict({
                         'short_id': rev[:12],
                         'raw_id': rev,
+                        'message': '',
                     })
-                    revs.append(rev)
+                    revs.append(_rev)
         cs_links = []
         cs_links.append(" " + ', '.join(
             [lnk(rev, repo_name) for rev in revs[:revs_limit]]
--- a/rhodecode/lib/hooks.py	Tue Oct 23 18:10:07 2012 +0200
+++ b/rhodecode/lib/hooks.py	Tue Oct 23 18:21:56 2012 +0200
@@ -36,7 +36,7 @@
 from rhodecode.lib.vcs.backends.base import EmptyChangeset
 from rhodecode.lib.compat import json
 from rhodecode.lib.exceptions import HTTPLockedRC
-from rhodecode.lib.utils2 import safe_str
+from rhodecode.lib.utils2 import safe_str, datetime_to_time
 from rhodecode.model.db import Repository, User
 
 
--- a/rhodecode/templates/admin/settings/settings.html	Tue Oct 23 18:10:07 2012 +0200
+++ b/rhodecode/templates/admin/settings/settings.html	Tue Oct 23 18:21:56 2012 +0200
@@ -131,10 +131,6 @@
                         ${h.checkbox('rhodecode_lightweight_dashboard','True')}
                         <label for="rhodecode_lightweight_dashboard">${_('Use lightweight dashboard')}</label>
                     </div>
-                    <div class="checkbox">
-                        ${h.checkbox('rhodecode_lightweight_journal','True')}
-                        <label for="rhodecode_lightweight_journal">${_('Use lightweight journal')}</label>
-                    </div>                    
                  </div>
              </div>
 
--- a/rhodecode/templates/pullrequests/pullrequest_show.html	Tue Oct 23 18:10:07 2012 +0200
+++ b/rhodecode/templates/pullrequests/pullrequest_show.html	Tue Oct 23 18:21:56 2012 +0200
@@ -70,14 +70,20 @@
               <%include file="/compare/compare_cs.html" />
 
               ## FILES
-              <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Files affected')}</div>
-              <div class="cs_files">
+              <div id="affected_files">
+              % if c.files:
+                <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Files affected')}</div>
+                <div class="cs_files">              
                 %for fid, change, f, stat in c.files:
                     <div class="cs_${change}">
                       <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid))}</div>
                       <div class="changes">${h.fancy_file_stats(stat)}</div>
                     </div>
                 %endfor
+               </div>
+              %else:
+                <div class="ui-btn" style="text-align: center;margin-top:5px">${_('Click to load diff details')}</div>
+              %endif
               </div>
           </div>
       </div>
@@ -131,10 +137,12 @@
     </script>
 
     ## diff block
+    <div id="diff_block_container" style="clear:both;">
     <%namespace name="diff_block" file="/changeset/diff_block.html"/>
     %for fid, change, f, stat in c.files:
       ${diff_block.diff_block_simple([c.changes[fid]])}
     %endfor
+    </div>
 
     ## template for inline comment form
     <%namespace name="comment" file="/changeset/changeset_file_comment.html"/>