sapling/eden/scm/tests/test-gitlookup-index.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

108 lines
3.1 KiB
Perl

#require py2
#chg-compatible
#require git
Test the gitlookup.useindex=True feature for fast git -> hg commit translation.
Repos:
- gitrepo: the source git repo
- hgrepo: sync from the hgrepo
- hgclient: a dummy repo that talks to hgrepo
Prepare the git repo:
$ . "$TESTDIR/hggit/testutil"
$ git init --quiet gitrepo
$ cd gitrepo
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
$ git checkout --quiet -b beta
$ echo beta > beta
$ git add beta
$ fn_git_commit -m 'add beta'
$ cd $TESTTMP
Prepare the hg repo:
$ hg clone gitrepo hgrepo
importing git objects into hg
updating to branch default
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd hgrepo
$ enable gitlookup
$ setconfig gitlookup.useindex=True gitlookup.mapfile=$TESTTMP/hgrepo/.hg/git-mapfile
$ hg log -Gr 'all()' -T '{node} {gitnode} {bookmarks}'
@ 3bb02b6794ddc0b498cdc15f59f2e6724cabfa2f 9497a4ee62e16ee641860d7677cdb2589ea15554 beta
|
o 69982ec78c6dd2f24b3b62f3e2baaa79ab48ed93 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 master
The gitlookup interface is exposed at the wireproto layer. Use another repo to test it:
$ newrepo hgclient
$ hg pull -r _gitlookup_git_7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 $TESTTMP/hgrepo
pulling from $TESTTMP/hgrepo
importing git nodemap from flat mapfile
building git nodemap for 2 commits
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
adding remote bookmark master
$ hg pull -r _gitlookup_git_9497a4ee62e16ee641860d7677cdb2589ea15554 $TESTTMP/hgrepo
pulling from $TESTTMP/hgrepo
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
adding remote bookmark beta
Add new commits to test the index can be incrementally built:
$ cd $TESTTMP/gitrepo
$ echo segma > segma
$ git add segma
$ fn_git_commit -m 'add segma'
Sync git to hg:
$ cd $TESTTMP/hgrepo
$ hg pull
pulling from $TESTTMP/gitrepo
importing git objects into hg
$ hg log -Gr 'all()' -T '{node} {gitnode} {bookmarks}'
o 146e4a0c333d21c93eefe6bf5c01a8d51c5918ab b6d676108afa31dc39efc9c5eb57f19ecbad837b beta
|
@ 3bb02b6794ddc0b498cdc15f59f2e6724cabfa2f 9497a4ee62e16ee641860d7677cdb2589ea15554
|
o 69982ec78c6dd2f24b3b62f3e2baaa79ab48ed93 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 master
Query the new commits:
$ cd $TESTTMP/hgclient
$ hg pull -r _gitlookup_git_b6d676108afa31dc39efc9c5eb57f19ecbad837b $TESTTMP/hgrepo
pulling from $TESTTMP/hgrepo
building git nodemap for 1 commits
searching for changes
adding changesets
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
updating bookmark beta
Test the debugbuildgitnodemap command. This runs the build explicitly instead of on-demand:
$ cd $TESTTMP/hgrepo
$ hg debugbuildgitnodemap
0 new commits are indexed
$ rm -rf .hg/git-nodemap .hg/git-nodemap-lastrev
$ hg debugbuildgitnodemap
importing git nodemap from flat mapfile
building git nodemap for 3 commits
3 new commits are indexed