changeset 1312:70a5a9a57864 beta

logged local commit with special action via action_logger,
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 04 May 2011 19:06:56 +0200
parents 6705eeebc41b
children 856be614d9a4
files rhodecode/controllers/files.py rhodecode/lib/helpers.py rhodecode/model/scm.py
diffstat 3 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/controllers/files.py	Wed May 04 18:37:32 2011 +0200
+++ b/rhodecode/controllers/files.py	Wed May 04 19:06:56 2011 +0200
@@ -246,6 +246,7 @@
             try:
                 self.scm_model.commit_change(repo=c.rhodecode_repo,
                                              repo_name=repo_name, cs=c.cs,
+                                             user=self.rhodecode_user,
                                              author=author, message=message,
                                              content=content, f_path=f_path)
                 h.flash(_('Successfully committed to %s' % f_path),
--- a/rhodecode/lib/helpers.py	Wed May 04 18:37:32 2011 +0200
+++ b/rhodecode/lib/helpers.py	Wed May 04 19:06:56 2011 +0200
@@ -453,6 +453,7 @@
            'admin_forked_repo':(_('[forked] repository'), None),
            'admin_updated_repo':(_('[updated] repository'), None),
            'push':(_('[pushed] into'), get_cs_links),
+           'push_local':(_('[committed via RhodeCode] into'), get_cs_links),
            'push_remote':(_('[pulled from remote] into'), get_cs_links),
            'pull':(_('[pulled] from'), None),
            'started_following_repo':(_('[started following] repository'), None),
@@ -491,6 +492,7 @@
            'admin_forked_repo':'arrow_divide.png',
            'admin_updated_repo':'database_edit.png',
            'push':'script_add.png',
+           'push_local':'script_edit.png',
            'push_remote':'connect.png',
            'pull':'down_16.png',
            'started_following_repo':'heart_add.png',
--- a/rhodecode/model/scm.py	Wed May 04 18:37:32 2011 +0200
+++ b/rhodecode/model/scm.py	Wed May 04 19:06:56 2011 +0200
@@ -378,7 +378,7 @@
             raise
 
 
-    def commit_change(self, repo, repo_name, cs, author, message, content,
+    def commit_change(self, repo, repo_name, cs, user, author, message, content,
                       f_path):
 
         if repo.alias == 'hg':
@@ -394,10 +394,15 @@
         author = author.encode('utf8')
         m = IMC(repo)
         m.change(FileNode(path, content))
-        m.commit(message=message,
+        tip = m.commit(message=message,
                  author=author,
                  parents=[cs], branch=cs.branch)
 
+        new_cs = tip.short_id
+        action = 'push_local:%s' % new_cs
+
+        action_logger(user, action, repo_name)
+
         self.mark_for_invalidation(repo_name)