| 1 |
Checking how hg behaves when one side of a pull/push doesn't support |
| 2 |
some capability (because it's running an older hg version, usually). |
| 3 |
|
| 4 |
$ hg init repo1 |
| 5 |
$ cd repo1 |
| 6 |
$ echo a > a; hg add -q a; hg commit -q -m a |
| 7 |
$ hg bookmark a |
| 8 |
$ hg clone -q . ../repo2 |
| 9 |
$ cd ../repo2 |
| 10 |
|
| 11 |
$ touch $TESTTMP/disable-lookup.py |
| 12 |
$ disable_cap() { |
| 13 |
> rm -f $TESTTMP/disable-lookup.pyc # pyc caching is buggy |
| 14 |
> cat <<EOF > $TESTTMP/disable-lookup.py |
| 15 |
> from mercurial import extensions, wireprotov1server |
| 16 |
> def wcapabilities(orig, *args, **kwargs): |
| 17 |
> cap = orig(*args, **kwargs) |
| 18 |
> cap.remove(b'$1') |
| 19 |
> return cap |
| 20 |
> extensions.wrapfunction(wireprotov1server, '_capabilities', wcapabilities) |
| 21 |
> EOF |
| 22 |
> } |
| 23 |
$ cat >> ../repo1/.hg/hgrc <<EOF |
| 24 |
> [extensions] |
| 25 |
> disable-lookup = $TESTTMP/disable-lookup.py |
| 26 |
> EOF |
| 27 |
|
| 28 |
$ hg pull ssh://user@dummy/repo1 -r tip -B a |
| 29 |
pulling from ssh://user@dummy/repo1 |
| 30 |
no changes found |
| 31 |
|
| 32 |
$ disable_cap lookup |
| 33 |
$ hg pull ssh://user@dummy/repo1 -r tip -B a |
| 34 |
pulling from ssh://user@dummy/repo1 |
| 35 |
abort: other repository doesn't support revision lookup, so a rev cannot be specified. |
| 36 |
[255] |
| 37 |
|
| 38 |
$ disable_cap pushkey |
| 39 |
$ hg pull ssh://user@dummy/repo1 -r tip -B a |
| 40 |
pulling from ssh://user@dummy/repo1 |
| 41 |
abort: remote bookmark a not found! |
| 42 |
[10] |