sapling/tests/test-remotenames-on-and-off.t
Ryan McElroy 2e0e2f49f6 remotenames: do not expect repo._remotenames to be set unconditionally
Summary:
There are cases when a local repo communicates to another local repo
where one of the repos has remotenames enabled and the other does not that lead
to crashes. We fix these cases by checking repo objects for _remotenames before
accessing that member variables.

Differential Revision: D7023300

fbshipit-source-id: e4df06671bfb8291f50c01b53750ccaa3f9df968
2018-04-13 21:51:13 -07:00

74 lines
1.3 KiB
Perl

Set up global extensions
$ cat >> $HGRCPATH <<EOF
> [extensions]
> rebase=
> EOF
Create a repo without remotenames
$ hg init off
$ cd off
$ echo a > a
$ hg ci -qAm a
$ cd ..
Clone repo and turn remotenames on
$ hg clone off on
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cat >> on/.hg/hgrc <<EOF
> [extensions]
> remotenames=
> EOF
Ensure no crashes when working from repo with remotenames on
$ hg -R off bookmark foo
$ cd on
$ hg pull
pulling from $TESTTMP/off
searching for changes
no changes found
$ hg push --to bar --create
pushing rev cb9a9f314b8b to destination $TESTTMP/off bookmark bar
searching for changes
no changes found
exporting bookmark bar
[1]
$ hg pull --rebase
pulling from $TESTTMP/off
searching for changes
no changes found
$ cd ..
Check for crashes when working from repo with remotenames off
$ cd off
$ hg pull ../on
pulling from ../on
searching for changes
no changes found
$ cat >> .hg/hgrc <<EOF
> [paths]
> default = $TESTTMP/on
> EOF
$ hg pull
pulling from $TESTTMP/on
searching for changes
no changes found
$ hg push
pushing to $TESTTMP/on
searching for changes
no changes found
[1]
$ hg pull --rebase
pulling from $TESTTMP/on
searching for changes
no changes found