2020-01-31 05:40:49 +03:00
|
|
|
#require py2
|
2012-10-31 04:03:26 +04:00
|
|
|
Load commonly used test logic
|
2018-01-09 17:08:01 +03:00
|
|
|
$ . "$TESTDIR/hggit/testutil"
|
2012-10-31 04:03:26 +04:00
|
|
|
|
2012-10-31 08:01:03 +04:00
|
|
|
$ git init gitrepo
|
2012-09-14 04:49:42 +04:00
|
|
|
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
|
2012-10-31 08:01:03 +04:00
|
|
|
$ cd gitrepo
|
2012-09-10 08:25:59 +04:00
|
|
|
$ echo alpha > alpha
|
|
|
|
$ git add alpha
|
2012-10-31 06:59:20 +04:00
|
|
|
$ fn_git_commit -m 'add alpha'
|
2012-09-10 08:25:59 +04:00
|
|
|
$ echo beta > beta
|
|
|
|
$ git add beta
|
2012-10-31 06:59:20 +04:00
|
|
|
$ fn_git_commit -m 'add beta'
|
2012-09-10 08:25:59 +04:00
|
|
|
|
2016-10-06 11:11:14 +03:00
|
|
|
This commit is called gamma10 so that its hash will have the same initial digit
|
|
|
|
as commit alpha. This lets us test ambiguous abbreviated identifiers.
|
|
|
|
|
|
|
|
$ echo gamma10 > gamma10
|
|
|
|
$ git add gamma10
|
|
|
|
$ fn_git_commit -m 'add gamma10'
|
|
|
|
|
2012-09-10 08:25:59 +04:00
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
$ hg clone gitrepo hgrepo | grep -v '^updating'
|
|
|
|
importing git objects into hg
|
2016-10-06 11:11:14 +03:00
|
|
|
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
2012-09-10 08:25:59 +04:00
|
|
|
$ cd hgrepo
|
|
|
|
$ echo gamma > gamma
|
|
|
|
$ hg add gamma
|
|
|
|
$ hg commit -m 'add gamma'
|
|
|
|
|
2019-08-16 17:08:03 +03:00
|
|
|
Remove the mapfile so we can ensure the gitnode is from the extras not the mapfile.
|
|
|
|
|
|
|
|
$ mv .hg/git-mapfile .hg/git-mapfile-bak
|
2012-09-10 08:25:59 +04:00
|
|
|
$ hg log --template "{rev} {node} {node|short} {gitnode} {gitnode|short}\n"
|
2018-12-06 23:00:57 +03:00
|
|
|
3 f5172ebb976873f9e41d2958e3b665a985128b00 f5172ebb9768
|
|
|
|
2 fedf4edd982fb98273f2255d6b97c892ec208427 fedf4edd982f 7e2a5465ff4e3b992c429bb87a392620a0ac97b7 7e2a5465ff4e
|
|
|
|
1 3bb02b6794ddc0b498cdc15f59f2e6724cabfa2f 3bb02b6794dd 9497a4ee62e16ee641860d7677cdb2589ea15554 9497a4ee62e1
|
|
|
|
0 69982ec78c6dd2f24b3b62f3e2baaa79ab48ed93 69982ec78c6d 7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03 7eeab2ea75ec
|
2019-08-16 17:08:03 +03:00
|
|
|
$ mv .hg/git-mapfile-bak .hg/git-mapfile
|
2012-09-10 08:25:59 +04:00
|
|
|
$ hg log --template "fromgit {rev}\n" --rev "fromgit()"
|
|
|
|
fromgit 0
|
|
|
|
fromgit 1
|
2016-10-06 11:11:14 +03:00
|
|
|
fromgit 2
|
2012-09-10 08:25:59 +04:00
|
|
|
$ hg log --template "gitnode_existsA {rev}\n" --rev "gitnode(9497a4ee62e16ee641860d7677cdb2589ea15554)"
|
|
|
|
gitnode_existsA 1
|
2016-10-06 11:11:14 +03:00
|
|
|
$ hg log --template "gitnode_existsB {rev}\n" --rev "gitnode(7eeab)"
|
2012-09-10 08:25:59 +04:00
|
|
|
gitnode_existsB 0
|
2016-10-06 11:11:14 +03:00
|
|
|
$ hg log --rev "gitnode(7e)"
|
|
|
|
abort: git-mapfile@7e: ambiguous identifier!
|
|
|
|
[255]
|
2012-09-10 08:25:59 +04:00
|
|
|
$ hg log --template "gitnode_notexists {rev}\n" --rev "gitnode(1234567890ab)"
|
2019-12-21 01:13:41 +03:00
|
|
|
|
|
|
|
Try other extensioins that provide "{gitnode}":
|
|
|
|
$ hg log -r 'tip^' --template "{gitnode}\n"
|
|
|
|
7e2a5465ff4e3b992c429bb87a392620a0ac97b7
|
|
|
|
$ hg log -r 'tip^' --template "{gitnode}\n" --config extensions.fbscmquery=
|
|
|
|
7e2a5465ff4e3b992c429bb87a392620a0ac97b7
|
|
|
|
$ hg log -r 'tip^' --template "{gitnode}\n" --config extensions.gitrevset=
|
|
|
|
7e2a5465ff4e3b992c429bb87a392620a0ac97b7
|