# # # patch "cmd_netsync.cc" # from [1fb1c4de8ea4eab675c08675fa1dd3bae086ce4e] # to [6aa8d59e70548a37784444f0a34a913b3cfd7def] # # patch "database.cc" # from [99171b1f3f3aeceb00da62cb3d74667e9be7e8bf] # to [7770e394d00b075de203a5c054350b1c44c98349] # # patch "database.hh" # from [ac3f29cd6d2f86ef60802f9c0674df6d2b578a7d] # to [6c591fe758a0dcb3706813f9fa100fae9a37c6f6] # # patch "tests/clone_warning_with_multiple_heads/__driver__.lua" # from [a64e816452073997cce0f45ec970e5b42a076067] # to [5a40446d00e3befa398b07dcb59a7112c3f80a87] # ============================================================ --- cmd_netsync.cc 1fb1c4de8ea4eab675c08675fa1dd3bae086ce4e +++ cmd_netsync.cc 6aa8d59e70548a37784444f0a34a913b3cfd7def @@ -170,15 +170,18 @@ public: class dir_cleanup_helper { public: - dir_cleanup_helper(system_path const & new_dir, app_state *app_st, bool i_db) : - commited(false), internal_db(i_db), dir(new_dir), app(app_st) {} + dir_cleanup_helper(system_path const & new_dir, bool i_db) : + commited(false), internal_db(i_db), dir(new_dir) {} ~dir_cleanup_helper() { if (!commited && directory_exists(dir)) { - if (internal_db && app) - app->db.close(); +#ifdef WIN32 + if (!internal_db) + delete_dir_recursive(dir); +#else delete_dir_recursive(dir); +#endif /* WIN32 */ } } void commit(void) @@ -189,7 +192,6 @@ private: bool commited; bool internal_db; system_path dir; - app_state *app; }; CMD(clone, N_("network"), N_("ADDRESS[:PORTNUMBER] [DIRECTORY]"), @@ -228,7 +230,7 @@ CMD(clone, N_("network"), N_("ADDRESS[:P bool internal_db = !app.opts.dbname_given || app.opts.dbname.empty(); - dir_cleanup_helper remove_on_fail(workspace_dir, &app, internal_db); + dir_cleanup_helper remove_on_fail(workspace_dir, internal_db); app.create_workspace(workspace_dir); if (internal_db) ============================================================ --- database.cc 99171b1f3f3aeceb00da62cb3d74667e9be7e8bf +++ database.cc 7770e394d00b075de203a5c054350b1c44c98349 @@ -3345,12 +3345,11 @@ database::close() void database::close() { - if (__sql) - { - sqlite3_close(__sql); - __sql = 0; - } + I(__sql); + sqlite3_close(__sql); + __sql = 0; + I(!__sql); } ============================================================ --- database.hh ac3f29cd6d2f86ef60802f9c0674df6d2b578a7d +++ database.hh 6c591fe758a0dcb3706813f9fa100fae9a37c6f6 @@ -97,15 +97,15 @@ private: void check_db_exists(); void check_db_nonexistent(); void open(); + void close(); void check_format(); public: database(system_path const & file); ~database(); - void close(); + void set_app(app_state * app); - void set_app(app_state * app); void set_filename(system_path const & file); system_path get_filename(); bool is_dbfile(any_path const & file); ============================================================ --- tests/clone_warning_with_multiple_heads/__driver__.lua a64e816452073997cce0f45ec970e5b42a076067 +++ tests/clone_warning_with_multiple_heads/__driver__.lua 5a40446d00e3befa398b07dcb59a7112c3f80a87 @@ -18,6 +18,6 @@ check(nodb_mtn("--branch=testbranch", "c check(nodb_mtn("--branch=testbranch", "clone", testURI, "test_dir1"), 1, false, true) -check(not exists("test_dir1")) +xfail_if(ostype == "Windows", not exists("test_dir1")) check(qgrep(REV2, "stderr")) check(qgrep(REV3, "stderr"))