2016-02-05 09:47:14 +03:00
|
|
|
Setup
|
|
|
|
|
|
|
|
$ PYTHONPATH=$TESTDIR/..:$PYTHONPATH
|
|
|
|
$ export PYTHONPATH
|
|
|
|
|
2015-10-29 04:19:15 +03:00
|
|
|
$ cat >> $HGRCPATH <<EOF
|
|
|
|
> [ui]
|
|
|
|
> ssh = python "$RUNTESTDIR/dummyssh"
|
|
|
|
> username = nobody <no.reply@fb.com>
|
|
|
|
> [extensions]
|
|
|
|
> strip =
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
Setup pushrebase required repo
|
|
|
|
|
|
|
|
$ hg init server
|
|
|
|
$ cd server
|
|
|
|
$ cat >> .hg/hgrc <<EOF
|
|
|
|
> [extensions]
|
2016-02-19 08:32:11 +03:00
|
|
|
> bundle2hooks =
|
2016-02-05 09:47:14 +03:00
|
|
|
> pushrebase =
|
2015-10-29 04:19:15 +03:00
|
|
|
> [pushrebase]
|
|
|
|
> blocknonpushrebase = True
|
|
|
|
> EOF
|
|
|
|
$ echo a > a && hg commit -Aqm a
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
$ hg clone -q server client
|
|
|
|
$ cd client
|
|
|
|
$ echo b >> a && hg commit -Aqm b
|
|
|
|
$ hg book master
|
|
|
|
|
|
|
|
Non-pushrebase pushes should be rejected
|
|
|
|
|
|
|
|
$ hg push
|
2016-01-08 05:30:24 +03:00
|
|
|
pushing to $TESTTMP/server (glob)
|
2015-10-29 04:19:15 +03:00
|
|
|
searching for changes
|
|
|
|
error: prechangegroup.blocknonpushrebase hook failed: this repository requires that you push using 'hg push --to'
|
|
|
|
abort: this repository requires that you push using 'hg push --to'
|
|
|
|
[255]
|
|
|
|
|
|
|
|
$ hg push -f
|
2016-01-08 05:30:24 +03:00
|
|
|
pushing to $TESTTMP/server (glob)
|
2015-10-29 04:19:15 +03:00
|
|
|
searching for changes
|
|
|
|
error: prechangegroup.blocknonpushrebase hook failed: this repository requires that you push using 'hg push --to'
|
|
|
|
abort: this repository requires that you push using 'hg push --to'
|
|
|
|
[255]
|
|
|
|
|
|
|
|
$ hg push -B master
|
2016-01-08 05:30:24 +03:00
|
|
|
pushing to $TESTTMP/server (glob)
|
2015-10-29 04:19:15 +03:00
|
|
|
searching for changes
|
|
|
|
error: prechangegroup.blocknonpushrebase hook failed: this repository requires that you push using 'hg push --to'
|
|
|
|
abort: this repository requires that you push using 'hg push --to'
|
|
|
|
[255]
|
|
|
|
|
|
|
|
Pushrebase pushes should be allowed
|
|
|
|
|
2016-02-19 08:32:11 +03:00
|
|
|
$ hg push --config 'extensions.bundle2hooks=' --config 'extensions.pushrebase=' --to master -B master
|
2016-01-08 05:30:24 +03:00
|
|
|
pushing to $TESTTMP/server (glob)
|
2015-10-29 04:19:15 +03:00
|
|
|
searching for changes
|
2016-09-21 17:45:25 +03:00
|
|
|
pushing 1 changset:
|
2015-10-29 04:19:18 +03:00
|
|
|
1846eede8b68 b
|
2015-10-29 04:19:15 +03:00
|
|
|
exporting bookmark master
|
|
|
|
|
|
|
|
Bookmark pushes should not be affected by the block
|
|
|
|
|
2016-01-08 05:30:24 +03:00
|
|
|
$ hg book -r ".^" master -f
|
2015-10-29 04:19:15 +03:00
|
|
|
$ hg push -B master
|
2016-01-08 05:30:24 +03:00
|
|
|
pushing to $TESTTMP/server (glob)
|
2015-10-29 04:19:15 +03:00
|
|
|
searching for changes
|
|
|
|
no changes found
|
|
|
|
updating bookmark master
|
|
|
|
[1]
|
|
|
|
$ hg -R ../server log -T '{rev} {bookmarks}' -G
|
|
|
|
o 1
|
|
|
|
|
|
|
|
|
@ 0 master
|
|
|
|
|