mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 17:27:53 +03:00
150798aac8
Summary: Now that we are writing the git hash inside the commit itself, if we are translating from hg to git hash, we should just use that rather than loading the entire map and build a dict and look it up. The performance of this translation will also improve quite a lot. Some small sample benchmarking: ``` suiting@devvm5006:configerator (659199b|remote/master)$ time ~/fbcode/scm/hg/hg log -r master -T '{node} || {gitnode}\n' --config exte nsions.fbconduit=! --config extensions.hggit= 659199bf7c7850ea9ffa9e0ad50eb84597977dea || 69f05aeec13f09c44dd00d2a85fe9d461ba6841e real 0m0.563s user 0m0.004s sys 0m0.007s suiting@devvm5006:configerator (659199b|remote/master)$ time ~/fbcode/scm/hg/hg log -r master -T '{node} || {gitnode}\n' 659199bf7c7850ea9ffa9e0ad50eb84597977dea || 69f05aeec13f09c44dd00d2a85fe9d461ba6841e real 0m14.706s user 0m0.006s sys 0m0.006s ``` Reviewed By: quark-zju Differential Revision: D16833526 fbshipit-source-id: 7d3096649cf24967d13596e70463bc125081ba4f
64 lines
1.8 KiB
Perl
64 lines
1.8 KiB
Perl
Load commonly used test logic
|
|
$ . "$TESTDIR/hggit/testutil"
|
|
|
|
set up a git repo
|
|
$ git init -q gitrepo
|
|
$ cd gitrepo
|
|
$ echo alpha > alpha
|
|
$ git add alpha
|
|
$ fn_git_commit -m 'add alpha'
|
|
$ git checkout -qb beta
|
|
$ echo beta > beta
|
|
$ git add beta
|
|
$ fn_git_commit -m 'add beta'
|
|
$ cd ..
|
|
|
|
pull a branch with the old mapfile
|
|
$ hg init hgrepo
|
|
$ cd hgrepo
|
|
$ echo "[paths]" >> .hg/hgrc
|
|
$ echo "default=$TESTTMP/gitrepo" >> .hg/hgrc
|
|
$ hg pull -r master
|
|
pulling from $TESTTMP/gitrepo
|
|
importing git objects into hg
|
|
$ ls -d .hg/git-mapfile*
|
|
.hg/git-mapfile
|
|
$ hg log -r tip -T '{gitnode}\n'
|
|
7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03
|
|
|
|
pull more commits with the new nodemap
|
|
$ setconfig hggit.indexedlognodemap=True
|
|
$ hg pull -r beta
|
|
pulling from $TESTTMP/gitrepo
|
|
importing git objects into hg
|
|
$ ls -d .hg/git-mapfile*
|
|
.hg/git-mapfile
|
|
.hg/git-mapfile-log
|
|
$ hg log -r 'tip^::tip' -T '{gitnode}\n'
|
|
7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03
|
|
9497a4ee62e16ee641860d7677cdb2589ea15554
|
|
|
|
can still get the mapping without the old map file
|
|
$ mv .hg/git-mapfile .hg/git-mapfile.old
|
|
$ hg log -r 'tip^::tip' -T '{gitnode}\n'
|
|
7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03
|
|
9497a4ee62e16ee641860d7677cdb2589ea15554
|
|
$ mv .hg/git-mapfile.old .hg/git-mapfile
|
|
|
|
can still get the mapping without the nodemap
|
|
$ mv .hg/git-mapfile-log .hg/git-mapfile-log.old
|
|
$ hg log -r 'tip^::tip' -T '{gitnode}\n'
|
|
7eeab2ea75ec1ac0ff3d500b5b6f8a3447dd7c03
|
|
9497a4ee62e16ee641860d7677cdb2589ea15554
|
|
$ mv .hg/git-mapfile-log.old .hg/git-mapfile-log
|
|
|
|
git cleanup cleans nodemap
|
|
$ hg bundle -r tip --base 'tip^' ../mybundle.hg
|
|
1 changesets found
|
|
$ hg debugstrip -r tip --no-backup
|
|
$ hg git-cleanup
|
|
git commit map cleaned
|
|
$ hg unbundle -q ../mybundle.hg
|
|
$ hg log -r tip -T '{gitnode}\n'
|
|
9497a4ee62e16ee641860d7677cdb2589ea15554
|