# # # patch "ChangeLog" # from [de37bf6fe446f68e48368427efbe4881ebb5afc0] # to [6f739a0df8dd1e08a4a54a11d04bef62856d2371] # # patch "database.cc" # from [a4b5de4f4123d5b7729f5017e6a26d14d3df7b70] # to [8902f37329f34641312e08a9a466e6b3facc24d0] # # patch "database.hh" # from [dd9695e867200e94e2d10b9e9bd74bd423c0ac10] # to [ca1d3b34a21a042b2f13f3f98fa5b1b519b3ee38] # # patch "tests/t_add_owndb.at" # from [1a63fac0aa5c37fb17934cdb1cd79062e4c284c4] # to [74dcb2ff61d7a8cb9c787ddabcbd74aa10ea2eb8] # # patch "tests/t_diff_outside_workspace.at" # from [28c8bf8ea6fc2088a754308386f6ab936506dc77] # to [91e929a8e18167fc073b033b782d50c04d0dabad] # # patch "tests/t_mt_ignore.at" # from [70d452af35a31d73ed28834e8f710d7a2220b140] # to [979d32a72c8573f493f549ecf34039562014ca05] # # patch "testsuite.at" # from [24fda35bb35a7e2ddd7a98c55741d919899270e2] # to [7f433b14b3bd2a67eeacc49577a64e35d97ed02f] # # patch "work.cc" # from [974c1d8a5295fd7317898e60abc636fdcc82ba65] # to [84e37230e8afcec127e4f102976a0cf7f23307a6] # ============================================================ --- ChangeLog de37bf6fe446f68e48368427efbe4881ebb5afc0 +++ ChangeLog 6f739a0df8dd1e08a4a54a11d04bef62856d2371 @@ -1,3 +1,16 @@ +2006-02-11 Timothy Brownawell + + Adding your db is silly and confusing (what should revert do?). + So, it's not allowed any more (the db file is ignored, regardless of + what the ignore hook says). + * tests/t_add_owndb.at: remove XFAIL, use 'ls known' instead of + 'ls unknown' + * testsuite.at: don't put the db in the ignore hook + * database.{cc,hh}: is_dbfile(), check if a path is the database file + * work.cc: check is_dbfile where we check the ignore hook when + walking the filesystem + * tests/t_mt_ignore.at: fix for having the db always be ignored + 2006-02-10 Richard Levitte * monotone.texi (Hooks): Change the example for ============================================================ --- database.cc a4b5de4f4123d5b7729f5017e6a26d14d3df7b70 +++ database.cc 8902f37329f34641312e08a9a466e6b3facc24d0 @@ -125,6 +125,16 @@ transaction_level(0) {} +bool +database::is_dbfile(any_path const & file) +{ + system_path fn(file);// why is this needed? + bool same = (filename.as_internal() == fn.as_internal()); + if (same) + L(FL("'%s' is the database file") % file); + return same; +} + void database::check_schema() { ============================================================ --- database.hh dd9695e867200e94e2d10b9e9bd74bd423c0ac10 +++ database.hh ca1d3b34a21a042b2f13f3f98fa5b1b519b3ee38 @@ -205,6 +205,7 @@ database(system_path const & file); void set_filename(system_path const & file); + bool is_dbfile(any_path const & file); void initialize(); void debug(std::string const & sql, std::ostream & out); void dump(std::ostream &); ============================================================ --- tests/t_add_owndb.at 1a63fac0aa5c37fb17934cdb1cd79062e4c284c4 +++ tests/t_add_owndb.at 74dcb2ff61d7a8cb9c787ddabcbd74aa10ea2eb8 @@ -1,9 +1,6 @@ AT_SETUP([(minor) add own db]) MONOTONE_SETUP -# This test is a bug report -AT_XFAIL_IF(true) - #Adding the current in-use DB should fail # ...It *really* seems like adding the db to the db is something that should be caught and an error message thrown... # (What's revert supposed to do when you revert the db? :-) @@ -11,23 +8,23 @@ # and add a note in a comment that "revert" is the case that really moves this # from being "stupid user tricks" to "something we should protect users from" :-) AT_CHECK(MONOTONE add test.db, [], [ignore], [ignore]) -AT_CHECK(MONOTONE ls unknown, [], [stdout], [ignore]) -AT_CHECK(grep 'test.db' stdout, [0], [ignore]) +AT_CHECK(MONOTONE ls known, [], [stdout], [ignore]) +AT_CHECK(grep 'test.db' stdout, [1], [ignore]) AT_CHECK(MONOTONE add ., [], [ignore], [ignore]) -AT_CHECK(MONOTONE ls unknown, [], [stdout], [ignore]) -AT_CHECK(grep 'test.db' stdout, [0], [ignore]) +AT_CHECK(MONOTONE ls known, [], [stdout], [ignore]) +AT_CHECK(grep 'test.db' stdout, [1], [ignore]) AT_CHECK(mkdir subdir) AT_CHECK(cp test.db subdir) AT_CHECK(MONOTONE --db=subdir/test.db add subdir/test.db, [], [ignore], [ignore]) -AT_CHECK(MONOTONE --db=subdir/test.db ls unknown, [], [stdout], [ignore]) -AT_CHECK(grep 'subdir/test.db' stdout, [0], [ignore]) +AT_CHECK(MONOTONE --db=subdir/test.db ls known, [], [stdout], [ignore]) +AT_CHECK(grep 'subdir/test.db' stdout, [1], [ignore]) # If it's not an in-use DB, it should work, though AT_CHECK(MONOTONE add subdir/test.db, [], [ignore], [ignore]) -AT_CHECK(MONOTONE ls unknown, [], [stdout], [ignore]) -AT_CHECK(grep 'subdir/test.db' stdout, [1], [ignore]) +AT_CHECK(MONOTONE ls known, [], [stdout], [ignore]) +AT_CHECK(grep 'subdir/test.db' stdout, [0], [ignore]) AT_CLEANUP ============================================================ --- tests/t_diff_outside_workspace.at 28c8bf8ea6fc2088a754308386f6ab936506dc77 +++ tests/t_diff_outside_workspace.at 91e929a8e18167fc073b033b782d50c04d0dabad @@ -19,6 +19,6 @@ AT_CHECK(rm -rf MT) AT_CHECK(MONOTONE diff --revision=$parent --revision=$second, [], [ignore], [ignore]) # check it works when specifying files -AT_CHECK(MONOTONE diff --revision=$parent --revision=$second foo2, [], [ignore], [ignore]) +AT_CHECK(MONOTONE diff --revision=$parent --revision=$second foo2 --debug, [], [ignore], [ignore]) AT_CLEANUP ============================================================ --- tests/t_mt_ignore.at 70d452af35a31d73ed28834e8f710d7a2220b140 +++ tests/t_mt_ignore.at 979d32a72c8573f493f549ecf34039562014ca05 @@ -32,6 +32,7 @@ AT_CHECK(grep xyzzy ignored, [], [ignore]) AT_CHECK(rm .mt-ignore) -AT_CHECK(RAW_MONOTONE ls ignored, [], [], []) +AT_CHECK(RAW_MONOTONE ls ignored, [], [test.db +], []) AT_CLEANUP ============================================================ --- testsuite.at 24fda35bb35a7e2ddd7a98c55741d919899270e2 +++ testsuite.at 7f433b14b3bd2a67eeacc49577a64e35d97ed02f @@ -134,7 +134,6 @@ function ignore_file(name) if (string.find(name, "test_hooks.lua")) then return true end if (string.find(name, "keys")) then return true end - if (string.find(name, "test.db")) then return true end return false end ============================================================ --- work.cc 974c1d8a5295fd7317898e60abc636fdcc82ba65 +++ work.cc 84e37230e8afcec127e4f102976a0cf7f23307a6 @@ -41,7 +41,7 @@ path.split(sp); if (app.restriction_includes(sp) && known.find(sp) == known.end()) { - if (app.lua.hook_ignore_file(path)) + if (app.lua.hook_ignore_file(path) || app.db.is_dbfile(path)) ignored.insert(sp); else unknown.insert(sp); @@ -112,7 +112,7 @@ void addition_builder::visit_file(file_path const & path) { - if (app.lua.hook_ignore_file(path)) + if (app.lua.hook_ignore_file(path) || app.db.is_dbfile(path)) { P(F("skipping ignorable file %s\n") % path); return;