Commits

Nozomu Kaneko committed 3813e10

add some patches for style improvements

Comments (0)

Files changed (4)

manifest-style.diff

+# HG changeset patch
+# Parent 75c1fd1d5c33f86425597601dbf599ce7ab3c91f
+diff --git a/mercurial/templatefilters.py b/mercurial/templatefilters.py
+--- a/mercurial/templatefilters.py
++++ b/mercurial/templatefilters.py
+@@ -285,6 +285,11 @@
+     """:shortdate: Date. Returns a date like "2006-09-18"."""
+     return util.shortdate(text)
+ 
++def size(text):
++    """:size: Any tet. Treats `texts` as an integer, and returns
++    a size with delimiters like "100,000,000"."""
++    return re.sub(r'(\d)(?=(\d{3})+(?!\d))', '\\1,', str(text))
++
+ def stringescape(text):
+     return text.encode('string_escape')
+ 
+@@ -363,6 +368,7 @@
+     "short": short,
+     "shortbisect": shortbisect,
+     "shortdate": shortdate,
++    "size": size,
+     "stringescape": stringescape,
+     "stringify": stringify,
+     "strip": strip,
+diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
+--- a/mercurial/templates/monoblue/map
++++ b/mercurial/templates/monoblue/map
+@@ -54,19 +54,19 @@
+ manifest = manifest.tmpl
+ direntry = '
+   <tr class="parity{parity}">
+-    <td>drwxr-xr-x</td>
+-    <td></td>
+-    <td></td>
+-    <td><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">{basename|escape}</a></td>
+-    <td></td>
++    <td class="dir-permissions">drwxr-xr-x</td>
++    <td class="dir-date"></td>
++    <td class="dir-size"></td>
++    <td class="dir-name"><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">{basename|escape}/</a></td>
++    <td class="dir-menu"></td>
+   </tr>'
+ fileentry = '
+   <tr class="parity{parity}">
+-    <td>{permissions|permissions}</td>
+-    <td>{date|isodate}</td>
+-    <td>{size}</td>
+-    <td><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{basename|escape}</a></td>
+-    <td>
++    <td class="file-permissions">{permissions|permissions}</td>
++    <td class="file-date">{date|isodate}</td>
++    <td class="file-size">{size|size}</td>
++    <td class="file-name"><a href="{url}file/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{basename|escape}</a></td>
++    <td class="file-menu">
+       <a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> |
+       <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a>
+     </td>
+diff --git a/mercurial/templates/static/style-monoblue.css b/mercurial/templates/static/style-monoblue.css
+--- a/mercurial/templates/static/style-monoblue.css
++++ b/mercurial/templates/static/style-monoblue.css
+@@ -459,6 +459,11 @@
+ p.files .logtags {
+   float: right;
+ }
++
++td.file-size {
++  text-align: right;
++}
++
+ /** end of file **/
+ 
+ /** changeset **/

page-path-style.diff

+# HG changeset patch
+# Parent c44e30c35d032e9f39ce027f94857ca2f25a5107
+
+diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
+--- a/mercurial/hgweb/webcommands.py
++++ b/mercurial/hgweb/webcommands.py
+@@ -229,10 +229,12 @@
+         revcount = max(revcount, 1)
+         tmpl.defaults['sessionvars']['revcount'] = revcount
+ 
++    lessrevcount = max(revcount / 2, 1)
+     lessvars = copy.copy(tmpl.defaults['sessionvars'])
+-    lessvars['revcount'] = max(revcount / 2, 1)
++    lessvars['revcount'] = lessrevcount
++    morerevcount = revcount * 2
+     morevars = copy.copy(tmpl.defaults['sessionvars'])
+-    morevars['revcount'] = revcount * 2
++    morevars['revcount'] = morerevcount
+ 
+     count = len(web.repo)
+     pos = ctx.rev()
+@@ -248,7 +250,8 @@
+                 entries=lambda **x: changelist(limit=0,**x),
+                 latestentry=lambda **x: changelist(limit=1,**x),
+                 archives=web.archivelist("tip"), revcount=revcount,
+-                morevars=morevars, lessvars=lessvars)
++                morevars=morevars, lessvars=lessvars,
++                morerevcount=morerevcount, lessrevcount=lessrevcount)
+ 
+ def shortlog(web, req, tmpl):
+     return changelog(web, req, tmpl, shortlog = True)
+@@ -649,10 +652,12 @@
+         revcount = max(revcount, 1)
+         tmpl.defaults['sessionvars']['revcount'] = revcount
+ 
++    lessrevcount = max(revcount / 2, 1)
+     lessvars = copy.copy(tmpl.defaults['sessionvars'])
+-    lessvars['revcount'] = max(revcount / 2, 1)
++    lessvars['revcount'] = lessrevcount
++    morerevcount = revcount * 2
+     morevars = copy.copy(tmpl.defaults['sessionvars'])
+-    morevars['revcount'] = revcount * 2
++    morevars['revcount'] = morerevcount
+ 
+     count = fctx.filerev() + 1
+     start = max(0, fctx.filerev() - revcount + 1) # first rev on this page
+@@ -694,7 +699,8 @@
+     return tmpl("filelog", file=f, node=fctx.hex(), nav=nav,
+                 entries=lambda **x: entries(limit=0, **x),
+                 latestentry=lambda **x: entries(limit=1, **x),
+-                revcount=revcount, morevars=morevars, lessvars=lessvars)
++                revcount=revcount, morevars=morevars, lessvars=lessvars,
++                morerevcount=morerevcount, lessrevcount=lessrevcount)
+ 
+ def archive(web, req, tmpl):
+     type_ = req.form.get('type', [None])[0]
+@@ -751,10 +757,12 @@
+         revcount = max(revcount, 1)
+         tmpl.defaults['sessionvars']['revcount'] = revcount
+ 
++    lessrevcount = max(revcount / 2, 1)
+     lessvars = copy.copy(tmpl.defaults['sessionvars'])
+-    lessvars['revcount'] = max(revcount / 2, 1)
++    lessvars['revcount'] = lessrevcount
++    morerevcount = revcount * 2
+     morevars = copy.copy(tmpl.defaults['sessionvars'])
+-    morevars['revcount'] = revcount * 2
++    morevars['revcount'] = morerevcount
+ 
+     max_rev = len(web.repo) - 1
+     revcount = min(max_rev, revcount)
+@@ -795,7 +803,8 @@
+     return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev,
+                 lessvars=lessvars, morevars=morevars, downrev=downrev,
+                 canvasheight=canvasheight, jsdata=data, bg_height=bg_height,
+-                node=revnode_hex, changenav=changenav)
++                node=revnode_hex, changenav=changenav,
++                morerevcount=morerevcount, lessrevcount=lessrevcount)
+ 
+ def avatar(web, req, tmpl):
+     if "node" not in req.form:
+diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
+--- a/mercurial/hgweb/webutil.py
++++ b/mercurial/hgweb/webutil.py
+@@ -44,23 +44,25 @@
+             break
+         last = f
+         if pos + f < limit:
+-            navafter.append(("+%d" % f, hex(nodefunc(pos + f).node())))
++            navafter.append(("+%d" % f, hex(nodefunc(pos + f).node()), "after"))
+         if pos - f >= 0:
+-            navbefore.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node())))
++            navbefore.insert(0, ("-%d" % f, hex(nodefunc(pos - f).node()), "before"))
+ 
+-    navafter.append(("tip", "tip"))
++    navafter.append(("tip", "tip", "tip"))
+     try:
+-        navbefore.insert(0, ("(0)", hex(nodefunc('0').node())))
++        navbefore.insert(0, ("(0)", hex(nodefunc('0').node()), "root"))
+     except error.RepoError:
+         pass
+ 
++    navcurrent = [("+0", hex(nodefunc(pos).node()), "current")]
++
+     def gen(l):
+         def f(**map):
+-            for label, node in l:
+-                yield {"label": label, "node": node}
++            for label, node, css_class in l:
++                yield {"label": label, "node": node, "class": css_class}
+         return f
+ 
+-    return (dict(before=gen(navbefore), after=gen(navafter)),)
++    return (dict(before=gen(navbefore), current=gen(navcurrent), after=gen(navafter)),)
+ 
+ def _siblings(siblings=[], hiderev=None):
+     siblings = [s for s in siblings if s.node() != nullid]
+diff --git a/mercurial/templates/monoblue/graph.tmpl b/mercurial/templates/monoblue/graph.tmpl
+--- a/mercurial/templates/monoblue/graph.tmpl
++++ b/mercurial/templates/monoblue/graph.tmpl
+@@ -228,9 +228,21 @@
+     </script>
+ 
+     <div class="page-path">
+-        <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
+-        <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
+-        | {changenav%navgraph}
++        <form action="{url}graph/{node|short}{sessionvars%urlparameter}">
++            <span class="page-path-pagenav">
++                {changenav%navgraph}
++            </span>
++            <span class="page-path-revcount">
++                <select name="revcount" onchange="javascript:this.form.submit()">
++                    <option value="{lessrevcount}">{lessrevcount}</option>
++                    <option value="{revcount}" selected="selected">{revcount}</option>
++                    <option value="{morerevcount}">{morerevcount}</option>
++                </select> /page
++                <noscript>
++                    <input type="submit" value="update">
++                </noscript>
++            </span>
++        </form>
+     </div>
+ 
+ {footer}
+diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
+--- a/mercurial/templates/monoblue/map
++++ b/mercurial/templates/monoblue/map
+@@ -13,10 +13,10 @@
+ 
+ helpentry = '<tr><td><a href="{url}help/{topic|escape}{sessionvars%urlparameter}">{topic|escape}</a></td><td>{summary|escape}</td></tr>'
+ 
+-naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
+-navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
+-navgraphentry = '<a href="{url}graph/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
+-filenaventry = '<a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{label|escape}</a>'
++naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}" class="{class|escape}">{label|escape}</a> '
++navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}" class="{class|escape}">{label|escape}</a> '
++navgraphentry = '<a href="{url}graph/{node|short}{sessionvars%urlparameter}" class="{class|escape}">{label|escape}</a> '
++filenaventry = '<a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}" class="{class|escape}">{label|escape}</a>'
+ filedifflink = '<a href="{url}diff/{node|short}/{file|urlescape}{sessionvars%urlparameter}">{file|escape}</a> '
+ filenodelink = '
+   <tr class="parity{parity}">
+@@ -42,10 +42,10 @@
+     </td>
+   </tr>'
+ 
+-nav = '{before%naventry} {after%naventry}'
+-navshort = '{before%navshortentry}{after%navshortentry}'
+-navgraph = '{before%navgraphentry}{after%navgraphentry}'
+-filenav = '{before%filenaventry}{after%filenaventry}'
++nav = '{before%naventry}{current%naventry}{after%naventry}'
++navshort = '{before%navshortentry}{current%navshortentry}{after%navshortentry}'
++navgraph = '{before%navgraphentry}{current%navgraphentry}{after%navgraphentry}'
++filenav = '{before%filenaventry}{current%filenaventry}{after%filenaventry}'
+ 
+ fileellipses = '...'
+ changelogentry = changelogentry.tmpl
+diff --git a/mercurial/templates/static/style-monoblue.css b/mercurial/templates/static/style-monoblue.css
+--- a/mercurial/templates/static/style-monoblue.css
++++ b/mercurial/templates/static/style-monoblue.css
+@@ -144,10 +144,52 @@
+ 
+ div.page-path {
+   text-align: right;
+-  padding: 20px 30px 10px 0;
++  padding: 20px 10px 10px 0;
+   border:solid #d9d8d1;
+   border-width:0px 0px 1px;
+-  font-size: 1.2em;
++  font-size: 1em;
++}
++
++div.page-path span.page-path-nav {
++  float: left;
++}
++
++div.page-path span.page-path-revcount {
++  float: right;
++}
++
++div.page-path a.root:after {
++  content: " << ";
++  color: #666;
++}
++
++div.page-path a.before:after {
++  content: " < ";
++  color: #666;
++}
++
++div.page-path a.current:before {
++  content: "[";
++  color: #666;
++}
++
++div.page-path a.current:after {
++  content: "]";
++  color: #666;
++}
++
++div.page-path a.after:before {
++  content: " > ";
++  color: #666;
++}
++
++div.page-path a.tip:before {
++  content: " >> ";
++  color: #666;
++}
++
++div.page-path select {
++  margin-left: 20px;
+ }
+ 
+ div.page-footer {
+# HG changeset patch
+# Parent 947cf71c4e0d7498efdbe226f663147347272fdc
+
+diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
+--- a/mercurial/hgweb/webcommands.py
++++ b/mercurial/hgweb/webcommands.py
+@@ -240,18 +240,27 @@
+     pos = ctx.rev()
+     start = max(0, pos - revcount + 1)
+     end = min(count, start + revcount)
+-    pos = end - 1
+     parity = paritygen(web.stripecount, offset=start - end)
+ 
+     changenav = webutil.revnavgen(pos, revcount, count, web.repo.changectx)
+ 
++    pagebackvars = []
++    pagenextvars = []
++    if pos + revcount < count:
++        pagebacknode = hex(web.repo.changectx(pos+revcount).node())
++        pagebackvars.append({"node": pagebacknode})
++    if pos - revcount > 0:
++        pagenextnode = hex(web.repo.changectx(pos-revcount).node())
++        pagenextvars.append({"node": pagenextnode})
++
+     return tmpl(shortlog and 'shortlog' or 'changelog', changenav=changenav,
+                 node=ctx.hex(), rev=pos, changesets=count,
+                 entries=lambda **x: changelist(limit=0,**x),
+                 latestentry=lambda **x: changelist(limit=1,**x),
+                 archives=web.archivelist("tip"), revcount=revcount,
+                 morevars=morevars, lessvars=lessvars,
+-                morerevcount=morerevcount, lessrevcount=lessrevcount)
++                morerevcount=morerevcount, lessrevcount=lessrevcount,
++                pagebackvars=pagebackvars, pagenextvars=pagenextvars)
+ 
+ def shortlog(web, req, tmpl):
+     return changelog(web, req, tmpl, shortlog = True)
+@@ -662,6 +671,7 @@
+     count = fctx.filerev() + 1
+     start = max(0, fctx.filerev() - revcount + 1) # first rev on this page
+     end = min(count, start + revcount) # last rev on this page
++    pos = fctx.filerev()
+     parity = paritygen(web.stripecount, offset=start - end)
+ 
+     def entries(limit=0, **map):
+@@ -695,12 +705,23 @@
+             yield e
+ 
+     nodefunc = lambda x: fctx.filectx(fileid=x)
+-    nav = webutil.revnavgen(end - 1, revcount, count, nodefunc)
++    nav = webutil.revnavgen(pos, revcount, count, nodefunc)
++
++    pagebackvars = []
++    pagenextvars = []
++    if pos + revcount < count:
++        pagebacknode = hex(nodefunc(pos+revcount).node())
++        pagebackvars.append({"node": pagebacknode})
++    if pos - revcount > 0:
++        pagenextnode = hex(nodefunc(pos-revcount).node())
++        pagenextvars.append({"node": pagenextnode})
++
+     return tmpl("filelog", file=f, node=fctx.hex(), nav=nav,
+                 entries=lambda **x: entries(limit=0, **x),
+                 latestentry=lambda **x: entries(limit=1, **x),
+                 revcount=revcount, morevars=morevars, lessvars=lessvars,
+-                morerevcount=morerevcount, lessrevcount=lessrevcount)
++                morerevcount=morerevcount, lessrevcount=lessrevcount,
++                pagebackvars=pagebackvars, pagenextvars=pagenextvars)
+ 
+ def archive(web, req, tmpl):
+     type_ = req.form.get('type', [None])[0]
+@@ -777,6 +798,15 @@
+     if rev < web.maxshortchanges:
+         startrev = uprev
+ 
++    pagebackvars = []
++    pagenextvars = []
++    if rev + revcount < count:
++        pagebacknode = hex(web.repo.changectx(rev+revcount).node())
++        pagebackvars.append({"node": pagebacknode})
++    if rev - revcount > 0:
++        pagenextnode = hex(web.repo.changectx(rev-revcount).node())
++        pagenextvars.append({"node": pagenextnode})
++
+     dag = graphmod.dagwalker(web.repo, range(startrev, downrev - 1, -1))
+     tree = list(graphmod.colored(dag))
+     canvasheight = (len(tree) + 1) * bg_height - 27
+@@ -804,7 +834,8 @@
+                 lessvars=lessvars, morevars=morevars, downrev=downrev,
+                 canvasheight=canvasheight, jsdata=data, bg_height=bg_height,
+                 node=revnode_hex, changenav=changenav,
+-                morerevcount=morerevcount, lessrevcount=lessrevcount)
++                morerevcount=morerevcount, lessrevcount=lessrevcount,
++                pagebackvars=pagebackvars, pagenextvars=pagenextvars)
+ 
+ def avatar(web, req, tmpl):
+     if "node" not in req.form:
+diff --git a/mercurial/templates/monoblue/changelog.tmpl b/mercurial/templates/monoblue/changelog.tmpl
+--- a/mercurial/templates/monoblue/changelog.tmpl
++++ b/mercurial/templates/monoblue/changelog.tmpl
+@@ -35,9 +35,12 @@
+     </form>
+ 
+     <h2 class="no-link no-border">changelog</h2>
++
++    {pagebackvars%changelogpageback}
+     <div>
+     {entries%changelogentry}
+     </div>
++    {pagenextvars%changelogpagenext}
+ 
+     <div class="page-path">
+ {changenav%nav}
+diff --git a/mercurial/templates/monoblue/filelog.tmpl b/mercurial/templates/monoblue/filelog.tmpl
+--- a/mercurial/templates/monoblue/filelog.tmpl
++++ b/mercurial/templates/monoblue/filelog.tmpl
+@@ -41,9 +41,11 @@
+ 
+     <h2 class="no-link no-border">{file|urlescape}</h2>
+ 
++    {pagebackvars%filelogpageback}
+     <table>
+     {entries%filelogentry}
+     </table>
++    {pagenextvars%filelogpagenext}
+ 
+     <div class="page-path">
+     {nav%filenav}
+diff --git a/mercurial/templates/monoblue/graph.tmpl b/mercurial/templates/monoblue/graph.tmpl
+--- a/mercurial/templates/monoblue/graph.tmpl
++++ b/mercurial/templates/monoblue/graph.tmpl
+@@ -38,11 +38,13 @@
+     <h2 class="no-link no-border">graph</h2>
+ 
+     <div id="noscript">The revision graph only works with JavaScript-enabled browsers.</div>
++    {pagebackvars%graphpageback}
+     <div id="wrapper">
+         <ul id="nodebgs"></ul>
+         <canvas id="graph" width="480" height="{canvasheight}"></canvas>
+         <ul id="graphnodes"></ul>
+     </div>
++    {pagenextvars%graphpagenext}
+ 
+     <script>
+     <!-- hide script content
+diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
+--- a/mercurial/templates/monoblue/map
++++ b/mercurial/templates/monoblue/map
+@@ -227,3 +227,15 @@
+ urlparameter = '{separator}{name}={value|urlescape}'
+ hiddenformentry = '<input type="hidden" name="{name}" value="{value|escape}" />'
+ graph = graph.tmpl
++
++graphpageback = '<div id="page-back"><a href="{url}graph/{node|short}{sessionvars%urlparameter}">Newer</a></div>'
++graphpagenext = '<div id="page-next"><a href="{url}graph/{node|short}{sessionvars%urlparameter}">Older</a></div>'
++
++shortlogpageback = '<div id="page-back"><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">Newer</a></div>'
++shortlogpagenext = '<div id="page-next"><a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">Older</a></div>'
++
++changelogpageback = '<div id="page-back"><a href="{url}log/{node|short}{sessionvars%urlparameter}">Newer</a></div>'
++changelogpagenext = '<div id="page-next"><a href="{url}log/{node|short}{sessionvars%urlparameter}">Older</a></div>'
++
++filelogpageback = '<div id="page-back"><a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">Newer</a></div>'
++filelogpagenext = '<div id="page-next"><a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">Older</a></div>'
+diff --git a/mercurial/templates/monoblue/shortlog.tmpl b/mercurial/templates/monoblue/shortlog.tmpl
+--- a/mercurial/templates/monoblue/shortlog.tmpl
++++ b/mercurial/templates/monoblue/shortlog.tmpl
+@@ -36,9 +36,11 @@
+ 
+     <h2 class="no-link no-border">shortlog</h2>
+ 
++    {pagebackvars%shortlogpageback}
+     <table>
+ {entries%shortlogentry}
+     </table>
++    {pagenextvars%shortlogpagenext}
+ 
+     <div class="page-path">
+     {changenav%navshort}
+diff --git a/mercurial/templates/static/style-monoblue.css b/mercurial/templates/static/style-monoblue.css
+--- a/mercurial/templates/static/style-monoblue.css
++++ b/mercurial/templates/static/style-monoblue.css
+@@ -539,3 +539,16 @@
+ }
+ 
+ /** end of canvas **/
++
++div#page-back, div#page-next {
++  padding: 10px;
++  background-color: whiteSmoke;
++  text-align: center;
++  font-size: 150%;
++  border: solid #ddd;
++  border-width: 1px 0px;
++}
++
++div#page-back:hover, div#page-next:hover {
++  background-color: #eee;
++}
 fix-direntry.diff
 graph-curve.diff
 graph-color.diff
+page-path-style.diff
+pagenav.diff
+manifest-style.diff