Commit Graph

37 Commits

Author SHA1 Message Date
Sune Foldager
2369132b4b run commit and update hooks after command completion (issue1827)
Previously, the working dir state hadn't been written when these
hooks were invoked, so external commands couldn't see all changes.
2010-02-17 15:43:21 +01:00
Bryan O'Sullivan
4035f1dfaa Make it possible to debug failed hook imports via use of --traceback
Prior to this change, if a Python hook module failed to load (e.g. due
to an import error or path problem), it was impossible to figure out
why the error occurred, because the ImportErrors that got raised were
caught but never displayed.

If run with --traceback or ui.traceback=True, hg now prints tracebacks
of both of the ImportError instances that get raised before it bails.
2009-11-12 14:05:52 -08:00
Adrian Buehlmann
a482b04850 hg.clone: report branch name on update 2009-10-16 23:57:34 +02:00
Mads Kiilerich
a37424ba87 test-hooks: Don't hide the value of HG_PENDING
Hiding the value of HG_PENDING made it less obvious what was going on in case
of test failure
2009-08-19 00:45:24 +02:00
Henri Wiechers
712ac310c2 test python hook configured with python:[file]:[hook] syntax
Adds a test for python hooks configured with python:[file]:[hook] syntax
in .hgrc. Increases the test coverage for mercurial/hook from 92% (79/85)
to 96% (82/85).
2009-06-26 14:42:05 +02:00
Fred Wulff
affad77f81 Add (pre)outgoing hooks for local clones. 2009-04-17 16:34:43 -07:00
Matt Mackall
2f9b02c62d replace util.sort with sorted built-in
This is marginally faster for small and moderately-sized lists
2009-04-26 16:50:44 -05:00
Matt Mackall
cb4d50ff04 Introduce HG_PREPEND to solve pretxn races
- add writepending to flush delayed writes to separate file
- add support in hooks for lazy evaluation of callable parameters
- add HG_PENDING to pretxn hooks
  - call writepending if hook is used
  - pass repo root to hook environment
- if HG_PENDING = repo root, we're in pretxn hook
  - read pending data to make pending changesets visible
- filter HG_PENDING in tests/printenv.py
2009-02-16 19:35:07 -06:00
Gilles Moris
5d85996f85 Have verbose and debug flag print the changeset rev and hash when committing.
Besides updating the tests output, I had to push back at the end the test for
issue1193 in test-commit, solved by cset 31a0a36d6d95, because it was using the
current date for commit and was randomizing the subsequent hash.
2008-08-22 22:32:53 +02:00
Patrick Mezard
a8ac103268 Backed out changeset 0f390189b058
Replace this change with a better one.
2008-08-24 22:13:39 +02:00
Gilles Moris
4c144a2f64 Have verbose flag print the changeset hash when committing 2008-08-22 13:25:35 +02:00
Adrian Buehlmann
153675561e clone: print "updating working directory" status message
With this change, "hg clone" looks like this:

% hg clone http://example.com/repo/big big
requesting all changes
adding changesets
adding manifests
adding file changes
added XXX changesets with XXX changes to XXX files
updating working directory
XXX files updated, XXX files merged, XXX files removed, XXX files unresolved

So the user sees

% hg clone http://example.com/repo/big big
requesting all changes
adding changesets
adding manifests
adding file changes
added XXX changesets with XXX changes to XXX files
updating working directory

while Mercurial is writing to disk to populate the working directory

With this change, "hg clone" looks like this:

% hg clone big big-work
updating working directory
XXX files updated, XXX files merged, XXX files removed, XXX files unresolved
2008-03-21 14:52:24 +01:00
Dirkjan Ochtman
3e3b0d62eb warn about new heads on commit (issue842) 2008-03-21 11:06:02 +01:00
John Coomes
5c790a2f5f hg tag: run tag hook just once 2007-12-18 12:45:30 -08:00
Matt Mackall
3fdaa5a42e Use a weakref for recursive transactions 2007-07-21 16:02:10 -05:00
Bryan O'Sullivan
39c3672fd0 tag: handle .hgtags and .hg/localtags with missing final newline (issue 601)
This also fixes an asymmetry bug in which we called the pretag hook if we
were going to create a local tag, but didn't call the tag hook afterwards.
2007-07-16 20:15:03 -07:00
Patrick Mezard
82fd511346 printenv: filter empty environment variables for portability. 2007-06-20 22:06:37 +02:00
Thomas Arendsen Hein
3dcf92c53d Use printenv.py for pre/post-command-hooks (fixes tests on Solaris, too) 2007-06-19 08:17:55 +02:00
Matt Mackall
c61bc27ccc dispatch: add generic pre- and post-command hooks 2007-06-18 17:49:56 -05: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
Matt Mackall
72659a3964 merge: use repo.parents and parent contexts in update 2006-09-29 16:39:38 -05:00
Matt Mackall
4e0e3a1e78 tag: shorten hash in default commit message
Move default message to commands.py
Pass node in binary for consistency
Remove default arguments
Fix up tests
2006-08-20 23:52:52 -05: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
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
Thomas Arendsen Hein
46d0753ec7 Make hg update more verbose by default (issue12)
(including small changes to revert and backout to not show these stats
 with the exception of backout --merge)

Show update stats (unless -q), e.g.:
K files updated, L files merged, M files removed, N files unresolved

Inform the user what to do after a merge:
(branch merge, don't forget to commit)

Inform the user what to do if a branch merge failed:
There are unresolved merges, you can redo the full merge using:
  hg update -C X
  hg merge Y

Inform the user what to do if a working directory merge failed:
There are unresolved merges with locally modified files.
2006-05-02 18:44:02 +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
Thomas Arendsen Hein
b561567e6a Call hooks in alphabetical (=defined) order, of course still grouped by type.
Output of test-hook adjusted.
2006-03-06 17:34:49 +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
6c96629693 i forgot to change the test output for test-hook. 2006-02-16 14:34:59 -08:00
Matt Mackall
16d3876ce7 Change test-hook to test multiple hooks 2005-10-29 13:45:01 -07:00
mpm@selenic.com
ea7bd9ea6f run-tests: remove '+ hg' trick
This was causing me a fair amount of debugging confusion. Let's just
forget it entirely. Updated tests to match.
2005-08-16 19:03:01 -08:00
Thomas Arendsen Hein
87aabef405 Updated output of tests. 2005-07-29 15:21:02 +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