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
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03: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
|
|
|
|
2016-11-10 13:17:22 +03:00
|
|
|
# Phony node value to stand-in for new files in some uses of
|
|
|
|
# manifests.
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
newnodeid = "!" * 20
|
|
|
|
addednodeid = ("0" * 15) + "added"
|
|
|
|
modifiednodeid = ("0" * 12) + "modified"
|
2016-11-10 13:17:22 +03:00
|
|
|
|
2017-02-11 03:56:29 +03:00
|
|
|
wdirnodes = {newnodeid, addednodeid, modifiednodeid}
|
2016-11-10 13:17:22 +03: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
|
2016-08-19 12:26:04 +03:00
|
|
|
wdirhex = hex(wdirid)
|
2015-06-22 16:01:33 +03:00
|
|
|
|
codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).
Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.
Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.
An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.
As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.
Reviewed By: wez, phillco, simpkins, pkaush, singhsrb
Differential Revision: D8173629
fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-26 07:34:37 +03:00
|
|
|
|
2005-08-28 01:21:25 +04:00
|
|
|
def short(node):
|
|
|
|
return hex(node[:6])
|