Commit 4b49f3be authored by Augie Fackler's avatar Augie Fackler

merge to stable for 5.3 release freeze

--HG--
branch : stable
{
"conduit_uri": "https://phab.mercurial-scm.org/api",
"phabricator.uri": "https://phab.mercurial-scm.org/",
"repository.callsign": "HG",
"arc.land.onto.default": "@",
"base": "hg:.^"
......
......@@ -51,6 +51,7 @@ tags
cscope.*
.idea/*
.asv/*
.pytype/*
i18n/hg.pot
locale/*/LC_MESSAGES/hg.mo
hgext/__index__.py
......
......@@ -11,7 +11,7 @@ HGPYTHONS ?= $(HGROOT)/build/pythons
PURE=
PYFILESCMD=find mercurial hgext doc -name '*.py'
PYFILES:=$(shell $(PYFILESCMD))
DOCFILES=mercurial/help/*.txt
DOCFILES=mercurial/helptext/*.txt
export LANGUAGE=C
export LC_ALL=C
TESTFLAGS ?= $(shell echo $$HGTESTFLAGS)
......@@ -189,7 +189,8 @@ packaging_targets := \
docker-centos6 \
docker-centos7 \
docker-centos8 \
docker-debian-jessie \
docker-debian-bullseye \
docker-debian-buster \
docker-debian-stretch \
docker-fedora \
docker-ubuntu-trusty \
......
......@@ -59,7 +59,7 @@ DEBIAN_ACCOUNT_ID_2 = '136693071363'
UBUNTU_ACCOUNT_ID = '099720109477'
WINDOWS_BASE_IMAGE_NAME = 'Windows_Server-2019-English-Full-Base-2019.07.12'
WINDOWS_BASE_IMAGE_NAME = 'Windows_Server-2019-English-Full-Base-2019.11.13'
KEY_PAIRS = {
......
......@@ -71,7 +71,7 @@ Write-Output "updated Mercurial working directory to {revision}"
BUILD_INNO = r'''
Set-Location C:\hgdev\src
$python = "C:\hgdev\python27-{arch}\python.exe"
C:\hgdev\python37-x64\python.exe contrib\packaging\inno\build.py --python $python
C:\hgdev\python37-x64\python.exe contrib\packaging\packaging.py inno --python $python
if ($LASTEXITCODE -ne 0) {{
throw "process exited non-0: $LASTEXITCODE"
}}
......@@ -88,7 +88,7 @@ if ($LASTEXITCODE -ne 0) {{
BUILD_WIX = r'''
Set-Location C:\hgdev\src
$python = "C:\hgdev\python27-{arch}\python.exe"
C:\hgdev\python37-x64\python.exe contrib\packaging\wix\build.py --python $python {extra_args}
C:\hgdev\python37-x64\python.exe contrib\packaging\packaging.py wix --python $python {extra_args}
if ($LASTEXITCODE -ne 0) {{
throw "process exited non-0: $LASTEXITCODE"
}}
......
......@@ -281,10 +281,10 @@ for i in [0, 1]:
for tp in testpats[i]:
p = tp[0]
m = tp[1]
if p.startswith(r'^'):
p = r"^ [$>] (%s)" % p[1:]
if p.startswith('^'):
p = "^ [$>] (%s)" % p[1:]
else:
p = r"^ [$>] .*(%s)" % p
p = "^ [$>] .*(%s)" % p
utestpats[i].append((p, m) + tp[2:])
# don't transform the following rules:
......
......@@ -27,32 +27,42 @@ beforepatch = afterheader + r"(?!\n(?!@@))"
errors = [
(beforepatch + r".*[(]bc[)]", "(BC) needs to be uppercase"),
(beforepatch + r".*[(]issue \d\d\d",
"no space allowed between issue and number"),
(
beforepatch + r".*[(]issue \d\d\d",
"no space allowed between issue and number",
),
(beforepatch + r".*[(]bug(\d|\s)", "use (issueDDDD) instead of bug"),
(commitheader + r"# User [^@\n]+\n", "username is not an email address"),
(commitheader + r"(?!merge with )[^#]\S+[^:] ",
"summary line doesn't start with 'topic: '"),
(
commitheader + r"(?!merge with )[^#]\S+[^:] ",
"summary line doesn't start with 'topic: '",
),
(afterheader + r"[A-Z][a-z]\S+", "don't capitalize summary lines"),
(afterheader + r"^\S+: *[A-Z][a-z]\S+", "don't capitalize summary lines"),
(afterheader + r"\S*[^A-Za-z0-9-_]\S*: ",
"summary keyword should be most user-relevant one-word command or topic"),
(
afterheader + r"\S*[^A-Za-z0-9-_]\S*: ",
"summary keyword should be most user-relevant one-word command or topic",
),
(afterheader + r".*\.\s*\n", "don't add trailing period on summary line"),
(afterheader + r".{79,}", "summary line too long (limit is 78)"),
]
word = re.compile(r'\S')
def nonempty(first, second):
if word.search(first):
return first
return second
def checkcommit(commit, node=None):
exitcode = 0
printed = node is None
hits = []
signtag = (afterheader +
r'Added (tag [^ ]+|signature) for changeset [a-f0-9]{12}')
signtag = (
afterheader + r'Added (tag [^ ]+|signature) for changeset [a-f0-9]{12}'
)
if re.search(signtag, commit):
return 0
for exp, msg in errors:
......@@ -84,9 +94,11 @@ def checkcommit(commit, node=None):
return exitcode
def readcommit(node):
return os.popen("hg export %s" % node).read()
if __name__ == "__main__":
exitcode = 0
node = os.environ.get("HG_NODE")
......
......@@ -3,100 +3,9 @@
mercurial/cext/manifest.c
mercurial/cext/osutil.c
# Vendored code that we should never format:
contrib/python-zstandard/c-ext/bufferutil.c
contrib/python-zstandard/c-ext/compressionchunker.c
contrib/python-zstandard/c-ext/compressiondict.c
contrib/python-zstandard/c-ext/compressionparams.c
contrib/python-zstandard/c-ext/compressionreader.c
contrib/python-zstandard/c-ext/compressionwriter.c
contrib/python-zstandard/c-ext/compressobj.c
contrib/python-zstandard/c-ext/compressor.c
contrib/python-zstandard/c-ext/compressoriterator.c
contrib/python-zstandard/c-ext/constants.c
contrib/python-zstandard/c-ext/decompressionreader.c
contrib/python-zstandard/c-ext/decompressionwriter.c
contrib/python-zstandard/c-ext/decompressobj.c
contrib/python-zstandard/c-ext/decompressor.c
contrib/python-zstandard/c-ext/decompressoriterator.c
contrib/python-zstandard/c-ext/frameparams.c
contrib/python-zstandard/c-ext/python-zstandard.h
contrib/python-zstandard/zstd.c
contrib/python-zstandard/zstd/common/bitstream.h
contrib/python-zstandard/zstd/common/compiler.h
contrib/python-zstandard/zstd/common/cpu.h
contrib/python-zstandard/zstd/common/debug.c
contrib/python-zstandard/zstd/common/debug.h
contrib/python-zstandard/zstd/common/entropy_common.c
contrib/python-zstandard/zstd/common/error_private.c
contrib/python-zstandard/zstd/common/error_private.h
contrib/python-zstandard/zstd/common/fse_decompress.c
contrib/python-zstandard/zstd/common/fse.h
contrib/python-zstandard/zstd/common/huf.h
contrib/python-zstandard/zstd/common/mem.h
contrib/python-zstandard/zstd/common/pool.c
contrib/python-zstandard/zstd/common/pool.h
contrib/python-zstandard/zstd/common/threading.c
contrib/python-zstandard/zstd/common/threading.h
contrib/python-zstandard/zstd/common/xxhash.c
contrib/python-zstandard/zstd/common/xxhash.h
contrib/python-zstandard/zstd/common/zstd_common.c
contrib/python-zstandard/zstd/common/zstd_errors.h
contrib/python-zstandard/zstd/common/zstd_internal.h
contrib/python-zstandard/zstd/compress/fse_compress.c
contrib/python-zstandard/zstd/compress/hist.c
contrib/python-zstandard/zstd/compress/hist.h
contrib/python-zstandard/zstd/compress/huf_compress.c
contrib/python-zstandard/zstd/compress/zstd_compress.c
contrib/python-zstandard/zstd/compress/zstd_compress_internal.h
contrib/python-zstandard/zstd/compress/zstd_compress_literals.c
contrib/python-zstandard/zstd/compress/zstd_compress_literals.h
contrib/python-zstandard/zstd/compress/zstd_compress_sequences.c
contrib/python-zstandard/zstd/compress/zstd_compress_sequences.h
contrib/python-zstandard/zstd/compress/zstd_double_fast.c
contrib/python-zstandard/zstd/compress/zstd_double_fast.h
contrib/python-zstandard/zstd/compress/zstd_fast.c
contrib/python-zstandard/zstd/compress/zstd_fast.h
contrib/python-zstandard/zstd/compress/zstd_lazy.c
contrib/python-zstandard/zstd/compress/zstd_lazy.h
contrib/python-zstandard/zstd/compress/zstd_ldm.c
contrib/python-zstandard/zstd/compress/zstd_ldm.h
contrib/python-zstandard/zstd/compress/zstdmt_compress.c
contrib/python-zstandard/zstd/compress/zstdmt_compress.h
contrib/python-zstandard/zstd/compress/zstd_opt.c
contrib/python-zstandard/zstd/compress/zstd_opt.h
contrib/python-zstandard/zstd/decompress/huf_decompress.c
contrib/python-zstandard/zstd/decompress/zstd_ddict.c
contrib/python-zstandard/zstd/decompress/zstd_ddict.h
contrib/python-zstandard/zstd/decompress/zstd_decompress_block.c
contrib/python-zstandard/zstd/decompress/zstd_decompress_block.h
contrib/python-zstandard/zstd/decompress/zstd_decompress_internal.h
contrib/python-zstandard/zstd/decompress/zstd_decompress.c
contrib/python-zstandard/zstd/deprecated/zbuff_common.c
contrib/python-zstandard/zstd/deprecated/zbuff_compress.c
contrib/python-zstandard/zstd/deprecated/zbuff_decompress.c
contrib/python-zstandard/zstd/deprecated/zbuff.h
contrib/python-zstandard/zstd/dictBuilder/cover.c
contrib/python-zstandard/zstd/dictBuilder/cover.h
contrib/python-zstandard/zstd/dictBuilder/divsufsort.c
contrib/python-zstandard/zstd/dictBuilder/divsufsort.h
contrib/python-zstandard/zstd/dictBuilder/fastcover.c
contrib/python-zstandard/zstd/dictBuilder/zdict.c
contrib/python-zstandard/zstd/dictBuilder/zdict.h
contrib/python-zstandard/zstd/zstd.h
hgext/fsmonitor/pywatchman/bser.c
mercurial/thirdparty/xdiff/xdiff.h
mercurial/thirdparty/xdiff/xdiffi.c
mercurial/thirdparty/xdiff/xdiffi.h
mercurial/thirdparty/xdiff/xemit.c
mercurial/thirdparty/xdiff/xemit.h
mercurial/thirdparty/xdiff/xhistogram.c
mercurial/thirdparty/xdiff/xinclude.h
mercurial/thirdparty/xdiff/xmacros.h
mercurial/thirdparty/xdiff/xmerge.c
mercurial/thirdparty/xdiff/xpatience.c
mercurial/thirdparty/xdiff/xprepare.c
mercurial/thirdparty/xdiff/xprepare.h
mercurial/thirdparty/xdiff/xtypes.h
mercurial/thirdparty/xdiff/xutils.c
mercurial/thirdparty/xdiff/xutils.h
mercurial/thirdparty/zope/interface/_zope_interface_coptimizations.c
syntax: glob
contrib/python-zstandard/**.c
contrib/python-zstandard/**.h
hgext/fsmonitor/pywatchman/**.c
mercurial/thirdparty/**.c
mercurial/thirdparty/**.h
......@@ -11,23 +11,26 @@ from mercurial import (
pycompat,
revlog,
)
from mercurial.utils import (
procutil,
)
from mercurial.utils import procutil
for fp in (sys.stdin, sys.stdout, sys.stderr):
procutil.setbinary(fp)
def binopen(path, mode=b'rb'):
if b'b' not in mode:
mode = mode + b'b'
return open(path, pycompat.sysstr(mode))
binopen.options = {}
def printb(data, end=b'\n'):
sys.stdout.flush()
pycompat.stdout.write(data + end)
for f in sys.argv[1:]:
r = revlog.revlog(binopen, encoding.strtolocal(f))
print("file:", f)
......
[fix]
clang-format:command = clang-format --style file -i
clang-format:pattern = (**.c or **.cc or **.h) and not "listfile:contrib/clang-format-ignorelist"
clang-format:command = clang-format --style file
clang-format:pattern = set:(**.c or **.cc or **.h) and not "include:contrib/clang-format-ignorelist"
rustfmt:command = rustfmt {rootpath}
rustfmt:command = rustfmt +nightly
rustfmt:pattern = set:**.rs
black:command = black --config=black.toml -
black:pattern = set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"
# Mercurial doesn't have any Go code, but if we did this is how we
# would configure `hg fix` for Go:
go:command = gofmt
go:pattern = set:**.go
//===- FuzzedDataProvider.h - Utility header for fuzz targets ---*- C++ -* ===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// A single header library providing an utility class to break up an array of
// bytes. Whenever run on the same input, provides the same output, as long as
// its methods are called in the same order, with the same arguments.
//===----------------------------------------------------------------------===//
#ifndef LLVM_FUZZER_FUZZED_DATA_PROVIDER_H_
#define LLVM_FUZZER_FUZZED_DATA_PROVIDER_H_
#include <algorithm>
#include <climits>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <initializer_list>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
// In addition to the comments below, the API is also briefly documented at
// https://github.com/google/fuzzing/blob/master/docs/split-inputs.md#fuzzed-data-provider
class FuzzedDataProvider
{
public:
// |data| is an array of length |size| that the FuzzedDataProvider wraps
// to provide more granular access. |data| must outlive the
// FuzzedDataProvider.
FuzzedDataProvider(const uint8_t *data, size_t size)
: data_ptr_(data), remaining_bytes_(size)
{
}
~FuzzedDataProvider() = default;
// Returns a std::vector containing |num_bytes| of input data. If fewer
// than |num_bytes| of data remain, returns a shorter std::vector
// containing all of the data that's left. Can be used with any byte
// sized type, such as char, unsigned char, uint8_t, etc.
template <typename T> std::vector<T> ConsumeBytes(size_t num_bytes)
{
num_bytes = std::min(num_bytes, remaining_bytes_);
return ConsumeBytes<T>(num_bytes, num_bytes);
}
// Similar to |ConsumeBytes|, but also appends the terminator value at
// the end of the resulting vector. Useful, when a mutable
// null-terminated C-string is needed, for example. But that is a rare
// case. Better avoid it, if possible, and prefer using |ConsumeBytes|
// or |ConsumeBytesAsString| methods.
template <typename T>
std::vector<T> ConsumeBytesWithTerminator(size_t num_bytes,
T terminator = 0)
{
num_bytes = std::min(num_bytes, remaining_bytes_);
std::vector<T> result =
ConsumeBytes<T>(num_bytes + 1, num_bytes);
result.back() = terminator;
return result;
}
// Returns a std::string containing |num_bytes| of input data. Using
// this and
// |.c_str()| on the resulting string is the best way to get an
// immutable null-terminated C string. If fewer than |num_bytes| of data
// remain, returns a shorter std::string containing all of the data
// that's left.
std::string ConsumeBytesAsString(size_t num_bytes)
{
static_assert(sizeof(std::string::value_type) ==
sizeof(uint8_t),
"ConsumeBytesAsString cannot convert the data to "
"a string.");
num_bytes = std::min(num_bytes, remaining_bytes_);
std::string result(
reinterpret_cast<const std::string::value_type *>(
data_ptr_),
num_bytes);
Advance(num_bytes);
return result;
}
// Returns a number in the range [min, max] by consuming bytes from the
// input data. The value might not be uniformly distributed in the given
// range. If there's no input data left, always returns |min|. |min|
// must be less than or equal to |max|.
template <typename T> T ConsumeIntegralInRange(T min, T max)
{
static_assert(std::is_integral<T>::value,
"An integral type is required.");
static_assert(sizeof(T) <= sizeof(uint64_t),
"Unsupported integral type.");
if (min > max)
abort();
// Use the biggest type possible to hold the range and the
// result.
uint64_t range = static_cast<uint64_t>(max) - min;
uint64_t result = 0;
size_t offset = 0;
while (offset < sizeof(T) * CHAR_BIT && (range >> offset) > 0 &&
remaining_bytes_ != 0) {
// Pull bytes off the end of the seed data.
// Experimentally, this seems to allow the fuzzer to
// more easily explore the input space. This makes
// sense, since it works by modifying inputs that caused
// new code to run, and this data is often used to
// encode length of data read by |ConsumeBytes|.
// Separating out read lengths makes it easier modify
// the contents of the data that is actually read.
--remaining_bytes_;
result =
(result << CHAR_BIT) | data_ptr_[remaining_bytes_];
offset += CHAR_BIT;
}
// Avoid division by 0, in case |range + 1| results in overflow.
if (range != std::numeric_limits<decltype(range)>::max())