class OhlohScm::Hg::Scm
Public Instance Methods
branch_name_or_default()
click to toggle source
# File lib/ohloh_scm/hg/scm.rb, line 13 def branch_name_or_default branch_name || :default end
pull(remote_scm, callback)
click to toggle source
# File lib/ohloh_scm/hg/scm.rb, line 6 def pull(remote_scm, callback) err_msg = "Cannot pull remote_scm #{remote_scm.inspect}" raise ArgumentError, err_msg unless remote_scm.is_a?(Hg::Scm) clone_or_fetch(remote_scm, callback) end
vcs_path()
click to toggle source
# File lib/ohloh_scm/hg/scm.rb, line 17 def vcs_path "#{url}/.hg" end
Private Instance Methods
clean_up_disk()
click to toggle source
# File lib/ohloh_scm/hg/scm.rb, line 43 def clean_up_disk return unless FileTest.exist?(url) run "cd #{url} && find . -maxdepth 1 -not -name .hg -not -name . -print0"\ ' | xargs -0 rm -rf --' end
clone_or_fetch(remote_scm, callback)
click to toggle source
# File lib/ohloh_scm/hg/scm.rb, line 23 def clone_or_fetch(remote_scm, callback) callback.update(0, 1) status.exist? ? revert_and_pull(remote_scm) : clone_repository(remote_scm) clean_up_disk callback.update(1, 1) end
clone_repository(remote_scm)
click to toggle source
# File lib/ohloh_scm/hg/scm.rb, line 33 def clone_repository(remote_scm) run "rm -rf '#{url}'" run "hg clone '#{remote_scm.url}' '#{url}'" end
revert_and_pull(remote_scm)
click to toggle source
# File lib/ohloh_scm/hg/scm.rb, line 38 def revert_and_pull(remote_scm) branch_opts = "-r #{remote_scm.branch_name}" if branch_name run "cd '#{url}' && hg revert --all && hg pull #{branch_opts} -u -y '#{remote_scm.url}'" end