Show More
@@ -669,6 +669,10 b' class GitRepository(BaseRepository):' | |||||
669 | ref for ref in remote_refs if remote_refs[ref] in commit_ids] |
|
669 | ref for ref in remote_refs if remote_refs[ref] in commit_ids] | |
670 | self._remote.fetch(url, refs=refs) |
|
670 | self._remote.fetch(url, refs=refs) | |
671 |
|
671 | |||
|
672 | def push(self, url): | |||
|
673 | refs = None | |||
|
674 | self._remote.sync_push(url, refs=refs) | |||
|
675 | ||||
672 | def set_refs(self, ref_name, commit_id): |
|
676 | def set_refs(self, ref_name, commit_id): | |
673 | self._remote.set_refs(ref_name, commit_id) |
|
677 | self._remote.set_refs(ref_name, commit_id) | |
674 |
|
678 |
@@ -554,6 +554,10 b' class MercurialRepository(BaseRepository' | |||||
554 | self._remote.pull(url, commit_ids=commit_ids) |
|
554 | self._remote.pull(url, commit_ids=commit_ids) | |
555 | self._remote.invalidate_vcs_cache() |
|
555 | self._remote.invalidate_vcs_cache() | |
556 |
|
556 | |||
|
557 | def push(self, url): | |||
|
558 | url = self._get_url(url) | |||
|
559 | self._remote.sync_push(url) | |||
|
560 | ||||
557 | def _local_clone(self, clone_path): |
|
561 | def _local_clone(self, clone_path): | |
558 | """ |
|
562 | """ | |
559 | Create a local clone of the current repo. |
|
563 | Create a local clone of the current repo. |
@@ -373,10 +373,10 b' class ScmModel(BaseModel):' | |||||
373 | self.sa.add(repo) |
|
373 | self.sa.add(repo) | |
374 | return repo |
|
374 | return repo | |
375 |
|
375 | |||
376 | def pull_changes(self, repo, username): |
|
376 | def pull_changes(self, repo, username, remote_uri=None): | |
377 | dbrepo = self._get_repo(repo) |
|
377 | dbrepo = self._get_repo(repo) | |
378 |
|
|
378 | remote_uri = remote_uri or dbrepo.clone_uri | |
379 |
if not |
|
379 | if not remote_uri: | |
380 | raise Exception("This repository doesn't have a clone uri") |
|
380 | raise Exception("This repository doesn't have a clone uri") | |
381 |
|
381 | |||
382 | repo = dbrepo.scm_instance(cache=False) |
|
382 | repo = dbrepo.scm_instance(cache=False) | |
@@ -388,13 +388,28 b' class ScmModel(BaseModel):' | |||||
388 | repo_name = dbrepo.repo_name |
|
388 | repo_name = dbrepo.repo_name | |
389 | try: |
|
389 | try: | |
390 | # TODO: we need to make sure those operations call proper hooks ! |
|
390 | # TODO: we need to make sure those operations call proper hooks ! | |
391 |
repo.pull( |
|
391 | repo.pull(remote_uri) | |
392 |
|
392 | |||
393 | self.mark_for_invalidation(repo_name) |
|
393 | self.mark_for_invalidation(repo_name) | |
394 | except Exception: |
|
394 | except Exception: | |
395 | log.error(traceback.format_exc()) |
|
395 | log.error(traceback.format_exc()) | |
396 | raise |
|
396 | raise | |
397 |
|
397 | |||
|
398 | def push_changes(self, repo, username, remote_uri=None): | |||
|
399 | dbrepo = self._get_repo(repo) | |||
|
400 | remote_uri = remote_uri or dbrepo.clone_uri | |||
|
401 | if not remote_uri: | |||
|
402 | raise Exception("This repository doesn't have a clone uri") | |||
|
403 | ||||
|
404 | repo = dbrepo.scm_instance(cache=False) | |||
|
405 | repo.config.clear_section('hooks') | |||
|
406 | ||||
|
407 | try: | |||
|
408 | repo.push(remote_uri) | |||
|
409 | except Exception: | |||
|
410 | log.error(traceback.format_exc()) | |||
|
411 | raise | |||
|
412 | ||||
398 | def commit_change(self, repo, repo_name, commit, user, author, message, |
|
413 | def commit_change(self, repo, repo_name, commit, user, author, message, | |
399 | content, f_path): |
|
414 | content, f_path): | |
400 | """ |
|
415 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now