view mercurial/node.py @ 22477:3c8ae79eacb0

annotate: build format string separately from annotation data This prepares for porting to generic templater API. Note that we cannot use '%*s' to pad white spaces because it doesn't take into account character widths, as described in 4f5a6df2af92.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 29 Aug 2014 05:36:52 +0200
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])