anchor.diff:  	Example = tcp_echo,
   	Port = 5555,
   	try
  +		%% Copy the example.
  +		do_copy(Example),
   		%% Build and start the example release using the previous Ranch version.
   		CommitOrTag = do_use_ranch_previous(Example),
   		do_compile_and_start(Example),
  
positive.code: 		ok = gen_tcp:send(S, "Hello!"),
  		{ok, <<"Hello!">>} = gen_tcp:recv(S, 0, 1000),
  		%% Update Ranch to master then build a release upgrade.
  		do_use_ranch_commit(Example, "master"),
  		do_build_relup(Example, CommitOrTag),
  		%% Perform the upgrade, then check that our connection is still up.
  		do_upgrade(Example),
  
negative.code: do_compile_and_start(Example) ->
  	Make = do_find_make_cmd(),
  	{Dir, Rel, _} = do_get_paths(Example),
  	_ = do_exec_log(Make ++ " -C " ++ Dir ++ " distclean"),
  	%% TERM=dumb disables relx coloring.
  	_ = do_exec_log(Make ++ " -C " ++ Dir ++ " TERM=dumb"),
  	%% For some reason the release has ExampleStr.boot
  	%% while the downgrade expects start.boot?
  	ExampleStr = atom_to_list(Example),
  	_ = do_exec_log("cp "
  		++ Dir ++ "/_rel/" ++ ExampleStr
  			++ "_example/releases/1/" ++ ExampleStr ++ "_example.boot "
  		++ Dir ++ "/_rel/" ++ ExampleStr
  			++ "_example/releases/1/start.boot"),
  	_ = do_exec_log(Rel ++ " stop"),
  	_ = do_exec_log(Rel ++ " start"),
  	timer:sleep(2000),
  	_ = do_exec_log(Rel ++ " eval 'application:info()'"),
  	ok.
  
  do_stop(Example) ->
  	{Dir, Rel, Log} = do_get_paths(Example),
  	_ = do_exec_log("sed -i.bak s/\"2\"/\"1\"/ " ++ Dir ++ "/relx.config"),
  	_ = do_exec_log(Rel ++ " stop"),
  	ct:log("~s~n", [element(2, file:read_file(Log))]).
  
  %% When we are on a tag (git describe --exact-match succeeds),
  %% we use the tag before that as a starting point. Otherwise
  %% we use the most recent tag.
  do_use_ranch_previous(Example) ->
  	TagsOutput = do_exec_log("git tag | tr - \\~ | sort -V | tr \\~ -"),
  	Tags = string:lexemes(TagsOutput, "\n"),
  	DescribeOutput = do_exec_log("git describe --exact-match"),
  	{CommitOrTag, Prev} = case DescribeOutput of
  		"fatal: no tag exactly matches " ++ _ -> {commit, hd(lists:reverse(Tags))};
  		_ -> {tag, hd(tl(lists:reverse(Tags)))}
  