Mercurial > kallithea
diff rhodecode/model/scm.py @ 1114:4de3fa6290a7 beta
#109, added manual pull of changes for repositories that have remote location filled in.
This also logs this action in journal
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 05 Mar 2011 22:59:41 +0100 |
parents | 3fc9183e05dd |
children | 523382549c45 |
line wrap: on
line diff
--- a/rhodecode/model/scm.py Sat Mar 05 22:00:53 2011 +0100 +++ b/rhodecode/model/scm.py Sat Mar 05 22:59:41 2011 +0100 @@ -232,8 +232,6 @@ return r, dbr - - def mark_for_invalidation(self, repo_name): """Puts cache invalidation task into db for further global cache invalidation @@ -359,6 +357,25 @@ == RepoModel().get_by_repo_name(repo_id)).count() + def pull_changes(self, repo_name, username): + repo, dbrepo = self.get(repo_name, retval='all') + + try: + extras = {'ip':'', + 'username':username, + 'action':'push_remote', + 'repository':repo_name} + + #inject ui extra param to log this action via push logger + for k, v in extras.items(): + repo._repo.ui.setconfig('rhodecode_extras', k, v) + + repo.pull(dbrepo.clone_uri) + self.mark_for_invalidation(repo_name) + except: + log.error(traceback.format_exc()) + raise + def get_unread_journal(self): return self.sa.query(UserLog).count()