Class: Autoproj::CLI::Tag
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#export_env_sh, #initialize, #normalize_command_line_package_selection, #notify_env_sh_updated, #resolve_selection, #resolve_user_selection, validate_options, #validate_options, #validate_user_selection
Methods included from Ops::Tools
#common_options, #create_autobuild_package, #load_autoprojrc, #load_main_initrb
Constructor Details
This class inherits a constructor from Autoproj::CLI::Base
Instance Method Details
#run(arguments, options = Hash.new) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/autoproj/cli/tag.rb', line 9 def run(arguments, = Hash.new) tag_name, *user_selection = *arguments ws.load_config main_package_set = LocalPackageSet.new(ws) pkg = main_package_set.create_autobuild_package importer = pkg.importer if !importer || !importer.kind_of?(Autobuild::Git) raise CLIInvalidArguments, "cannot use autoproj tag if the main configuration is not managed by git" end versions_file = File.join( Workspace::OVERRIDES_DIR, Versions::DEFAULT_VERSIONS_FILE_BASENAME ) if tag_name.nil? importer = pkg.importer = importer.(pkg, "tag") .sort.each do |tag| next if tag =~ /\^/ begin importer.show(pkg, "refs/tags/#{tag}", versions_file) puts tag rescue Autobuild::PackageException end end return end # Check if the tag already exists begin importer.rev_parse(pkg, "refs/tags/#{tag_name}") raise CLIInvalidArguments, "tag #{tag_name} already exists" rescue Autobuild::PackageException end = [:message] || "autoproj created tag #{tag_name}" commit_id = Ops::Snapshot.create_commit(pkg, versions_file, ) do |io| versions = CLI::Versions.new(ws) Autoproj. "creating versions file, this may take a while" versions.run(user_selection, package_sets: [:package_sets], save: io.path, replace: true, keep_going: [:keep_going]) end importer.(pkg, "tag", tag_name, commit_id) end |