@@ -1077,19 +1077,21 @@ fn unapply_branch() -> Result<()> {
1077
1077
assert_eq ! ( branch. files. len( ) , 1 ) ;
1078
1078
assert ! ( branch. active) ;
1079
1079
1080
- virtual_branches:: unapply_branch ( project_repository, branch1_id) ?;
1080
+ let real_branch = virtual_branches:: convert_to_real_branch ( project_repository, branch1_id) ?;
1081
1081
1082
1082
let contents = std:: fs:: read ( Path :: new ( & project. path ) . join ( file_path) ) ?;
1083
1083
assert_eq ! ( "line1\n line2\n line3\n line4\n " , String :: from_utf8( contents) ?) ;
1084
1084
let contents = std:: fs:: read ( Path :: new ( & project. path ) . join ( file_path2) ) ?;
1085
1085
assert_eq ! ( "line5\n line6\n " , String :: from_utf8( contents) ?) ;
1086
1086
1087
1087
let ( branches, _) = virtual_branches:: list_virtual_branches ( project_repository) ?;
1088
- let branch = & branches. iter ( ) . find ( |b| b. id == branch1_id) . unwrap ( ) ;
1089
- assert_eq ! ( branch. files. len( ) , 1 ) ;
1090
- assert ! ( !branch. active) ;
1088
+ assert ! ( !branches. iter( ) . any( |b| b. id == branch1_id) ) ;
1091
1089
1092
- apply_branch ( project_repository, branch1_id, None ) ?;
1090
+ let branch1_id = virtual_branches:: create_virtual_branch_from_branch (
1091
+ project_repository,
1092
+ & git:: Refname :: try_from ( & real_branch) ?,
1093
+ None ,
1094
+ ) ?;
1093
1095
let contents = std:: fs:: read ( Path :: new ( & project. path ) . join ( file_path) ) ?;
1094
1096
assert_eq ! (
1095
1097
"line1\n line2\n line3\n line4\n branch1\n " ,
@@ -1153,12 +1155,12 @@ fn apply_unapply_added_deleted_files() -> Result<()> {
1153
1155
} ,
1154
1156
) ?;
1155
1157
1156
- virtual_branches:: unapply_branch ( project_repository, branch2_id) ?;
1158
+ virtual_branches:: convert_to_real_branch ( project_repository, branch2_id) ?;
1157
1159
// check that file2 is back
1158
1160
let contents = std:: fs:: read ( Path :: new ( & project. path ) . join ( file_path2) ) ?;
1159
1161
assert_eq ! ( "file2\n " , String :: from_utf8( contents) ?) ;
1160
1162
1161
- virtual_branches:: unapply_branch ( project_repository, branch3_id) ?;
1163
+ virtual_branches:: convert_to_real_branch ( project_repository, branch3_id) ?;
1162
1164
// check that file3 is gone
1163
1165
assert ! ( !Path :: new( & project. path) . join( file_path3) . exists( ) ) ;
1164
1166
@@ -1218,8 +1220,8 @@ fn detect_mergeable_branch() -> Result<()> {
1218
1220
. expect ( "failed to update branch" ) ;
1219
1221
1220
1222
// unapply both branches and create some conflicting ones
1221
- virtual_branches:: unapply_branch ( project_repository, branch1_id) ?;
1222
- virtual_branches:: unapply_branch ( project_repository, branch2_id) ?;
1223
+ virtual_branches:: convert_to_real_branch ( project_repository, branch1_id) ?;
1224
+ virtual_branches:: convert_to_real_branch ( project_repository, branch2_id) ?;
1223
1225
1224
1226
project_repository. repo ( ) . set_head ( "refs/heads/master" ) ?;
1225
1227
project_repository
0 commit comments