mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
9fd86a4fae
Summary: This applies the formatting changes from black v21.4b2 to all covered projects in fbsource. Most changes are to single line docstrings, as black will now remove leading and trailing whitespace to match PEP8. Any other formatting changes are likely due to files that landed without formatting, or files that previously triggered errors in black. Any changes to code should be AST identical. Any test failures are likely due to bad tests, or testing against the output of pyfmt. Reviewed By: thatch Differential Revision: D28204910 fbshipit-source-id: 804725bcd14f763e90c5ddff1d0418117c15809a
141 lines
2.5 KiB
Python
141 lines
2.5 KiB
Python
# coding=utf-8
|
|
|
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
#
|
|
# This software may be used and distributed according to the terms of the
|
|
# GNU General Public License version 2.
|
|
|
|
from __future__ import absolute_import
|
|
|
|
from testutil.dott import feature, sh, testtmp # noqa: F401
|
|
|
|
|
|
sh.setmodernconfig()
|
|
|
|
# Incompatible with full RustIndex
|
|
|
|
sh % "setconfig experimental.rust-commits=off"
|
|
|
|
# Test turning zstore-commit-data on and off
|
|
|
|
sh % "setconfig format.use-zstore-commit-data=off"
|
|
|
|
sh % "newrepo"
|
|
(
|
|
sh % "drawdag"
|
|
<< r"""
|
|
B C
|
|
|/
|
|
A
|
|
"""
|
|
)
|
|
|
|
# Migrate up (double-writes to zstore and 00changelog.d).
|
|
|
|
sh % "setconfig format.use-zstore-commit-data=on"
|
|
sh % 'hg log -r "$C" -T "{desc}\\n"' == "C"
|
|
|
|
# Create new commits.
|
|
|
|
(
|
|
sh % "drawdag"
|
|
<< r"""
|
|
F
|
|
/|
|
|
D E
|
|
| |
|
|
desc(C)
|
|
"""
|
|
)
|
|
|
|
# With zstore-commit-data, 00changelog.d is not used for reading commits.
|
|
|
|
sh % "mv .hg/store/00changelog.d .hg/store/00changelog.d.bak"
|
|
sh % 'hg log -GT "{desc}"' == r"""
|
|
o F
|
|
├─╮
|
|
│ o E
|
|
│ │
|
|
o │ D
|
|
├─╯
|
|
o C
|
|
│
|
|
│ o B
|
|
├─╯
|
|
o A"""
|
|
|
|
# Migrate down. 00changelog.d becomes required.
|
|
|
|
sh % "setconfig format.use-zstore-commit-data=off"
|
|
sh % 'hg log -GT "{desc}"' == r"""
|
|
abort: *00changelog.d* (glob)
|
|
[255]"""
|
|
|
|
sh % "mv .hg/store/00changelog.d.bak .hg/store/00changelog.d"
|
|
sh % 'hg log -GT "{desc}"' == r"""
|
|
o F
|
|
├─╮
|
|
│ o E
|
|
│ │
|
|
o │ D
|
|
├─╯
|
|
o C
|
|
│
|
|
│ o B
|
|
├─╯
|
|
o A"""
|
|
|
|
# Create new commits.
|
|
|
|
(
|
|
sh % "drawdag"
|
|
<< r"""
|
|
H
|
|
|
|
|
G
|
|
|
|
|
desc(B)
|
|
"""
|
|
)
|
|
|
|
# Migrate up (double-writes to zstore and 00changelog.d).
|
|
|
|
sh % "setconfig format.use-zstore-commit-data=on"
|
|
sh % 'hg log -r "$H" -T "{desc}\\n"' == "H"
|
|
|
|
# Test the revlog-fallback mode migrates draft commits.
|
|
|
|
sh.setconfig("format.use-zstore-commit-data=off")
|
|
|
|
sh % "newrepo"
|
|
sh % "drawdag" << r"""
|
|
B
|
|
|
|
|
A
|
|
""" == ""
|
|
|
|
# Make A public.
|
|
sh.hg("debugremotebookmark", "master", "desc(A)")
|
|
sh % "hg log -r 'public()' -T '{desc} '" == "A"
|
|
sh % "hg log -r 'draft()' -T '{desc} '" == "B"
|
|
|
|
# Migrate.
|
|
sh.setconfig(
|
|
"format.use-zstore-commit-data=on",
|
|
"format.use-zstore-commit-data-revlog-fallback=on",
|
|
)
|
|
|
|
sh % "hg log -r 'desc(A)' -T '{desc}'" == "A"
|
|
sh % "hg log -r 'desc(B)' -T '{desc}'" == "B"
|
|
|
|
# Break revlog.
|
|
|
|
sh % "mv .hg/store/00changelog.d .hg/store/00changelog.d.bak"
|
|
|
|
# "$A" can no longer be accessed because it was public.
|
|
|
|
sh % "hg log -r $A -T '{desc}'" == r"""
|
|
abort:*00changelog.d* (glob)
|
|
[255]"""
|
|
sh % "hg log -r $B -T '{desc}'" == "B"
|