2014-12-18 00:34:21 +03:00
|
|
|
$ . "$TESTDIR/library.sh"
|
|
|
|
|
|
|
|
# Populate the db with an initial commit
|
|
|
|
|
|
|
|
$ initclient client
|
|
|
|
$ cat >> client/.hg/hgrc <<EOF
|
|
|
|
> [experimental]
|
|
|
|
> bundle2-exp=True
|
|
|
|
> EOF
|
|
|
|
$ cd client
|
|
|
|
$ echo x > x
|
|
|
|
$ hg commit -qAm x
|
|
|
|
$ hg bookmark mybook
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
$ initserver master masterrepo
|
|
|
|
$ cat >> master/.hg/hgrc <<EOF
|
|
|
|
> [experimental]
|
|
|
|
> bundle2-exp=True
|
2015-10-09 23:13:18 +03:00
|
|
|
> bundle2lazylocking=True
|
2014-12-18 00:34:21 +03:00
|
|
|
> EOF
|
|
|
|
$ cd master
|
|
|
|
$ hg log
|
|
|
|
$ hg pull -q ../client
|
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
# Verify bookmarks are not synced if hook returns false
|
|
|
|
|
2015-04-23 01:10:26 +03:00
|
|
|
$ cp master/.hg/hgrc master/.hg/hgrc_good
|
2014-12-18 00:34:21 +03:00
|
|
|
$ cat >> master/.hg/hgrc <<EOF
|
|
|
|
> [hooks]
|
2015-04-23 01:10:26 +03:00
|
|
|
> pretxnclose.abort=false
|
2014-12-18 00:34:21 +03:00
|
|
|
> EOF
|
|
|
|
$ cd client
|
|
|
|
$ echo x >> x
|
|
|
|
$ hg commit -qm x2
|
|
|
|
$ hg push ssh://user@dummy/master
|
|
|
|
pushing to ssh://user@dummy/master
|
|
|
|
searching for changes
|
2015-04-23 01:10:26 +03:00
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|
2014-12-18 00:34:21 +03:00
|
|
|
remote: transaction abort!
|
|
|
|
remote: rollback completed
|
2015-12-03 00:59:20 +03:00
|
|
|
remote: pretxnclose.abort hook exited with status 1
|
|
|
|
abort: push failed on remote
|
2014-12-18 00:34:21 +03:00
|
|
|
[255]
|
2015-04-23 01:10:26 +03:00
|
|
|
$ mv ../master/.hg/hgrc_good ../master/.hg/hgrc
|
2014-12-18 00:34:21 +03:00
|
|
|
$ hg -R ../master bookmarks
|
|
|
|
mybook 0:b292c1e3311f
|
2015-10-09 23:13:18 +03:00
|
|
|
|
|
|
|
$ cd ..
|
|
|
|
|
|
|
|
Test lazily acquiring the lock during unbundle
|
|
|
|
|
|
|
|
$ cat >> $TESTTMP/locktester.py <<EOF
|
|
|
|
> import os
|
|
|
|
> from mercurial import extensions, bundle2, util
|
|
|
|
> def checklock(orig, repo, *args, **kwargs):
|
|
|
|
> if len(repo.heldlocks) > 0:
|
|
|
|
> raise util.Abort("Lock should not be taken")
|
|
|
|
> return orig(repo, *args, **kwargs)
|
|
|
|
> def extsetup(ui):
|
|
|
|
> extensions.wrapfunction(bundle2, 'processbundle', checklock)
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ initserver lazylock lazylock
|
|
|
|
$ cat >> lazylock/.hg/hgrc <<EOF
|
|
|
|
> [extensions]
|
|
|
|
> locktester=$TESTTMP/locktester.py
|
|
|
|
> EOF
|
|
|
|
|
|
|
|
$ initclient lazylockclient
|
|
|
|
$ cd lazylockclient
|
|
|
|
$ touch a && hg ci -Aqm a
|
|
|
|
|
|
|
|
- Push with lazy locking off (hook fails)
|
|
|
|
$ hg push ssh://user@dummy/lazylock
|
|
|
|
pushing to ssh://user@dummy/lazylock
|
|
|
|
searching for changes
|
2015-12-03 00:59:20 +03:00
|
|
|
remote: Lock should not be taken
|
|
|
|
abort: push failed on remote
|
2015-10-09 23:13:18 +03:00
|
|
|
[255]
|
|
|
|
|
|
|
|
- Push with lazy locking on (hook passes)
|
|
|
|
$ cat >> ../lazylock/.hg/hgrc <<EOF
|
|
|
|
> [experimental]
|
|
|
|
> bundle2lazylocking=True
|
|
|
|
> EOF
|
|
|
|
$ hg push ssh://user@dummy/lazylock
|
|
|
|
pushing to ssh://user@dummy/lazylock
|
|
|
|
searching for changes
|
|
|
|
remote: adding changesets
|
|
|
|
remote: adding manifests
|
|
|
|
remote: adding file changes
|
|
|
|
remote: added 1 changesets with 1 changes to 1 files
|