sapling/eden/scm/tests/test-rebase-check-restore-t.py
John Reese 9fd86a4fae apply upgraded black 21.4b2 formatting to fbsource
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
2021-05-04 22:16:51 -07:00

163 lines
3.4 KiB
Python

# coding=utf-8
# Copyright (c) Facebook, Inc. and its affiliates.
# Copyright (c) Mercurial Contributors.
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
sh % "setconfig 'extensions.treemanifest=!'"
# TODO: Make this test compatibile with obsstore enabled.
sh % "setconfig 'experimental.evolution='"
(
sh % "cat"
<< r"""
[extensions]
rebase=
[phases]
publish=False
"""
>> "$HGRCPATH"
)
sh % "hg init a"
sh % "cd a"
sh % "echo A" > "A"
sh % "hg add A"
sh % "hg ci -m A"
sh % "echo B" > "B"
sh % "hg add B"
sh % "hg ci -m B"
sh % "echo C" >> "A"
sh % "hg ci -m C"
sh % "hg up -q -C min(_all())"
sh % "echo D" >> "A"
sh % "hg ci -m D"
sh % "echo E" > "E"
sh % "hg add E"
sh % "hg ci -m E"
sh % "hg up -q -C min(_all())"
sh % "echo F" >> "A"
sh % "hg ci -m F"
sh % "cd .."
# Rebasing B onto E - check keep: and phases
sh % "hg clone -q -u . a a1"
sh % "cd a1"
sh % "tglogp" == r"""
@ 3225f3ea730a draft 'F'
│ o ae36e8e3dfd7 draft 'E'
│ │
│ o 46b37eabc604 draft 'D'
├─╯
│ o 965c486023db draft 'C'
│ │
│ o 27547f69f254 draft 'B'
├─╯
o 4a2df7238c3b draft 'A'"""
sh % "hg rebase -s desc(B) -d desc(E) --keep" == r"""
rebasing 27547f69f254 "B"
rebasing 965c486023db "C"
merging A
warning: 1 conflicts while merging A! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]"""
# Solve the conflict and go on:
sh % "echo 'conflict solved'" > "A"
sh % "rm A.orig"
sh % "hg resolve -m A" == r"""
(no more unresolved files)
continue: hg rebase --continue"""
sh % "hg rebase --continue" == r'''
already rebased 27547f69f254 "B" as 45396c49d53b
rebasing 965c486023db "C"'''
sh % "tglogp" == r"""
o d2d25e26288e draft 'C'
o 45396c49d53b draft 'B'
│ @ 3225f3ea730a draft 'F'
│ │
o │ ae36e8e3dfd7 draft 'E'
│ │
o │ 46b37eabc604 draft 'D'
├─╯
│ o 965c486023db draft 'C'
│ │
│ o 27547f69f254 draft 'B'
├─╯
o 4a2df7238c3b draft 'A'"""
sh % "cd .."
# Rebase F onto E:
sh % "hg clone -q -u . a a2"
sh % "cd a2"
sh % "tglogp" == r"""
@ 3225f3ea730a draft 'F'
│ o ae36e8e3dfd7 draft 'E'
│ │
│ o 46b37eabc604 draft 'D'
├─╯
│ o 965c486023db draft 'C'
│ │
│ o 27547f69f254 draft 'B'
├─╯
o 4a2df7238c3b draft 'A'"""
sh % "hg rebase -s desc(F) -d desc(E)" == r"""
rebasing 3225f3ea730a "F"
merging A
warning: 1 conflicts while merging A! (edit, then use 'hg resolve --mark')
unresolved conflicts (see hg resolve, then hg rebase --continue)
[1]"""
# Solve the conflict and go on:
sh % "echo 'conflict solved'" > "A"
sh % "rm A.orig"
sh % "hg resolve -m A" == r"""
(no more unresolved files)
continue: hg rebase --continue"""
sh % "hg rebase --continue" == 'rebasing 3225f3ea730a "F"'
sh % "tglogp" == r"""
@ 530bc6058bd0 draft 'F'
o ae36e8e3dfd7 draft 'E'
o 46b37eabc604 draft 'D'
│ o 965c486023db draft 'C'
│ │
│ o 27547f69f254 draft 'B'
├─╯
o 4a2df7238c3b draft 'A'"""
sh % "cd .."