2009-04-26 03:13:08 +04:00
|
|
|
# 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
|
2010-01-20 07:20:08 +03:00
|
|
|
# GNU General Public License version 2 or any later version.
|
2005-08-28 01:21:25 +04:00
|
|
|
|
2015-08-09 05:43:24 +03:00
|
|
|
from __future__ import absolute_import
|
|
|
|
|
2006-12-13 22:27:09 +03:00
|
|
|
import binascii
|
2005-08-28 01:21:25 +04:00
|
|
|
|
2015-11-16 22:23:32 +03:00
|
|
|
# This ugly style has a noticeable effect in manifest parsing
|
|
|
|
hex = binascii.hexlify
|
|
|
|
bin = binascii.unhexlify
|
|
|
|
|
2006-10-29 12:53:51 +03:00
|
|
|
nullrev = -1
|
2016-03-13 01:04:57 +03:00
|
|
|
nullid = b"\0" * 20
|
2015-11-16 22:23:32 +03:00
|
|
|
nullhex = hex(nullid)
|
2005-08-28 01:21:25 +04:00
|
|
|
|
2015-06-22 16:01:33 +03:00
|
|
|
# pseudo identifiers for working directory
|
|
|
|
# (they are experimental, so don't add too many dependencies on them)
|
|
|
|
wdirrev = 0x7fffffff
|
2016-03-13 01:04:57 +03:00
|
|
|
wdirid = b"\xff" * 20
|
2015-06-22 16:01:33 +03:00
|
|
|
|
2005-08-28 01:21:25 +04:00
|
|
|
def short(node):
|
|
|
|
return hex(node[:6])
|