2019-11-15 21:45:00 +03:00
|
|
|
$ setconfig treemanifest.flatcompat=False
|
2020-06-11 03:33:43 +03:00
|
|
|
$ configure mutation-norecord
|
2017-05-10 23:48:34 +03:00
|
|
|
|
|
|
|
$ . "$TESTDIR/library.sh"
|
|
|
|
|
|
|
|
$ cat >> $TESTTMP/helper.sh <<EOF
|
|
|
|
> initclients() {
|
|
|
|
> for i in {0..9} ; do
|
|
|
|
> hg init client\$i
|
|
|
|
> cat >> client\$i/.hg/hgrc <<EOF2
|
|
|
|
> [paths]
|
|
|
|
> default=ssh://user@dummy/master
|
2019-10-28 18:42:32 +03:00
|
|
|
> [treemanifest]
|
|
|
|
> sendtrees=True
|
2017-05-10 23:48:34 +03:00
|
|
|
> EOF2
|
|
|
|
> hg -R client\$i pull -q
|
|
|
|
> hg -R client\$i up -q master
|
|
|
|
> echo >> client\$i/\$i
|
|
|
|
> hg -R client\$i commit -Aqm "add $i"
|
|
|
|
> done
|
|
|
|
> }
|
|
|
|
> pushclients() {
|
|
|
|
> for i in {0..9} ; do
|
2018-06-25 18:35:39 +03:00
|
|
|
> hg -R client\$i push --to master -B master >/dev/null 2>/dev/null &
|
2017-05-10 23:48:34 +03:00
|
|
|
> done
|
|
|
|
> wait
|
|
|
|
> }
|
|
|
|
> EOF
|
|
|
|
$ . "$TESTTMP/helper.sh"
|
|
|
|
|
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
|
|
> [extensions]
|
2018-01-09 23:59:00 +03:00
|
|
|
> pushrebase=
|
2017-05-10 23:48:34 +03:00
|
|
|
> [experimental]
|
|
|
|
> bundle2lazylocking=True
|
|
|
|
> [remotefilelog]
|
|
|
|
> reponame=master
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
Test that multiple fighting pushes result in the correct flat and tree manifests
|
|
|
|
|
|
|
|
$ hg init master
|
|
|
|
$ cd master
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [extensions]
|
2018-01-09 23:59:00 +03:00
|
|
|
> treemanifest=
|
2017-05-10 23:48:34 +03:00
|
|
|
> [treemanifest]
|
|
|
|
> server=True
|
2017-05-11 01:30:49 +03:00
|
|
|
> # Sleep gives all the hg serve processes time to load the original repo
|
|
|
|
> # state. Otherwise there are race with loading hg server while pushes are
|
|
|
|
> # happening.
|
2019-10-28 18:42:32 +03:00
|
|
|
> [remotefilelog]
|
|
|
|
> server=True
|
2017-05-11 01:30:49 +03:00
|
|
|
> [hooks]
|
treemanifest: make tests more lenient and fail more descriptively
Summary:
The test-treemanifest-pushrebase test was failing in our continuous integration
environment with a perplexing error:
```
$ pushclients
+ abort: exporting bookmark master failed!
```
(plus some additional failures later)
I thought this should not be possible because of the redirect, but it turns out
that the order of the redirects matters:
`>/dev/null 2>&1` redirects both stderr and stdout to `/dev/null`, but
`2>&1 >/dev/null` redirects stdout to /dev/null and stderr to stdout
(TIL)
However, this was the only clue to the issue that was going on, and so it's
better to actually keep the error around, if one occurs, so I removed the 2>&1
redirect altogether.
Furthermore, the test was failing with various clients failing to push.
To increase the chance of this succeeding, I'm bumping the sleep time. Ideally,
we should wait for the server to be "ready", but I'm not certain what that means
or how to test and would like to discuss to figure it out. This hopefully will
unblock the continuous integration for now.
Test Plan: Test still passes locally; wait to see if it passes in automation.
Reviewers: #fbhgext, mitrandir
Reviewed By: #fbhgext, mitrandir
Differential Revision: https://phab.mercurial-scm.org/D415
2017-08-16 18:12:04 +03:00
|
|
|
> prepushrebase.sleep=sleep 1
|
2017-05-10 23:48:34 +03:00
|
|
|
> EOF
|
|
|
|
$ mkdir subdir/
|
|
|
|
$ touch subdir/a && hg ci -Aqm subdir/a
|
|
|
|
$ hg book master
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
$ initclients
|
2019-11-15 21:45:00 +03:00
|
|
|
fetching tree '' b25ede39b5168327f0596fcf74d1ff53842bad2a
|
2017-06-20 21:08:15 +03:00
|
|
|
2 trees fetched over * (glob)
|
2017-05-10 23:48:34 +03:00
|
|
|
$ pushclients
|
|
|
|
|
|
|
|
$ cd master
|
|
|
|
$ hg debugdata .hg/store/00manifesttree.i 10
|
|
|
|
0\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
1\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
2\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
3\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
4\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
5\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
6\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
7\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
8\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
9\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
subdir\x008515d4bfda768e04af4c13a69a72e28c7effbea7t (esc)
|
|
|
|
$ hg debugdata -m 10
|
|
|
|
0\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
1\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
2\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
3\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
4\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
5\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
6\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
7\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
8\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
|
|
|
9\x00cc31c19aff7dbbbed214ec304839a8003fdd0b10 (esc)
|
2019-10-28 18:42:32 +03:00
|
|
|
subdir\x008515d4bfda768e04af4c13a69a72e28c7effbea7t (esc)
|
2017-11-07 04:26:08 +03:00
|
|
|
|
|
|
|
Test that pushrebase hooks can access the commit data
|
|
|
|
$ cat >> $TESTTMP/cathook.sh <<EOF
|
|
|
|
> #! /bin/sh
|
|
|
|
> echo "\$(hg cat -r \$HG_NODE subdir/a)"
|
|
|
|
> exit 1
|
|
|
|
> EOF
|
|
|
|
$ chmod a+x $TESTTMP/cathook.sh
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [hooks]
|
|
|
|
> prepushrebase.cat=$TESTTMP/cathook.sh
|
|
|
|
> EOF
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
$ hg clone -q ssh://user@dummy/master hook_client
|
|
|
|
$ cd hook_client
|
|
|
|
$ hg up -q master
|
|
|
|
$ echo baz >> subdir/a
|
|
|
|
$ hg commit -Aqm 'hook commit'
|
|
|
|
|
2017-11-07 21:24:07 +03:00
|
|
|
- Push with sendtrees
|
|
|
|
$ hg push --to master -B master --config treemanifest.sendtrees=True
|
|
|
|
pushing to ssh://user@dummy/master
|
|
|
|
searching for changes
|
|
|
|
remote: prepushrebase.cat hook exited with status 1
|
|
|
|
abort: push failed on remote
|
2020-02-28 04:51:13 +03:00
|
|
|
remote: baz
|
2017-11-07 21:24:07 +03:00
|
|
|
[255]
|
2019-02-27 20:49:36 +03:00
|
|
|
|
|
|
|
- Disable the hook
|
|
|
|
$ cat >> ../master/.hg/hgrc <<EOF
|
|
|
|
> [hooks]
|
|
|
|
> prepushrebase.cat=true
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
Push an empty commit with no trees
|
|
|
|
$ hg up -q '.^'
|
|
|
|
$ hg commit --config ui.allowemptycommit=True -m "Empty commit"
|
|
|
|
$ hg push --to master --rev . --config treemanifest.sendtrees=True
|
|
|
|
pushing to ssh://user@dummy/master
|
|
|
|
searching for changes
|
|
|
|
remote: pushing 1 changeset:
|
|
|
|
remote: * Empty commit (glob)
|