Mercurial > hg
comparison tests/test-hook.t @ 27228:10695f8f3323 stable
dirstate: don't write repo.currenttransaction to repo.dirstate if repo
is None (issue4983)
Some hooks, such as post-init and post-clone, do not get a repo parameter in
their environment. If there is no repo, there is no repo.currenttransaction();
attempting to retrieve it anyway was causing crashes. Now currenttransaction is
only retrieved and written if the repo is not None.
author | Sietse Brouwer <sbbrouwer@gmail.com> |
---|---|
date | Thu, 03 Dec 2015 01:38:21 +0100 |
parents | 10a1a4b3e775 |
children | 42aa0e570eaa |
comparison
equal
deleted
inserted
replaced
27227:f20533623833 | 27228:10695f8f3323 |
---|---|
679 | 679 |
680 $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc | 680 $ echo 'pretxncommit.printtags = python:hooktests.printtags' >> .hg/hgrc |
681 $ hg tag -f foo | 681 $ hg tag -f foo |
682 ['a', 'foo', 'tip'] | 682 ['a', 'foo', 'tip'] |
683 | 683 |
684 post-init hooks must not crash (issue4983) | |
685 This also creates the `to` repo for the next test block. | |
686 | |
687 $ cd .. | |
688 $ cat << EOF >> hgrc-with-post-init-hook | |
689 > [hooks] | |
690 > post-init = printenv.py post-init | |
691 > EOF | |
692 $ HGRCPATH=hgrc-with-post-init-hook hg init to | |
693 post-init hook: HG_ARGS=init to HG_OPTS={'insecure': None, 'remotecmd': '', 'ssh': ''} HG_PATS=['to'] HG_RESULT=0 | |
694 | |
684 new commits must be visible in pretxnchangegroup (issue3428) | 695 new commits must be visible in pretxnchangegroup (issue3428) |
685 | 696 |
686 $ cd .. | |
687 $ hg init to | |
688 $ echo '[hooks]' >> to/.hg/hgrc | 697 $ echo '[hooks]' >> to/.hg/hgrc |
689 $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc | 698 $ echo 'prechangegroup = hg --traceback tip' >> to/.hg/hgrc |
690 $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc | 699 $ echo 'pretxnchangegroup = hg --traceback tip' >> to/.hg/hgrc |
691 $ echo a >> to/a | 700 $ echo a >> to/a |
692 $ hg --cwd to ci -Ama | 701 $ hg --cwd to ci -Ama |