[PATCH] model/scm: fix incorrect reporting of pull from remote git repo

Thomas De Schampheleire thomas.de_schampheleire at nokia.com
Sat Sep 15 18:54:46 UTC 2018


# HG changeset patch
# User Thomas De Schampheleire <thomas.de_schampheleire at nokia.com>
# Date 1537037123 -7200
#      Sat Sep 15 20:45:23 2018 +0200
# Node ID 4a55032bdb764b5b93dd7d1d1a18c15bc10e273c
# Parent  d63018164a308f1005c250a284279fe6f15cf8a3
model/scm: fix incorrect reporting of pull from remote git repo

In issue #327 it was reported that the pull of a remote git repo causes the
following inaccurate journal entry:
    "committed via Kallithea into repository"

The problem is caused by the following flow:

1. pull_changes calls _handle_push for git repos, passing
action='push_remote'.

2. _handle_push calls _handle_rc_scm_extras, but does not pass 'action'

3. _handle_rc_scm_extras uses a default value of 'push_local' for action.

4. The action string 'push_local' will result in the mentioned journal
entry, via action_map in action_parser() (kallithea/lib/helpers.py).


To get a more accurate log entry, _handle_push should pass the action that
it got from pull_changes. In that case, the log entry will become
    "pulled from remote into repository"

diff --git a/kallithea/model/scm.py b/kallithea/model/scm.py
--- a/kallithea/model/scm.py
+++ b/kallithea/model/scm.py
@@ -363,7 +363,7 @@ class ScmModel(object):
         :param repo_name: name of repo
         :param revisions: list of revisions that we pushed
         """
-        self._handle_rc_scm_extras(username, repo_name, repo_alias=repo.alias)
+        self._handle_rc_scm_extras(username, repo_name, repo_alias=repo.alias, action=action)
         _scm_repo = repo._repo
         # trigger push hook
         if repo.alias == 'hg':


More information about the kallithea-general mailing list