From 03994eeff9d0d8c71ba52f78264150bae0f09c13 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 3 Sep 2013 11:50:30 +0200 Subject: [PATCH] Allow irkerhook to be used as a mecurial changegroup hook --- irkerhook.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/irkerhook.py b/irkerhook.py index 4b243a2..d09eb17 100755 --- a/irkerhook.py +++ b/irkerhook.py @@ -393,12 +393,20 @@ class HgExtractor(GenericExtractor): return commit def hg_hook(ui, repo, **kwds): - # To be called from a Mercurial "commit" or "incoming" hook. Example - # configuration: + # To be called from a Mercurial "commit", "incoming" or "changegroup" hook. + # Example configuration: # [hooks] # incoming.irker = python:/path/to/irkerhook.py:hg_hook extractor = HgExtractor([(ui, repo)]) - ship(extractor, kwds['node'], False) + start = repo[kwds['node']].rev() + end = len(repo) + if start != end: + # changegroup with multiple commits, so we generate a notification + # for each one + for rev in range(start, end): + ship(extractor, rev, False) + else: + ship(extractor, kwds['node'], False) # The files we use to identify a Subversion repo might occur as content # in a git or hg repo, but the special subdirectories for those are more -- 2.26.2