mercurial/node.py
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Tue, 22 Jul 2014 23:59:30 +0900
branchstable
changeset 21931 89b809fa6cef
parent 10263 25e572394f5c
child 25737 1a5211f2f87f
permissions -rw-r--r--
dirstate: delay writing out to ensure timestamp of each entries explicitly Even though "dirstate.write()" is invoked explicitly after "normal" invocations, timestamp field of entries may be still "unset" in the "dirstate" file itself , because "pack_dirstate" drops it when it is equal to the timestamp of "dirstate" file itself. This can avoid overlooking modification of files, which are updated at same time in the second. But on the other hand, this may hide timing critical problems. For example, incorrect "normal"-ing (or lack of "normallookup"-ing on the already "normal"-ed entry) is visible only when: - the target file is modified in the working directory at T1, and - "dirstate" file is written out at T2 (!= T1) Otherwise, T1 is dropped by "pack_dirstate" in "dirstate.write()" invocation, and "unset" is stored into "dirstate" file. It often fails to reproduce problems from incorrect "normal"-ing by Mercurial testset, because automated actions in the small repository almost always causes that T1 and T2 are same. This patch adds the debug feature to delay writing out to ensure timestamp of each entries explicitly. This feature is used to make timing critical "dirstate" problems reproducable in subsequent patches.

# 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])