require 'test/unit' class MoveTest < Test::Unit::TestCase include MirrorTest def testSimpleMove root = use_source file1 = File.join(root, "file1") File.open(file1, "w") do |f| f.puts("Some content") end @p4.run_add(file1) @p4.run_submit("-d", "File added") file2 = File.join(root, "file2") @p4.run_edit(file1) @p4.run_move(file1, file2) mirror_and_compare() root = use_target opened = @p4.run_opened("#{root}/...") assert(opened.length == 2, "Not two files open under target root") end def testMoveOldRevision root = use_source file1 = File.join(root, "file1") File.open(file1, "w") do |f| f.puts("Some content") end @p4.run_add(file1) @p4.run_submit("-d", "File added") # edit once @p4.run_edit(file1) File.open(file1, "a") do |f| f.puts("More content") end @p4.run_submit("-d", "File edited") # edit twice @p4.run_edit(file1) File.open(file1, "a") do |f| f.puts("More content") end @p4.run_submit("-d", "File edited") @p4.run_sync("#{file1}#1") @p4.run_edit(file1) # editing of old revision, will send out message that we need to resolve File.open(file1, "a") do |f| f.puts("Different content") end @p4.run_sync("#{file1}#2") @p4.run_resolve("-ay") file2 = File.join(root, "file2") @p4.run_move(file1, file2) @p4.run_sync(file2) # will bring up the request to resolve mirror_and_compare() root = use_target opened = @p4.run_opened("#{root}/...") assert(opened.length == 2, "Not two files open under target root") end end