require ENV['TM_BUNDLE_SUPPORT'] + '/lib/connect.rb' conn = Connect.new p4 = conn.connect if p4 if ENV['TM_SELECTED_FILES'] change_no = '' pending = p4.run_changes('-c', p4.client, '-u', p4.user, '-s', 'pending') items = [] pending.each do |i| items << i['change'] end change = conn.get_changelist_choice("Submit", items.include?('default') ? ['default'] : []) ENV['TM_SELECTED_FILES'].each {|i| path_out = i.rpartition("\'")[0].to_s path_out = path_out[1..path_out.length] begin if change[0] == "pending" change_no = change[1] p4.run_submit('-c', change_no) elsif change[0] == "default" change_no = p4.run_submit()['submittedChange'] end rescue Exception => msg p4.disconnect abort(msg) end } p4.disconnect abort("Changelist #{change_no} submitted") end else p4.disconnect abort("Failed to connect, please check your settings") end