PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/bitbucket_git.rb

https://bitbucket.org/remery/redmine_bitbucket
Ruby | 23 lines | 17 code | 4 blank | 2 comment | 1 complexity | f2f3f854d3ce2b1304defd113d77dd1e MD5 | raw file
  1. class BitbucketGit < SystemCommand
  2. def self.scm_class
  3. Repository::Git
  4. end
  5. # Fetches updates from the remote repository
  6. def self.update_repository(local_url)
  7. command = "git --git-dir='#{local_url}' fetch origin"
  8. if exec(command)
  9. command = "git --git-dir='#{local_url}' -fetch origin '+refs/heads/*:refs/heads/*'"
  10. exec(command)
  11. end
  12. end
  13. # Clone repository from Bitbucket
  14. def self.clone_repository(path, local_url)
  15. remote_url = "git@bitbucket.org:#{path}.git"
  16. command = "git clone --mirror #{remote_url} #{local_url}"
  17. return exec(command)
  18. end
  19. end