sapling/mercurial/node.py
Yuya Nishihara 83b08b045e node: define experimental identifiers for working directory
The "ff..." node was introduced at 187c3ec3d83f, and we also need an integer
that can be processed in revset. We could use len(repo), but it would be
likely to hide possible bugs. Instead, using INT_MAX, we can notice such bugs
by IndexError, at the cost of handling non-contiguous revisions.
2015-06-22 22:01:33 +09:00

24 lines
605 B
Python

# 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
# pseudo identifiers for working directory
# (they are experimental, so don't add too many dependencies on them)
wdirrev = 0x7fffffff
wdirid = "\xff" * 20
# This ugly style has a noticeable effect in manifest parsing
hex = binascii.hexlify
bin = binascii.unhexlify
def short(node):
return hex(node[:6])