Mercurial > kallithea
comparison 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 |
comparison
equal
deleted
inserted
replaced
1113:c1eda8ec4a46 | 1114:4de3fa6290a7 |
---|---|
230 invalidate=dbinvalidate) | 230 invalidate=dbinvalidate) |
231 | 231 |
232 | 232 |
233 return r, dbr | 233 return r, dbr |
234 | 234 |
235 | |
236 | |
237 def mark_for_invalidation(self, repo_name): | 235 def mark_for_invalidation(self, repo_name): |
238 """Puts cache invalidation task into db for | 236 """Puts cache invalidation task into db for |
239 further global cache invalidation | 237 further global cache invalidation |
240 | 238 |
241 :param repo_name: this repo that should invalidation take place | 239 :param repo_name: this repo that should invalidation take place |
357 return self.sa.query(Repository)\ | 355 return self.sa.query(Repository)\ |
358 .filter(Repository.fork \ | 356 .filter(Repository.fork \ |
359 == RepoModel().get_by_repo_name(repo_id)).count() | 357 == RepoModel().get_by_repo_name(repo_id)).count() |
360 | 358 |
361 | 359 |
360 def pull_changes(self, repo_name, username): | |
361 repo, dbrepo = self.get(repo_name, retval='all') | |
362 | |
363 try: | |
364 extras = {'ip':'', | |
365 'username':username, | |
366 'action':'push_remote', | |
367 'repository':repo_name} | |
368 | |
369 #inject ui extra param to log this action via push logger | |
370 for k, v in extras.items(): | |
371 repo._repo.ui.setconfig('rhodecode_extras', k, v) | |
372 | |
373 repo.pull(dbrepo.clone_uri) | |
374 self.mark_for_invalidation(repo_name) | |
375 except: | |
376 log.error(traceback.format_exc()) | |
377 raise | |
378 | |
362 def get_unread_journal(self): | 379 def get_unread_journal(self): |
363 return self.sa.query(UserLog).count() | 380 return self.sa.query(UserLog).count() |
364 | 381 |
365 | 382 |
366 def _should_invalidate(self, repo_name): | 383 def _should_invalidate(self, repo_name): |