mirror of
				https://github.com/mnauw/git-remote-hg.git
				synced 2025-10-31 16:45:48 +01:00 
			
		
		
		
	check-versions: remove code for other tools
Only support hg. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
This commit is contained in:
		| @@ -62,13 +62,10 @@ class Component | |||||||
|  |  | ||||||
|   attr_reader :id |   attr_reader :id | ||||||
|  |  | ||||||
|   def initialize(id, url, kind: nil, **args) |   def initialize(id, url, **args) | ||||||
|     @id = id |     @id = id | ||||||
|     @url = url |     @url = url | ||||||
|     @kind = kind || (url.start_with?('git') ? :git : :hg) |  | ||||||
|     @tool = @kind.to_s |  | ||||||
|     @checkout_fix = args[:checkout_fix] |     @checkout_fix = args[:checkout_fix] | ||||||
|     @version_format = args[:version_format] |  | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def dir |   def dir | ||||||
| @@ -76,25 +73,16 @@ class Component | |||||||
|   end |   end | ||||||
|  |  | ||||||
|   def get_version(version) |   def get_version(version) | ||||||
|     return @kind == :hg ? 'tip' : '@' if version == '@' |     version == '@' ? 'tip' : version | ||||||
|     @version_format ? @version_format % version : version |  | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def clone |   def clone | ||||||
|     run_cmd [@tool, 'clone', '-q', @url, dir] |     run_cmd ['hg', 'clone', '-q', @url, dir] | ||||||
|   end |   end | ||||||
|  |  | ||||||
|   def checkout(version) |   def checkout(version) | ||||||
|     Dir.chdir(dir) do |     Dir.chdir(dir) do | ||||||
|       case @kind |       run_cmd %w[hg update --clean -q] << get_version(version) | ||||||
|       when :hg |  | ||||||
|         cmd = %w[update --clean] |  | ||||||
|       when :git |  | ||||||
|         cmd = %w[reset --hard] |  | ||||||
|       else |  | ||||||
|         cmd = %w[checkout] |  | ||||||
|       end |  | ||||||
|       run_cmd [@tool] + cmd + ['-q', get_version(version)] |  | ||||||
|       @checkout_fix.call(version) if @checkout_fix |       @checkout_fix.call(version) if @checkout_fix | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user