Patchwork hgweb: Ensure isdirectory is None for repositories, replacing any True value

login
register
mail settings
Submitter Paul Boddie
Date Feb. 26, 2014, 11:25 p.m.
Message ID <48bd57f415f66ce317cd.1393457147@jeremy>
Download mbox | patch
Permalink /patch/3780/
State Accepted
Commit 3d77e567de56c9f8a45073db654c58a05f7851a2
Headers show

Comments

Paul Boddie - Feb. 26, 2014, 11:25 p.m.
# HG changeset patch
# User Paul Boddie <paul@boddie.org.uk>
# Date 1393457046 -3600
# Node ID 48bd57f415f66ce317cd81d64960ff58d0f9ced2
# Parent  aa021ece4506f5e962c8d87ab58ab594a0105ced
hgweb: Ensure isdirectory is None for repositories, replacing any True value

Until now, repositories did not provide any value for isdirectory in rows
produced for the index output, and thus isdirectory was generally evaluated as
None for each index entry representing a repository.

However, directories (visible when viewed with the descend and collapse
settings enabled) did provide a value of True and this value appeared to
persist in subsequent rows processed by the templater, causing isdirectory
tests in templates to produce incorrect results for index entries appearing
after directories.

This patch asserts the None value for repositories, thus erasing any such
persistent True values.
Matt Mackall - Feb. 27, 2014, 12:02 a.m.
On Thu, 2014-02-27 at 00:25 +0100, Paul Boddie wrote:
> # HG changeset patch
> # User Paul Boddie <paul@boddie.org.uk>
> # Date 1393457046 -3600
> # Node ID 48bd57f415f66ce317cd81d64960ff58d0f9ced2
> # Parent  aa021ece4506f5e962c8d87ab58ab594a0105ced
> hgweb: Ensure isdirectory is None for repositories, replacing any True value

Looks like a bug fix; queued for stable, thanks.
Paul Boddie - Feb. 27, 2014, 5:32 p.m.
On Thursday 27. February 2014 01.02.06 Matt Mackall wrote:
> On Thu, 2014-02-27 at 00:25 +0100, Paul Boddie wrote:
> > # HG changeset patch
> > # User Paul Boddie <paul@boddie.org.uk>
> > # Date 1393457046 -3600
> > # Node ID 48bd57f415f66ce317cd81d64960ff58d0f9ced2
> > # Parent  aa021ece4506f5e962c8d87ab58ab594a0105ced
> > hgweb: Ensure isdirectory is None for repositories, replacing any True
> > value
> 
> Looks like a bug fix; queued for stable, thanks.

No problem! I originally regarded this as some strange caching issue, and I 
still think that there is something odd about the way that each row produced 
by makeindex may or may not include an isdirectory item, but when it does get 
set in a row, subsequent entries have that item "stuck" unless they override 
it.

I couldn't figure out where this happens, though, but it bothers me that there 
may be some incorrect behaviour lurking somewhere.

Paul

Patch

diff -r aa021ece4506 -r 48bd57f415f6 mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py	Thu Feb 20 00:46:13 2014 -0600
+++ b/mercurial/hgweb/hgwebdir_mod.py	Thu Feb 27 00:24:06 2014 +0100
@@ -365,7 +365,8 @@ 
                            description_sort=description.upper() or "unknown",
                            lastchange=d,
                            lastchange_sort=d[1]-d[0],
-                           archives=archivelist(u, "tip", url))
+                           archives=archivelist(u, "tip", url),
+                           isdirectory=None)
 
                 seenrepos.add(name)
                 yield row