/lib/bitbucket_git.rb
Ruby | 25 lines | 18 code | 5 blank | 2 comment | 2 complexity | dbb978532f64d2c1490268b1c0290d4b MD5 | raw file
- class BitbucketGit < SystemCommand
- GIT_BIN = Redmine::Configuration['scm_git_command'] || "git"
- def self.scm_class
- Repository::Git
- end
- # Fetches updates from the remote repository
- def self.update_repository(local_url)
- command = "ionice -c2 -n7 nice -n19 " + GIT_BIN + " --git-dir='#{local_url}' fetch origin"
- if exec(command)
- command = "ionice -c2 -n7 nice -n19 " + GIT_BIN + " --git-dir='#{local_url}' fetch origin '+refs/heads/*:refs/heads/*'"
- exec(command)
- end
- end
- # Clone repository from Bitbucket
- def self.clone_repository(path, local_url)
- remote_url = "git@bitbucket.org:#{path}.git"
- command = GIT_BIN + " clone --mirror #{remote_url} #{local_url}"
- return exec(command)
- end
- end