view mercurial/node.py @ 13102:2956945c3bee stable

archival: don't set gzip filename header when there's no filename This mainly affects hgweb, which can generate tar.gz archives without filenames. Without this change, the header would be set to ".gz", which can confuse Safari into extracting the file and renaming it to "gz" when "Open 'safe' files after downloading" is enabled. file(1) before: hg-crew-5e51254ad4d4.tar.gz: gzip compressed data, was ".gz", last modified: Thu Dec 2 11:46:20 2010, max compression after: hg-crew-5e51254ad4d4.tar.gz: gzip compressed data, last modified: Thu Dec 2 11:46:20 2010, max compression
author Brodie Rao <brodie@bitheap.org>
date Tue, 07 Dec 2010 19:47:53 +1100
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])