Sha256: 52a0d96591f937cc6ed97d82c768d2d266292261cdc44bf079037e57081ba92e

Contents?: true

Size: 947 Bytes

Versions: 3

Compression:

Stored size: 947 Bytes

Contents

require 'pullr/command_line'

module Pullr
  module SCM
    module Mercurial
      include CommandLine

      #
      # Pulls down a copy of a Mercurial repository.
      #
      # @param [Addressable::URI] uri
      #   The URI of the Mercurial repository.
      #
      # @param [String] dest
      #   Optional destination to pull the repository down into.
      #
      def scm_pull(uri,dest=nil)
        if dest
          sh 'hg', 'clone', uri, dest
        else
          sh 'hg', 'clone', uri
        end
      end

      #
      # Updates a local Mercurial repository.
      #
      # @param [String] path
      #   Path to the local repository to update.
      #
      # @param [Addressable::URI] uri
      #   Optional URI of the remote Mercurial repository to update from.
      #
      def scm_update(path,uri=nil)
        cd(path) do
          sh 'hg', 'pull'
          sh 'hg', 'update', '-C'
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pullr-0.1.3 lib/pullr/scm/mercurial.rb
pullr-0.1.2 lib/pullr/scm/mercurial.rb
pullr-0.1.1 lib/pullr/scm/mercurial.rb