##// END OF EJS Templates
scm: added push options for Mercurial and Git to allow remote repository sync.
marcink -
r2492:d48fe67d default
parent child Browse files
Show More
@@ -669,6 +669,10 b' class GitRepository(BaseRepository):'
669 669 ref for ref in remote_refs if remote_refs[ref] in commit_ids]
670 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 676 def set_refs(self, ref_name, commit_id):
673 677 self._remote.set_refs(ref_name, commit_id)
674 678
@@ -554,6 +554,10 b' class MercurialRepository(BaseRepository'
554 554 self._remote.pull(url, commit_ids=commit_ids)
555 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 561 def _local_clone(self, clone_path):
558 562 """
559 563 Create a local clone of the current repo.
@@ -373,10 +373,10 b' class ScmModel(BaseModel):'
373 373 self.sa.add(repo)
374 374 return repo
375 375
376 def pull_changes(self, repo, username):
376 def pull_changes(self, repo, username, remote_uri=None):
377 377 dbrepo = self._get_repo(repo)
378 clone_uri = dbrepo.clone_uri
379 if not clone_uri:
378 remote_uri = remote_uri or dbrepo.clone_uri
379 if not remote_uri:
380 380 raise Exception("This repository doesn't have a clone uri")
381 381
382 382 repo = dbrepo.scm_instance(cache=False)
@@ -388,13 +388,28 b' class ScmModel(BaseModel):'
388 388 repo_name = dbrepo.repo_name
389 389 try:
390 390 # TODO: we need to make sure those operations call proper hooks !
391 repo.pull(clone_uri)
391 repo.pull(remote_uri)
392 392
393 393 self.mark_for_invalidation(repo_name)
394 394 except Exception:
395 395 log.error(traceback.format_exc())
396 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 413 def commit_change(self, repo, repo_name, commit, user, author, message,
399 414 content, f_path):
400 415 """
General Comments 0
You need to be logged in to leave comments. Login now