diff --git a/vcsserver/git.py b/vcsserver/git.py --- a/vcsserver/git.py +++ b/vcsserver/git.py @@ -447,6 +447,14 @@ class GitRemote(object): return remote_refs @reraise_safe_exceptions + def sync_push(self, wire, url, refs=None): + if self.check_url(url, wire): + repo = self._factory.repo(wire) + self.run_git_command( + wire, ['push', url, '--mirror'], fail_on_stderr=False) + + + @reraise_safe_exceptions def get_remote_refs(self, wire, url): repo = Repo(url) return repo.get_refs() diff --git a/vcsserver/hg.py b/vcsserver/hg.py --- a/vcsserver/hg.py +++ b/vcsserver/hg.py @@ -561,6 +561,15 @@ class HgRemote(object): repo, remote, heads=commit_ids, force=None).cgresult @reraise_safe_exceptions + def sync_push(self, wire, url): + if self.check_url(url, wire['config']): + repo = self._factory.repo(wire) + bookmarks = dict(repo._bookmarks).keys() + remote = peer(repo, {}, url) + return exchange.push( + repo, remote, newbranch=True, bookmarks=bookmarks).cgresult + + @reraise_safe_exceptions def revision(self, wire, rev): repo = self._factory.repo(wire) ctx = repo[rev]