sapling/tests/test-git-getmeta.t

104 lines
3.6 KiB
Perl
Raw Normal View History

add a command and server-side support to fetch git metadata Summary: When a machine is newly set up, it needs to have the git mapfile available. Generating it from scratch is prohibitively slow for large repos like `configerator`, so instead add a command that can download the entire git metadata from a server that has it. This is a temporary hack while I work on a real fix to upstream to hg-git. A real fix would be - part of hg-git - not send the entire git metadata over, just the bits that are needed based on a common/heads computation - be dependent on bundle2 - (probably) be part of the pull operation, not a separate command - be configurable with an option This isn't part of hg-git, even in a private branch, to emphasize its temporary nature. `gitlookup` might also not be the best fit, but I want to avoid adding yet another extension for a temporary hack. Test Plan: Ran the following commands. Note that the current version of `hg` deployed to devservers is broken, so we need to deploy an updated hg before enabling this. These commands were tested against 1ced7c762592 (in `fbandroid-hg`, with `gitlookup` enabled on both ends and the remotefilelog fix in D1341059) hg gitgetmeta ../fbandroid-from-git Saw that 3 files were written out. hg gitgetmeta ssh://localhost//data/users/sid0/fbandroid-from-git Saw that 3 files were written out. Reviewers: dschleimer, davidsp, akushner, durham, pyd Reviewed By: pyd Differential Revision: https://phabricator.fb.com/D1341166 Tasks: 3751836
2014-05-21 09:32:54 +04:00
$ echo "[extensions]" >> $HGRCPATH
$ echo "gitlookup = $TESTDIR/../hgext3rd/gitlookup.py" >> $HGRCPATH
$ echo "gitrevset = $TESTDIR/../hgext3rd/gitrevset.py" >> $HGRCPATH
$ echo '[ui]' >> $HGRCPATH
$ echo 'ssh = python "$RUNTESTDIR/dummyssh"' >> $HGRCPATH
add a command and server-side support to fetch git metadata Summary: When a machine is newly set up, it needs to have the git mapfile available. Generating it from scratch is prohibitively slow for large repos like `configerator`, so instead add a command that can download the entire git metadata from a server that has it. This is a temporary hack while I work on a real fix to upstream to hg-git. A real fix would be - part of hg-git - not send the entire git metadata over, just the bits that are needed based on a common/heads computation - be dependent on bundle2 - (probably) be part of the pull operation, not a separate command - be configurable with an option This isn't part of hg-git, even in a private branch, to emphasize its temporary nature. `gitlookup` might also not be the best fit, but I want to avoid adding yet another extension for a temporary hack. Test Plan: Ran the following commands. Note that the current version of `hg` deployed to devservers is broken, so we need to deploy an updated hg before enabling this. These commands were tested against 1ced7c762592 (in `fbandroid-hg`, with `gitlookup` enabled on both ends and the remotefilelog fix in D1341059) hg gitgetmeta ../fbandroid-from-git Saw that 3 files were written out. hg gitgetmeta ssh://localhost//data/users/sid0/fbandroid-from-git Saw that 3 files were written out. Reviewers: dschleimer, davidsp, akushner, durham, pyd Reviewed By: pyd Differential Revision: https://phabricator.fb.com/D1341166 Tasks: 3751836
2014-05-21 09:32:54 +04:00
Set up the hg-git files
$ hg init repo1
$ cd repo1
$ touch a
$ hg add a
$ hg ci -ma
$ hg log -r . --template '{node}\n'
3903775176ed42b1458a6281db4a0ccf4d9f287a
$ cd .hg
$ echo "ffffffffffffffffffffffffffffffffffffffff 3903775176ed42b1458a6281db4a0ccf4d9f287a" > git-mapfile
$ echo 'ffffffffffffffffffffffffffffffffffffffff default/master' > git-remote-refs
$ echo 'ffffffffffffffffffffffffffffffffffffffff 0.1' > git-tags
$ echo '[gitlookup]' >> hgrc
$ echo "mapfile = $TESTTMP/repo1/.hg/git-mapfile" >> hgrc
add a command and server-side support to fetch git metadata Summary: When a machine is newly set up, it needs to have the git mapfile available. Generating it from scratch is prohibitively slow for large repos like `configerator`, so instead add a command that can download the entire git metadata from a server that has it. This is a temporary hack while I work on a real fix to upstream to hg-git. A real fix would be - part of hg-git - not send the entire git metadata over, just the bits that are needed based on a common/heads computation - be dependent on bundle2 - (probably) be part of the pull operation, not a separate command - be configurable with an option This isn't part of hg-git, even in a private branch, to emphasize its temporary nature. `gitlookup` might also not be the best fit, but I want to avoid adding yet another extension for a temporary hack. Test Plan: Ran the following commands. Note that the current version of `hg` deployed to devservers is broken, so we need to deploy an updated hg before enabling this. These commands were tested against 1ced7c762592 (in `fbandroid-hg`, with `gitlookup` enabled on both ends and the remotefilelog fix in D1341059) hg gitgetmeta ../fbandroid-from-git Saw that 3 files were written out. hg gitgetmeta ssh://localhost//data/users/sid0/fbandroid-from-git Saw that 3 files were written out. Reviewers: dschleimer, davidsp, akushner, durham, pyd Reviewed By: pyd Differential Revision: https://phabricator.fb.com/D1341166 Tasks: 3751836
2014-05-21 09:32:54 +04:00
$ cd ../..
$ hg clone repo1 repo2 -q
$ cd repo2
$ hg gitgetmeta -v
getting git metadata from $TESTTMP/repo1
writing .hg/git-mapfile
writing .hg/git-remote-refs
writing .hg/git-tags
wrote 3 files (183 bytes)
$ cat .hg/git-mapfile
ffffffffffffffffffffffffffffffffffffffff 3903775176ed42b1458a6281db4a0ccf4d9f287a
add a command and server-side support to fetch git metadata Summary: When a machine is newly set up, it needs to have the git mapfile available. Generating it from scratch is prohibitively slow for large repos like `configerator`, so instead add a command that can download the entire git metadata from a server that has it. This is a temporary hack while I work on a real fix to upstream to hg-git. A real fix would be - part of hg-git - not send the entire git metadata over, just the bits that are needed based on a common/heads computation - be dependent on bundle2 - (probably) be part of the pull operation, not a separate command - be configurable with an option This isn't part of hg-git, even in a private branch, to emphasize its temporary nature. `gitlookup` might also not be the best fit, but I want to avoid adding yet another extension for a temporary hack. Test Plan: Ran the following commands. Note that the current version of `hg` deployed to devservers is broken, so we need to deploy an updated hg before enabling this. These commands were tested against 1ced7c762592 (in `fbandroid-hg`, with `gitlookup` enabled on both ends and the remotefilelog fix in D1341059) hg gitgetmeta ../fbandroid-from-git Saw that 3 files were written out. hg gitgetmeta ssh://localhost//data/users/sid0/fbandroid-from-git Saw that 3 files were written out. Reviewers: dschleimer, davidsp, akushner, durham, pyd Reviewed By: pyd Differential Revision: https://phabricator.fb.com/D1341166 Tasks: 3751836
2014-05-21 09:32:54 +04:00
$ cat .hg/git-remote-refs
ffffffffffffffffffffffffffffffffffffffff default/master
add a command and server-side support to fetch git metadata Summary: When a machine is newly set up, it needs to have the git mapfile available. Generating it from scratch is prohibitively slow for large repos like `configerator`, so instead add a command that can download the entire git metadata from a server that has it. This is a temporary hack while I work on a real fix to upstream to hg-git. A real fix would be - part of hg-git - not send the entire git metadata over, just the bits that are needed based on a common/heads computation - be dependent on bundle2 - (probably) be part of the pull operation, not a separate command - be configurable with an option This isn't part of hg-git, even in a private branch, to emphasize its temporary nature. `gitlookup` might also not be the best fit, but I want to avoid adding yet another extension for a temporary hack. Test Plan: Ran the following commands. Note that the current version of `hg` deployed to devservers is broken, so we need to deploy an updated hg before enabling this. These commands were tested against 1ced7c762592 (in `fbandroid-hg`, with `gitlookup` enabled on both ends and the remotefilelog fix in D1341059) hg gitgetmeta ../fbandroid-from-git Saw that 3 files were written out. hg gitgetmeta ssh://localhost//data/users/sid0/fbandroid-from-git Saw that 3 files were written out. Reviewers: dschleimer, davidsp, akushner, durham, pyd Reviewed By: pyd Differential Revision: https://phabricator.fb.com/D1341166 Tasks: 3751836
2014-05-21 09:32:54 +04:00
$ cat .hg/git-tags
ffffffffffffffffffffffffffffffffffffffff 0.1
add a command and server-side support to fetch git metadata Summary: When a machine is newly set up, it needs to have the git mapfile available. Generating it from scratch is prohibitively slow for large repos like `configerator`, so instead add a command that can download the entire git metadata from a server that has it. This is a temporary hack while I work on a real fix to upstream to hg-git. A real fix would be - part of hg-git - not send the entire git metadata over, just the bits that are needed based on a common/heads computation - be dependent on bundle2 - (probably) be part of the pull operation, not a separate command - be configurable with an option This isn't part of hg-git, even in a private branch, to emphasize its temporary nature. `gitlookup` might also not be the best fit, but I want to avoid adding yet another extension for a temporary hack. Test Plan: Ran the following commands. Note that the current version of `hg` deployed to devservers is broken, so we need to deploy an updated hg before enabling this. These commands were tested against 1ced7c762592 (in `fbandroid-hg`, with `gitlookup` enabled on both ends and the remotefilelog fix in D1341059) hg gitgetmeta ../fbandroid-from-git Saw that 3 files were written out. hg gitgetmeta ssh://localhost//data/users/sid0/fbandroid-from-git Saw that 3 files were written out. Reviewers: dschleimer, davidsp, akushner, durham, pyd Reviewed By: pyd Differential Revision: https://phabricator.fb.com/D1341166 Tasks: 3751836
2014-05-21 09:32:54 +04:00
$ echo '1111111111111111111111111111111111111111 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' >> ../repo1/.hg/git-mapfile
$ hg gitgetmeta -v
getting git metadata from $TESTTMP/repo1
writing .hg/git-mapfile
writing .hg/git-remote-refs
writing .hg/git-tags
wrote 3 files (265 bytes)
$ cat .hg/git-mapfile
ffffffffffffffffffffffffffffffffffffffff 3903775176ed42b1458a6281db4a0ccf4d9f287a
add a command and server-side support to fetch git metadata Summary: When a machine is newly set up, it needs to have the git mapfile available. Generating it from scratch is prohibitively slow for large repos like `configerator`, so instead add a command that can download the entire git metadata from a server that has it. This is a temporary hack while I work on a real fix to upstream to hg-git. A real fix would be - part of hg-git - not send the entire git metadata over, just the bits that are needed based on a common/heads computation - be dependent on bundle2 - (probably) be part of the pull operation, not a separate command - be configurable with an option This isn't part of hg-git, even in a private branch, to emphasize its temporary nature. `gitlookup` might also not be the best fit, but I want to avoid adding yet another extension for a temporary hack. Test Plan: Ran the following commands. Note that the current version of `hg` deployed to devservers is broken, so we need to deploy an updated hg before enabling this. These commands were tested against 1ced7c762592 (in `fbandroid-hg`, with `gitlookup` enabled on both ends and the remotefilelog fix in D1341059) hg gitgetmeta ../fbandroid-from-git Saw that 3 files were written out. hg gitgetmeta ssh://localhost//data/users/sid0/fbandroid-from-git Saw that 3 files were written out. Reviewers: dschleimer, davidsp, akushner, durham, pyd Reviewed By: pyd Differential Revision: https://phabricator.fb.com/D1341166 Tasks: 3751836
2014-05-21 09:32:54 +04:00
1111111111111111111111111111111111111111 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
$ cd ..
$ hg clone ssh://user@dummy/repo1 repo3 -q
$ cd repo3
$ hg gitgetmeta -v
getting git metadata from ssh://user@dummy/repo1
writing .hg/git-mapfile
writing .hg/git-remote-refs
writing .hg/git-tags
wrote 3 files (265 bytes)
$ cat .hg/git-mapfile
ffffffffffffffffffffffffffffffffffffffff 3903775176ed42b1458a6281db4a0ccf4d9f287a
1111111111111111111111111111111111111111 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
$ cat .hg/git-remote-refs
ffffffffffffffffffffffffffffffffffffffff default/master
$ cat .hg/git-tags
ffffffffffffffffffffffffffffffffffffffff 0.1
Change a file upstream and see that it gets reflected here
$ echo '2222222222222222222222222222222222222222 dddddddddddddddddddddddddddddddddddddddd' >> ../repo1/.hg/git-mapfile
$ echo 'releases/foo1 foo1' >> ../repo1/.hg/git-named-branches
$ hg gitgetmeta -v
getting git metadata from ssh://user@dummy/repo1
writing .hg/git-mapfile
writing .hg/git-named-branches
writing .hg/git-remote-refs
writing .hg/git-tags
wrote 4 files (366 bytes)
$ cat .hg/git-mapfile
ffffffffffffffffffffffffffffffffffffffff 3903775176ed42b1458a6281db4a0ccf4d9f287a
1111111111111111111111111111111111111111 eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
2222222222222222222222222222222222222222 dddddddddddddddddddddddddddddddddddddddd
$ cd ..
$ hg clone ssh://user@dummy/repo1 repo-ssh -q
$ cd repo-ssh
Check that our revset and template mappings work
$ hg log -r "gitnode(ffffffffffffffffffffffffffffffffffffffff)" --template "{node}\n"
3903775176ed42b1458a6281db4a0ccf4d9f287a
$ hg log -r 'gffffffffffffffffffffffffffffffffffffffff' --template "{node}\n"
3903775176ed42b1458a6281db4a0ccf4d9f287a
$ hg log -r . --template "{gitnode}\n"
ffffffffffffffffffffffffffffffffffffffff
$ touch b
$ hg add b
$ hg ci -mb
$ hg log -r . --template "{gitnode}\n"