sapling/eden/scm/tests/test-remotenames-strip-t.py
Jun Wu f1afaa9ae4 tests: enable narrow-heads for more Python tests
Summary: Migrate some Python tests to use narrow-heads.

Reviewed By: DurhamG

Differential Revision: D22130167

fbshipit-source-id: 5cc71711b5bc674daed5040909e7cd141b7a9cfc
2020-07-02 13:22:29 -07:00

51 lines
1.7 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 or any later version.
from __future__ import absolute_import
from testutil.dott import feature, sh, testtmp # noqa: F401
sh % "enable remotenames"
# Test that hg debugstrip -B stops at remotenames
sh % "hg init server"
sh % "hg clone -q server client"
sh % "cd client"
sh % "echo x" > "x"
sh % "hg commit -Aqm a"
sh % "echo a" > "a"
sh % "hg commit -Aqm aa"
sh % "hg debugmakepublic"
sh % "hg push -q --to master --create"
sh % "echo b" > "b"
sh % "hg commit -Aqm bb"
sh % "hg book foo"
sh % "hg log -T '{desc} ({bookmarks}) ({remotebookmarks})\\n'" == r"""
bb (foo) ()
aa () (default/master public/a6e72781733c178cd290a07022bb6c8460749e7b)
a () ()"""
sh % "hg debugstrip -qB foo" == "bookmark 'foo' deleted"
sh % "hg log -T '{desc} ({bookmarks}) ({remotebookmarks})\\n'" == r"""
aa () (default/master public/a6e72781733c178cd290a07022bb6c8460749e7b)
a () ()"""
# Test that hg debugstrip -B deletes bookmark even if there is a remote bookmark,
# but doesn't delete the commit.
sh % "hg init server"
sh % "hg clone -q server client"
sh % "cd client"
sh % "echo x" > "x"
sh % "hg commit -Aqm a"
sh % "hg debugmakepublic"
sh % "hg push -q --to master --create"
sh % "hg book foo"
sh % "hg log -T '{desc} ({bookmarks}) ({remotebookmarks})\\n'" == "a (foo) (default/master public/770eb8fce608e2c55f853a8a5ea328b659d70616)"
sh % "hg debugstrip -qB foo" == r"""
bookmark 'foo' deleted
abort: empty revision set
[255]"""
sh % "hg log -T '{desc} ({bookmarks}) ({remotebookmarks})\\n'" == "a () (default/master public/770eb8fce608e2c55f853a8a5ea328b659d70616)"