mirror of
https://github.com/facebook/sapling.git
synced 2024-12-26 22:47:26 +03:00
92f6f35e7a
Summary: This diff marks **ALL** mercurial tests requiring Python 2 feature. After you fixes some tests, simply remove the `py2` feature requirement and that tests will be continuously run after your diff is landed. To bypass this feature requirement, run the tests command with `HGTEST_FORCE_PY2=1`. For example: ``` HGTEST_FORCE_PY2=1 buck test //eden/scm/tests:hg_run_tests ``` or ``` HGTEST_FORCE_PY2=1 python run-tests.py ``` ---- Basically this diff are created with the following commands: ``` $ sed -i 's/import feature\(.*\)$/import feature\1\n\nfeature.require(["py2"])/' test-*-t.py $ sed -i '1s/^/#require py2\n/' test-*.t $ ls | grep -P "^test.*(?<\!-t)\.py$" > list && vim -p $(cat list) # manually adding feature requires for these Python tests. ``` (Note: this ignores all push blocking failures!) ignore-conflict-markers Reviewed By: singhsrb Differential Revision: D19655148 fbshipit-source-id: 985e3ccb4010cc559049f1d89f8909bc2d9b5e20
204 lines
5.1 KiB
Python
204 lines
5.1 KiB
Python
# 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
|
|
|
|
|
|
feature.require(["py2"])
|
|
|
|
|
|
sh % "cat" << r"""
|
|
[extensions]
|
|
reset=
|
|
[experimental]
|
|
evolution=
|
|
""" >> "$HGRCPATH"
|
|
|
|
sh % "hg init repo"
|
|
sh % "cd repo"
|
|
|
|
sh % "echo x" > "x"
|
|
sh % "hg commit -qAm x"
|
|
sh % "hg book foo"
|
|
|
|
# Soft reset should leave pending changes
|
|
|
|
sh % "echo y" >> "x"
|
|
sh % "hg commit -qAm y"
|
|
sh % "hg log -G -T '{node|short} {bookmarks}\\n'" == r"""
|
|
@ 66ee28d0328c foo
|
|
|
|
|
o b292c1e3311f"""
|
|
sh % "hg reset '.^'" == r"""
|
|
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/66ee28d0328c-b6ee89e7-reset.hg
|
|
1 changeset hidden"""
|
|
sh % "hg log -G -T '{node|short} {bookmarks}\\n'" == "@ b292c1e3311f foo"
|
|
sh % "hg diff" == r"""
|
|
diff -r b292c1e3311f x
|
|
--- a/x Thu Jan 01 00:00:00 1970 +0000
|
|
+++ b/x * (glob)
|
|
@@ -1,1 +1,2 @@
|
|
x
|
|
+y"""
|
|
|
|
# Clean reset should overwrite all changes
|
|
|
|
sh % "hg commit -qAm y"
|
|
|
|
sh % "hg reset --clean '.^'" == r"""
|
|
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/66ee28d0328c-b6ee89e7-reset.hg
|
|
1 changeset hidden"""
|
|
sh % "hg diff"
|
|
|
|
# Reset should recover from backup bundles (with correct phase)
|
|
|
|
sh % "hg log -G -T '{node|short} {bookmarks}\\n'" == "@ b292c1e3311f foo"
|
|
sh % "hg phase -p b292c1e3311f"
|
|
sh % "hg reset --clean 66ee28d0328c" == r"""
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files"""
|
|
sh % "hg log -G -T '{node|short} {bookmarks} {phase}\\n'" == r"""
|
|
@ 66ee28d0328c foo draft
|
|
|
|
|
o b292c1e3311f public"""
|
|
sh % "hg phase -f -d b292c1e3311f"
|
|
|
|
# Reset should not strip reachable commits
|
|
|
|
sh % "hg book bar"
|
|
sh % "hg reset --clean '.^'"
|
|
sh % "hg log -G -T '{node|short} {bookmarks}\\n'" == r"""
|
|
o 66ee28d0328c foo
|
|
|
|
|
@ b292c1e3311f bar"""
|
|
|
|
sh % "hg book -d bar"
|
|
sh % "hg up foo" == r"""
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
(activating bookmark foo)"""
|
|
|
|
# Reset to '.' by default
|
|
|
|
sh % "echo z" >> "x"
|
|
sh % "echo z" >> "y"
|
|
sh % "hg add y"
|
|
sh % "hg st" == r"""
|
|
M x
|
|
A y"""
|
|
sh % "hg reset"
|
|
sh % "hg st" == r"""
|
|
M x
|
|
? y"""
|
|
sh % "hg reset -C"
|
|
sh % "hg st" == "? y"
|
|
sh % "rm y"
|
|
|
|
# Keep old commits
|
|
|
|
sh % "hg reset --keep '.^'"
|
|
sh % "hg log -G -T '{node|short} {bookmarks}\\n'" == r"""
|
|
o 66ee28d0328c
|
|
|
|
|
@ b292c1e3311f foo"""
|
|
# Reset without a bookmark
|
|
|
|
sh % "hg up tip" == r"""
|
|
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
(leaving bookmark foo)"""
|
|
sh % "hg book -d foo"
|
|
sh % "hg reset '.^'" == r"""
|
|
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/66ee28d0328c-b6ee89e7-reset.hg
|
|
1 changeset hidden"""
|
|
sh % "hg book foo"
|
|
|
|
# Reset to bookmark with - in the name
|
|
|
|
sh % "hg reset 66ee28d0328c" == r"""
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files"""
|
|
sh % "hg book foo-bar -r '.^'"
|
|
sh % "hg reset foo-bar" == r"""
|
|
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/66ee28d0328c-b6ee89e7-reset.hg
|
|
1 changeset hidden"""
|
|
sh % "hg book -d foo-bar"
|
|
|
|
# Verify file status after reset
|
|
|
|
sh % "hg reset -C 66ee28d0328c" == r"""
|
|
searching for changes
|
|
adding changesets
|
|
adding manifests
|
|
adding file changes
|
|
added 1 changesets with 1 changes to 1 files"""
|
|
sh % "touch toberemoved"
|
|
sh % "hg commit -qAm 'add file for removal'"
|
|
sh % "echo z" >> "x"
|
|
sh % "touch tobeadded"
|
|
sh % "hg add tobeadded"
|
|
sh % "hg rm toberemoved"
|
|
sh % "hg commit -m 'to be reset'"
|
|
sh % "hg reset '.^'" == r"""
|
|
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/d36bf00ac47e-375e6009-reset.hg
|
|
1 changeset hidden"""
|
|
sh % "hg status" == r"""
|
|
M x
|
|
! toberemoved
|
|
? tobeadded"""
|
|
sh % "hg reset -C 66ee28d0328c" == r"""
|
|
saved backup bundle to $TESTTMP/repo/.hg/strip-backup/34fb347b2aae-c2a02721-reset.hg
|
|
1 changeset hidden"""
|
|
|
|
# Reset + Obsolete tests
|
|
|
|
sh % "cat" << r"""
|
|
[extensions]
|
|
amend=
|
|
rebase=
|
|
[experimental]
|
|
evolution=all
|
|
""" >> ".hg/hgrc"
|
|
sh % "touch a"
|
|
sh % "hg commit -Aqm a"
|
|
sh % "hg log -G -T '{node|short} {bookmarks}\\n'" == r"""
|
|
@ 7f3a02b3e388 foo
|
|
|
|
|
o 66ee28d0328c
|
|
|
|
|
o b292c1e3311f"""
|
|
|
|
# Reset prunes commits
|
|
|
|
sh % "hg reset -C '66ee28d0328c^'" == "2 changesets hidden"
|
|
sh % "hg log -r 66ee28d0328c" == r"""
|
|
abort: hidden revision '66ee28d0328c'!
|
|
(use --hidden to access hidden revisions)
|
|
[255]"""
|
|
sh % "hg log -G -T '{node|short} {bookmarks}\\n'" == "@ b292c1e3311f foo"
|
|
sh % "hg reset -C 7f3a02b3e388"
|
|
sh % "hg log -G -T '{node|short} {bookmarks}\\n'" == r"""
|
|
@ 7f3a02b3e388 foo
|
|
|
|
|
o 66ee28d0328c
|
|
|
|
|
o b292c1e3311f"""
|
|
# Reset to the commit your on is a no-op
|
|
sh % "hg status"
|
|
sh % "hg log -r . -T '{rev}\\n'" == "2"
|
|
sh % "hg reset ."
|
|
sh % "hg log -r . -T '{rev}\\n'" == "2"
|
|
sh % "hg debugdirstate" == r"""
|
|
n 644 0 * a (glob)
|
|
n 644 0 * tobeadded (glob)
|
|
n 644 4 * x (glob)"""
|