# HG changeset patch # User Mads Kiilerich # Date 1440084595 -7200 # Node ID 061ce7c3071a5c7d421fb2632eec1e149456582b # Parent d9386a3924db536560a02776b8398c2edea1bc14 hooks: add some docstrings diff -r d9386a3924db -r 061ce7c3071a kallithea/lib/hooks.py --- a/kallithea/lib/hooks.py Thu Aug 20 17:29:55 2015 +0200 +++ b/kallithea/lib/hooks.py Thu Aug 20 17:29:55 2015 +0200 @@ -157,10 +157,8 @@ def log_push_action(ui, repo, **kwargs): """ - Maps user last push action to new changeset id, from mercurial - - :param ui: - :param repo: repo object containing the `ui` object + Register that changes have been pushed. + Mercurial invokes this directly as a hook, git uses handle_git_receive. """ ex = _extract_extras() @@ -369,13 +367,13 @@ return 0 -handle_git_pre_receive = (lambda repo_path, revs, env: - handle_git_receive(repo_path, revs, env, hook_type='pre')) -handle_git_post_receive = (lambda repo_path, revs, env: - handle_git_receive(repo_path, revs, env, hook_type='post')) +def handle_git_pre_receive(repo_path, revs, env): + return handle_git_receive(repo_path, revs, env, hook_type='pre') +def handle_git_post_receive(repo_path, revs, env): + return handle_git_receive(repo_path, revs, env, hook_type='post') -def handle_git_receive(repo_path, revs, env, hook_type='post'): +def handle_git_receive(repo_path, revs, env, hook_type): """ A really hacky method that is run by git post-receive hook and logs an push action together with pushed revisions. It's executed by subprocess diff -r d9386a3924db -r 061ce7c3071a kallithea/model/scm.py --- a/kallithea/model/scm.py Thu Aug 20 17:29:55 2015 +0200 +++ b/kallithea/model/scm.py Thu Aug 20 17:29:55 2015 +0200 @@ -505,6 +505,9 @@ % (scm_type,)) def pull_changes(self, repo, username): + """ + Pull from "clone URL". + """ dbrepo = self.__get_repo(repo) clone_uri = dbrepo.clone_uri if not clone_uri: @@ -536,10 +539,9 @@ def commit_change(self, repo, repo_name, cs, user, author, message, content, f_path): """ - Commits changes + Commit a change to a single file - :param repo: SCM instance - + :param repo: a db_repo.scm_instance """ user = self._get_user(user) IMC = self._get_IMC_module(repo.alias) @@ -677,6 +679,9 @@ def update_nodes(self, user, repo, message, nodes, parent_cs=None, author=None, trigger_push_hook=True): + """ + Commits specified nodes to repo. Again. + """ user = self._get_user(user) scm_instance = repo.scm_instance_no_cache()