sapling/eden/scm/tests/test-checkserverbookmark.t
Zeyi (Rice) Fan 92f6f35e7a mark all tests requiring Python 2
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
2020-01-30 18:49:21 -08:00

66 lines
2.7 KiB
Perl

#require py2
#chg-compatible
$ . "$TESTDIR/hgsql/library.sh"
Do some initial setup
$ configure dummyssh
$ enable checkserverbookmark smartlog
$ setconfig ui.user="nobody <no.reply@fb.com>"
Setup helpers
$ log() {
> hg sl -T "{desc} [{phase};rev={rev};{node}] {bookmarks}" "$@"
> }
Setup a server repo
$ hg init server
$ cd server
$ echo a > a && hg ci -qAm a && hg book -i book1
$ echo b > b && hg ci -qAm b
$ echo c > c && hg ci -qAm c && hg book -i book2
$ log -r "all()"
@ c [draft;rev=2;177f92b773850b59254aa5e923436f921b55483b] book2
|
o b [draft;rev=1;d2ae7f538514cd87c17547b0de4cea71fe1af9fb]
|
o a [draft;rev=0;cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b] book1
Verify bookmark locations while not being in a repo
$ cd $TESTTMP
$ hg checkserverbookmark --path ssh://user@dummy/server --name book1 --hash cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b --deleted
abort: can't use `--hash` and `--deleted`
[255]
$ hg checkserverbookmark --path ssh://user@dummy/server --name book1
abort: either `--hash` or `--deleted` should be used
[255]
$ hg checkserverbookmark --path ssh://user@dummy/server --name book1 --hash cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
creating a peer took: * (glob)
running lookup took: * (glob)
hg server has expected bookmark location. book: book1, hash: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
$ hg checkserverbookmark --path ssh://user@dummy/server --name book2 --hash cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
creating a peer took: * (glob)
running lookup took: * (glob)
hg server does not have an expected bookmark location. book: book2, server: 177f92b773850b59254aa5e923436f921b55483b; expected cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b
[1]
$ hg checkserverbookmark --path ssh://user@dummy/server --name book1 --hash d2ae7f538514cd87c17547b0de4cea71fe1af9fb
creating a peer took: * (glob)
running lookup took: * (glob)
hg server does not have an expected bookmark location. book: book1, server: cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b; expected d2ae7f538514cd87c17547b0de4cea71fe1af9fb
[1]
$ hg checkserverbookmark --path ssh://user@dummy/server --name nope --hash d2ae7f538514cd87c17547b0de4cea71fe1af9fb
creating a peer took: * (glob)
running lookup took: * (glob)
abort: unknown revision 'nope'!
[255]
$ hg checkserverbookmark --path ssh://user@dummy/server --name nope --deleted
creating a peer took: * (glob)
running listkeys took: * (glob)
hg server expectedly does not have a bookmark: nope
$ hg checkserverbookmark --path ssh://user@dummy/server --name book1 --deleted
creating a peer took: * (glob)
running listkeys took: * (glob)
hg server has bookmark, which is expected to have been deleted: book1
[1]