view mercurial/node.py @ 16239:287f76b3f502

hgweb: support multi-level repository indexes by enabling descend and collapse The descend option in hgweb can be used to display all reachable repositories within a directory hierarchy if set to True. However, all reachable repositories, regardless of their depth below the root of the hierarchy, are then listed at the same level - expanded - in the hgweb interface. This patch adds support for showing only each level of a directory hierarchy, with subrepositories being shown alongside their parent repositories only at the appropriate level (because there is no way to navigate to subrepositories from within repositories), and the contents of directories hidden - collapsed - behind a link for each directory. To enable this multi-level navigation, a new option called collapse must be set to True when the descend option is set to True.
author Paul Boddie <paul@boddie.org.uk>
date Sat, 18 Feb 2012 20:10:19 +0100
parents 25e572394f5c
children 1a5211f2f87f
line wrap: on
line source

# node.py - basic nodeid manipulation for mercurial
#
# Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.

import binascii

nullrev = -1
nullid = "\0" * 20

# This ugly style has a noticeable effect in manifest parsing
hex = binascii.hexlify
bin = binascii.unhexlify

def short(node):
    return hex(node[:6])