Rev 448: Merge css updates for annotate from Jasper St. Pierre. in http://bazaar.launchpad.net/~loggerhead-team/loggerhead/trunk-rich

John Arbash Meinel john at arbash-meinel.com
Wed Jun 15 14:47:21 UTC 2011


At http://bazaar.launchpad.net/~loggerhead-team/loggerhead/trunk-rich

------------------------------------------------------------
revno: 448 [merge]
revision-id: john at arbash-meinel.com-20110615144711-wv0wgim27u1ismhi
parent: john at arbash-meinel.com-20110414141004-pzcx63izsdt3sqmc
parent: jstpierre at mecheye.net-20110422181802-7y2yambz9iscfa17
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk-rich
timestamp: Wed 2011-06-15 16:47:11 +0200
message:
  Merge css updates for annotate from Jasper St. Pierre.
modified:
  loggerhead/controllers/annotate_ui.py annotate_ui.py-20101130101535-elf3r4k8smkr5h0g-1
  loggerhead/controllers/view_ui.py annotate_ui.py-20061213025409-n0tuh5u7v7kwnmd5-1
  loggerhead/static/css/global.css global.css-20080612210817-369c9b4pvkk8mme5-1
  loggerhead/static/css/view.css annotate.css-20080623191119-ipj1kg0ct3v17u4k-1
  loggerhead/templates/inventory.pt inventory.pt-20070820180133-tx2jlsutm12tql2b-1
  loggerhead/templates/view.pt   annotate.pt-20070704145132-9gbz2i4q7bg78zsz-1
-------------- next part --------------
=== modified file 'loggerhead/controllers/annotate_ui.py'
--- a/loggerhead/controllers/annotate_ui.py	2010-12-01 08:30:02 +0000
+++ b/loggerhead/controllers/annotate_ui.py	2011-04-22 17:22:26 +0000
@@ -16,6 +16,8 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 
+import itertools
+
 from loggerhead.controllers.view_ui import ViewUI
 from loggerhead import util
 
@@ -29,23 +31,37 @@
         
         change_cache = {}
         last_line_revid = None
-        parity = 1
-        for line_revid, text in tree.annotate_iter(file_id):
-            if line_revid == last_line_revid:
-                # remember which lines have a new revno and which don't
-                new_rev = False
-            else:
-                new_rev = True
-                parity ^= 1
+        last_lineno = None
+        message = ""
+
+        revisions = {}
+
+        lineno = 0
+        for (line_revid, text), lineno in zip(tree.annotate_iter(file_id), itertools.count(1)):
+            if line_revid != last_line_revid:
                 last_line_revid = line_revid
-                if line_revid in change_cache:
-                    change = change_cache[line_revid]
-                else:
+
+                change = change_cache.get(line_revid, None)
+                if change is None:
                     change = self._history.get_changes([line_revid])[0]
                     change_cache[line_revid] = change
 
-            yield util.Container(
-                parity=parity, new_rev=new_rev, change=change)
+                message = change.comment.splitlines()[0]
+
+                if last_lineno:
+                    # The revspan is of lines between the last revision and this one.
+                    # We set the one for the previous revision when we're creating the current revision.
+                    revisions[last_lineno].revspan = lineno - last_lineno
+
+                revisions[lineno] = util.Container(change=change, message=message)
+
+                last_lineno = lineno
+                last_line_revid = line_revid
+
+        # We never set a revspan for the last revision during the loop above, so set it here.
+        revisions[last_lineno].revspan = lineno - last_lineno + 1
+
+        return revisions
             
     def get_values(self, path, kwargs, headers):
         values = super(AnnotateUI, self).get_values(path, kwargs, headers)

=== modified file 'loggerhead/controllers/view_ui.py'
--- a/loggerhead/controllers/view_ui.py	2011-03-23 02:37:07 +0000
+++ b/loggerhead/controllers/view_ui.py	2011-04-22 17:22:26 +0000
@@ -123,10 +123,10 @@
             raise HTTPMovedPermanently(self._branch.context_url(['/files', revno_url, path]))
 
         return {
-            # In AnnotateUI, "annotated" is a generator giving revision
-            # numbers per lines, but the template checks if "annotated" is
-            # true or not before using it, so we have to define it here also.
-            'annotated': False,
+            # In AnnotateUI, "annotated" is a dictionary mapping lines to changes.
+            # We exploit the fact that bool({}) is False when checking whether
+            # we're in "annotated" mode.
+            'annotated': {},
             'revno_url': revno_url,
             'file_id': file_id,
             'file_path': path,

=== modified file 'loggerhead/static/css/global.css'
--- a/loggerhead/static/css/global.css	2011-02-24 00:44:09 +0000
+++ b/loggerhead/static/css/global.css	2011-04-22 17:22:49 +0000
@@ -152,6 +152,7 @@
     float: left;
     display: inline;
     height: 22px;
+    line-height: 22px;
     padding: 0 0 0 18px;
     background: transparent url(../images/ico_description.gif) no-repeat center left;
     }
@@ -163,7 +164,6 @@
     }
 
 #branch-info {
-    width: 900px;
     padding: 10px;
     margin: 0 0 10px 0;
     color: #666;

=== modified file 'loggerhead/static/css/view.css'
--- a/loggerhead/static/css/view.css	2011-02-18 05:41:17 +0000
+++ b/loggerhead/static/css/view.css	2011-04-22 17:22:26 +0000
@@ -1,31 +1,30 @@
 /*table*/
-.viewLineTit,
-.viewRevTit,
-.viewContTit {
+#logentries,
+.viewRev,
+.viewLine {
     border: 1px solid #d2d2d2;
-    }
-.viewLine,
-.viewRev,
+}
+.viewRev {
+    border-right: none;
+    white-space: nowrap;
+    width: 1px;
+    padding: .3em .6em;
+}
 .viewComm,
 .viewCont {
     border: none;
     }
-.viewLine,
-.viewLineTit {
+.viewLine {
+    border-style: none solid none none;
+    width: 20px;
+    padding-left: .6em;
     padding-right: .2em;
     }
-.viewLine {
-    width: 37px;
-    }
-.viewContTit,
+.viewLine.first {
+    border-style: solid solid none none;
+}
 .viewCont {
-    width: auto;
-    padding-left: .3em;
-    }
-.viewRevTit,
-.viewRev {
-    width: 70px;
-    text-align: center;
+    padding-left: .4em;
     }
 .viewLine,
 .viewCont {
@@ -38,6 +37,11 @@
     margin: 0;
     }
 .viewLine {
-    text-align: right;
+    text-align: center;
+    }
+.viewLine {
     font-size: 93%;
     }
+.viewAuthors {
+    color: #999999;
+}

=== modified file 'loggerhead/templates/inventory.pt'
--- a/loggerhead/templates/inventory.pt	2011-02-23 03:01:15 +0000
+++ b/loggerhead/templates/inventory.pt	2011-04-22 18:18:02 +0000
@@ -19,22 +19,18 @@
           </tal:has-link>
       </tal:block>
       <tal:block metal:fill-slot="branchname" tal:content="string:${branch/friendly_name}" />
-      <tal:block metal:fill-slot="heading">
-      <div id="breadcrumbs">
+          <tal:block metal:fill-slot="heading">
+          <div id="breadcrumbs">
           <tal:has-link condition="branch/branch_link">
             <a tal:attributes="href branch/branch_link"
                tal:content="branch/friendly_name">
               nice/branch/name
             </a>
           </tal:has-link>
-          <span tal:condition="not: branch/branch_link">
-            <span metal:use-macro="breadcrumbs/directory" />
-          </span>
-          <tal:block condition="python:change">
-            » Viewing
-            <span metal:use-macro="breadcrumbs/branch" />
-            for revision <span tal:content="change/revno"/>
-          </tal:block>
+          <tal:no-link condition="not: branch/branch_link">
+            <span metal:use-macro="breadcrumbs/directory"></span>
+          </tal:no-link>
+          <span>: <span metal:use-macro="breadcrumbs/branch" /> (revision <tal:revno content="change/revno"></tal:revno>)</span>
         </div>
       </tal:block>
 

=== modified file 'loggerhead/templates/view.pt'
--- a/loggerhead/templates/view.pt	2011-02-23 03:01:15 +0000
+++ b/loggerhead/templates/view.pt	2011-04-22 17:22:26 +0000
@@ -49,11 +49,11 @@
             </li>
             <li tal:condition="not:annotated">
               <a tal:attributes="href python:url(['/annotate', revno_url, file_path], clear=1)"
-              >view revision numbers per line</a>
+              >view with revision information</a>
             </li>
             <li tal:condition="annotated">
               <a tal:attributes="href python:url(['/view', revno_url, file_path], clear=1)"
-              >view without revision numbers</a>
+              >view without revision information</a>
             </li>
             <li>
                 <a tal:attributes="href python:url(['/revision', change.revno], clear=1)">view revision</a>
@@ -71,25 +71,24 @@
 
       <div class="view">
         <table id="logentries">
-          <tr class="logheader">
-            <th class="viewLineTit">Line</th>
-            <th class="viewRevTit" tal:condition="annotated">Revision</th>
-            <th class="viewContTit">Contents</th>
-          </tr>
-
           <tal:rep tal:repeat="line contents">
-            <tr tal:define="anno python:annotated and annotated.next()"
-                tal:attributes="class python:anno and 'blueRow' + str(anno.parity) or None">
-              <td class="viewLine">
+            <tr>
+              <td tal:condition="python:path('repeat/line/number') in annotated"
+                  tal:define="anno python:annotated.get(path('repeat/line/number'), None)"
+                  tal:attributes="rowspan python:anno.revspan"
+                  class="viewRev">
+                <a tal:content="python:'%s' % (anno.change.revno,)"
+                   tal:attributes="href python:url(['/revision', anno.change.revno], clear=1);
+                                   title python:'%s by %s, on %s (%s)' % (anno.change.revno, ', '.join(util.hide_emails(anno.change.authors)), anno.change.date.strftime('%d %b %Y %H:%M'), util.date_time(anno.change.date))"></a>
+                <span class="viewAuthors" tal:content="python:'by ' + ', '.join(util.hide_emails(anno.change.authors))" />
+                <br />
+
+                <span tal:content="python:anno.message"></span>
+              </td>
+              <td tal:attributes="class python:path('repeat/line/number') in annotated and 'viewLine first' or 'viewLine'">
                 <a tal:attributes="id string:L${repeat/line/number}; href string:#L${repeat/line/number}"
                    tal:content="repeat/line/number">1</a>
               </td>
-              <td class="viewRev" tal:condition="annotated">
-                <a tal:condition="python:anno.new_rev"
-                   tal:content="python:util.trunc(anno.change.revno)"
-                   tal:attributes="href python:url(['/revision', anno.change.revno], clear=1);
-                                   title python:'%s by %s, on %s (%s)' % (anno.change.revno, ', '.join(util.hide_emails(anno.change.authors)), anno.change.date.strftime('%d %b %Y %H:%M'), util.date_time(anno.change.date))"></a>
-              </td>
               <td class="viewCont"><pre tal:content="structure line"></pre></td>
             </tr>
           </tal:rep>



More information about the bazaar-commits mailing list