Commit Graph

18 Commits

Author SHA1 Message Date
Thomas Arendsen Hein
1a74aebc73 Work around problem where 'del os.environ["FOO"]' doesn't update environment.
test-hook failed since changeset f4d1d9e93f1a because of this on Solaris 8.
2007-04-19 13:04:26 +02:00
Alexis S. L. Carvalho
c035cb5e84 test-hook: use printenv.py 2007-03-26 23:49:58 -03:00
Alexis S. L. Carvalho
6dc09d1834 Fix hg showconfig traceback with values that aren't strings 2007-02-15 10:15:08 -02:00
Alexis S. L. Carvalho
20406a3e01 Handle functions as the value of a hooks.<name> config variable
This should make it easier for extensions to add a hook when
they're loaded.
2007-02-09 03:48:28 -02:00
Vadim Gelfer
0778999161 hooks: add url to changegroup, incoming, prechangegroup, pretxnchangegroup hooks
all repository classes now have url() method that returns url of repo.
2006-07-25 13:50:32 -07:00
Vadim Gelfer
e5df462a15 deprecate 'update -m'. use 'merge' instead. 2006-05-14 21:07:34 -07:00
Vadim Gelfer
1f1118a083 hooks: add preupdate and update hooks.
preupdate run before working dir updated. can prevent update.
update run after working dir updated.
2006-05-11 10:14:48 -07:00
Vadim Gelfer
c0d2c42c9f deprecate undo command, replace with rollback command. 2006-05-08 14:19:05 -07:00
Vadim Gelfer
41eb4e2c6e reverse sense of return value from python hooks.
old scheme (False/None/0/'' == fail) made coding style
unnatural, did not allow use of mercurial commands as hooks.

new scheme (False/None/0 == pass) is pythonic, does not require peculiar
"return True" at ends of hooks, allows hooks like this:

[hooks]
# update working dir after push into this repo
changegroup.update = python:mercurial.commands.update
2006-05-08 10:59:58 -07:00
Thomas Arendsen Hein
cdfafa43cf Applied $PWD fix (changeset bf1fa3097e92) to tests/test-hook, too. 2006-04-30 19:30:59 +02:00
Vadim Gelfer
2607813e53 support hooks written in python.
to write hook in python, create module with hook function inside.
make sure mercurial can import module (put it in $PYTHONPATH or load it
as extension).  hook function should look like this:

def myhook(ui, repo, hooktype, **kwargs):
   if hook_passes:
      return True
   elif hook_explicitly_fails:
      return False
   elif some_other_failure:
      import util
      raise util.Abort('helpful failure message')
   else:
      return
      # implicit return of None makes hook fail!

then in .hgrc, add hook with "python:" prefix:

[hooks]
commit = python:mymodule.myhook
2006-04-28 15:50:22 -07:00
Thomas Arendsen Hein
1b244c77c7 Use 'hg ci -d "1000000 0"' in tests to circumvent problem with leading zero.
Some systems show "Thu Jan 01" instead of "Thu Jan  1", which breaks tests.
Using "1000000" yields "Mon Jan 12 13:46:40 1970", which looks the same on
all systems.
2006-03-13 13:05:41 +01:00
Vadim Gelfer
d1f78f49f0 add preoutgoing and outgoing hooks.
preoutgoing lets prevent pull over http or ssh.
outgoing lets notify after pull.
2006-02-17 08:26:21 -08:00
Vadim Gelfer
b843092d88 tests for new hooks. fix things i found when writing tests. 2006-02-16 09:56:31 -08:00
Matt Mackall
16d3876ce7 Change test-hook to test multiple hooks 2005-10-29 13:45:01 -07:00
Thomas Arendsen Hein
f9e80dc2e8 Don't use 'set -x', fix exports, sed and hexdump usage for Solaris. 2005-07-29 15:19:43 +01:00
mpm@selenic.com
3a08ca5eaa Update tests to use commit -m and default -u
manifest hash: 6e4385453843031a712005a320d6000595b40d05
2005-07-21 15:05:17 -05:00
mpm@selenic.com
1bbff51e92 Add initial hook support
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Add initial hook support

This adds the basic hook code as well as pre and post-commit hooks.
Argument passing is by environment variable key/value pairs so that
extra data can be passed over time. File lists will generally not be
passed to hooks as these can be extremely long (>1M).

manifest hash: 45cf9bab432782c391bc9c1c048c84cc75d52740
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCwOukywK+sNU5EO8RAsVsAJ9QipR2aKRSSvoRNo+3If6JddUDkwCgkZrM
KEmZpUOxhNHqezFVrHDRTjE=
=aedm
-----END PGP SIGNATURE-----
2005-06-27 22:18:12 -08:00