mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +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
60 lines
1.9 KiB
Python
60 lines
1.9 KiB
Python
# 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 % "cat"
|
|
<< r"""
|
|
[extensions]
|
|
phrevset=
|
|
|
|
[paths]
|
|
default=dummy://dummy
|
|
"""
|
|
>> "$HGRCPATH"
|
|
)
|
|
sh % "hg init repo"
|
|
sh % "cd repo"
|
|
sh % "echo 1" > "1"
|
|
sh % "hg add 1"
|
|
sh % "hg commit -m 'Differential Revision: http.ololo.com/D1234'"
|
|
sh % "hg up -q 0"
|
|
sh % "hg up D1234" == r"""
|
|
phrevset.callsign is not set - doing a linear search
|
|
This will be slow if the diff was not committed recently
|
|
abort: phrevset.graphqlonly is set and Phabricator cannot resolve D1234
|
|
[255]"""
|
|
|
|
sh % "drawdag" << "A"
|
|
sh % "setconfig phrevset.mock-D1234=$A phrevset.callsign=CALLSIGN"
|
|
sh % "hg log -r D1234 -T '{desc}\n'" == "A"
|
|
|
|
# Callsign is invalid
|
|
sh % "hg log -r D1234 --config phrevset.callsign=C -T '{desc}\n'" == r"""
|
|
abort: Diff callsign 'CALLSIGN' is different from repo callsigns '['C']'
|
|
[255]"""
|
|
|
|
# Now we have two callsigns, and one of them is correct. Make sure it works
|
|
sh % "hg log -r D1234 --config phrevset.callsign=C,CALLSIGN -T '{desc}\n'" == "A"
|
|
|
|
# Phabricator provides an unknown commit hash.
|
|
sh % "setconfig phrevset.mock-D1234=6008bb23d775556ff6c3528541ca5a2177b4bb92"
|
|
sh % "hg log -r D1234 -T '{desc}\n'" == r"""
|
|
pulling D1234 (6008bb23d775556ff6c3528541ca5a2177b4bb92) from 'dummy://dummy/'
|
|
pull failed: repository dummy://dummy/ not found
|
|
abort: unknown revision 'D1234'!
|
|
[255]"""
|
|
|
|
# 'pull -r Dxxx' will be rewritten to 'pull -r HASH'
|
|
sh % "hg pull -r D1234 --config paths.default=." == r"""
|
|
pulling from $TESTTMP/repo
|
|
rewriting pull rev 'D1234' into '6008bb23d775556ff6c3528541ca5a2177b4bb92'
|
|
abort: unknown revision '6008bb23d775556ff6c3528541ca5a2177b4bb92'!
|
|
[255]"""
|