comparison mercurial/hgweb/hgwebdir_mod.py @ 25396:78e8890cfb4b stable

hgwebdir: avoid redundant repo and directory entries when 'web.name' is set Previously, when 'web.name' was set on a subrepo parent and 'web.collapse=True', the parent repo would show in the list with the configured 'web.name', and a directory with the parent repo's filesystem name (with a trailing slash) would also appear. The subrepo(s) would unexpectedly be excluded from the list of repositories. Clicking the directory entry would go right to the repo page. Now both the parent and the subrepos show up, without the additional directory entry. The configured hgweb paths used '**' for finding the repos in this scenario. A couple of notes about the tests: - The area where the subrepo was added has a comment that it tests subrepos, though none previously existed there. One now does. - The 'web.descend' option is required for collapse to work. I'm not sure what the previous expectations were for the test. Nothing changed with it set, prior to adding the code in this patch. It is however required for this test. - The only output changes are for the hyperlinks, obviously because of the 'web.name' parameter. - Without this code change, there would be an additional diff: --- /usr/local/mercurial/tests/test-hgwebdir.t +++ /usr/local/mercurial/tests/test-hgwebdir.t.err @@ -951,7 +951,7 @@ /rcoll/notrepo/e/ /rcoll/notrepo/e/e2/ /rcoll/notrepo/f/ - /rcoll/notrepo/f/f2/ + /rcoll/notrepo/f/ Test repositories inside intermediate directories I'm not sure why the fancy name doesn't come out, but it is enough to demonstrate that the parent is not listed redundantly, and the subrepo isn't skipped.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 01 Jun 2015 14:42:55 -0400
parents e48a5d3996c2
children 724d7982b790 5f3666da6910
comparison
equal deleted inserted replaced
25395:d46f6b078799 25396:78e8890cfb4b
354 except OSError: 354 except OSError:
355 continue 355 continue
356 356
357 contact = get_contact(get) 357 contact = get_contact(get)
358 description = get("web", "description", "") 358 description = get("web", "description", "")
359 seenrepos.add(name)
359 name = get("web", "name", name) 360 name = get("web", "name", name)
360 row = {'contact': contact or "unknown", 361 row = {'contact': contact or "unknown",
361 'contact_sort': contact.upper() or "unknown", 362 'contact_sort': contact.upper() or "unknown",
362 'name': name, 363 'name': name,
363 'name_sort': name, 364 'name_sort': name,
368 'lastchange_sort': d[1]-d[0], 369 'lastchange_sort': d[1]-d[0],
369 'archives': archivelist(u, "tip", url), 370 'archives': archivelist(u, "tip", url),
370 'isdirectory': None, 371 'isdirectory': None,
371 } 372 }
372 373
373 seenrepos.add(name)
374 yield row 374 yield row
375 375
376 sortdefault = None, False 376 sortdefault = None, False
377 def entries(sortcolumn="", descending=False, subdir="", **map): 377 def entries(sortcolumn="", descending=False, subdir="", **map):
378 rows = rawentries(subdir=subdir, **map) 378 rows = rawentries(subdir=subdir, **map)