Mercurial > public > mercurial-scm > hg-stable
diff tests/test-bundle2-exchange.t @ 26566:58880acd2369
bundle2: allow lazily acquiring the lock
In the external pushrebase extension, it is valuable to be able to do some work
without taking the lock (like running expensive hooks). This enables
significantly higher commit throughput.
This patch adds an option to lazily acquire the lock. It means that all bundle2
part handlers that require writing to the repo must first call
op.gettransction(), when in this mode.
author | Durham Goode <durham@fb.com> |
---|---|
date | Mon, 05 Oct 2015 16:19:54 -0700 |
parents | e78a80f8f51e |
children | 56b2bcea2529 |
line wrap: on
line diff
--- a/tests/test-bundle2-exchange.t Tue Oct 06 14:42:29 2015 -0700 +++ b/tests/test-bundle2-exchange.t Mon Oct 05 16:19:54 2015 -0700 @@ -7,6 +7,7 @@ enable obsolescence + $ cp $HGRCPATH $TESTTMP/hgrc.orig $ cat > $TESTTMP/bundle2-pushkey-hook.sh << EOF > echo pushkey: lock state after \"\$HG_NAMESPACE\" > hg debuglock @@ -897,3 +898,47 @@ abort: Clown phase push failed [255] +Test lazily acquiring the lock during unbundle + $ cp $TESTTMP/hgrc.orig $HGRCPATH + $ cat >> $HGRCPATH <<EOF + > [ui] + > ssh=python "$TESTDIR/dummyssh" + > EOF + + $ cat >> $TESTTMP/locktester.py <<EOF + > import os + > from mercurial import extensions, bundle2, util + > def checklock(orig, repo, *args, **kwargs): + > if repo.svfs.lexists("lock"): + > raise util.Abort("Lock should not be taken") + > return orig(repo, *args, **kwargs) + > def extsetup(ui): + > extensions.wrapfunction(bundle2, 'processbundle', checklock) + > EOF + + $ hg init lazylock + $ cat >> lazylock/.hg/hgrc <<EOF + > [extensions] + > locktester=$TESTTMP/locktester.py + > EOF + + $ hg clone -q ssh://user@dummy/lazylock lazylockclient + $ cd lazylockclient + $ touch a && hg ci -Aqm a + $ hg push + pushing to ssh://user@dummy/lazylock + searching for changes + abort: Lock should not be taken + [255] + + $ cat >> ../lazylock/.hg/hgrc <<EOF + > [experimental] + > bundle2lazylocking=True + > EOF + $ hg push + 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