if arguments and type(arguments[0]) == type(()):
# Called from hg_hook function
- ui, repo, self.node = arguments[0]
+ ui, repo, node = arguments[0]
# Extract global values from the hg configuration file(s)
self.project = ui.config('irker', 'project')
# Determine the repository type. Default to git unless user has pointed
# us at a repo with identifiable internals.
vcs = "git"
- if repository and os.path.exists(os.path.join(repository, "format")):
+ if repository and os.path.exists(os.path.join(repository, ".hg")):
+ vcs = "hg"
+ elif repository and os.path.exists(os.path.join(repository, "format")):
vcs = "svn"
# Someday we'll have extractors for several version-control systems
if vcs == "svn":
- if repository is None or not commits:
- sys.stderr.write("irkerhook: svn requires a repository and a commit.")
- sys.exit(1)
extractor = SvnExtractor(sys.argv[1:])
+ if not commits:
+ commits = ['HEAD']
+ elif vcs == "hg":
+ extractor = HgExtractor(sys.argv[1:])
+ if not commits:
+ commits = ['-1']
else:
extractor = GitExtractor(sys.argv[1:])
if not commits:
<refsect2 id="svn"><title>Subversion</title>
<para>Under Subversion, <application>irkerhook.py</application>
-requires two arguments: "repository=" (the absolute pathname of the
-Subversion repository) and "commit=" (the numeric revision level of
+requires a --repository option with value (the absolute pathname of the
+Subversion repository) and a commit argument (the numeric revision level of
the commit). The values must be the two arguments that Subversion
gives its post-commit hook. Thus, a typical invocation in the post-commit
script will look like this:</para>
<para>Under Mercurial, <application>irkerhook.py</application> can be
invoked in two ways: either as a Python hook (preferred) or as a
-script. As for git, in both cases all variables may be set in the repo
+script.</para>
+
+<para>When called as a script, the hook requires a --repository option
+with value (the absolute pathname of the Subversion repository) and can take a
+commit argument (the Mercurial hash ID of the commit or a reference to it).
+The default commit argument is '-1', designating the current tip commit.</para>
+
+<para>As for git, in both cases all variables may be set in the repo
<filename>hgrc</filename> file in an [irker] section. Command-line
variable=value arguments are accepted but not required for script
invocation. No attempt is made to interpret an