# # # add_dir "tests/merge_into_workspace_mtn_execute" # # add_dir "tests/pluck_mtn_execute" # # add_file "tests/merge_into_workspace_mtn_execute/__driver__.lua" # content [c9acd161378a6c6e8c0a0db7346c7b8b42fce386] # # add_file "tests/pluck_mtn_execute/__driver__.lua" # content [68dbe8dfec677cfb77867ae0133c0b714e85d3b6] # # patch "NEWS" # from [0bad929ea63c745532616f7f7218f56eadf2aa93] # to [8202c3016255d079485dbade377f0feea1ad276f] # # patch "cmd_merging.cc" # from [43295b660dbeef73009f01d85ceb7f0c3f5261b2] # to [8253dd6a55ffc02d922f4dc21b634802a1ac5a2d] # # patch "cmd_netsync.cc" # from [ec8f8dad70788df8364337edbf02ef6d6c7080e4] # to [daaee53881abbda9c400148f4870098cb03508de] # # patch "cmd_ws_commit.cc" # from [0ab8f9138081d781fe1e341c7e7e9ff61c3ce0a6] # to [24b0dc37e55ee1d3bce37c4d92708b4e026388b6] # # patch "tests/attr_mtn_execute/__driver__.lua" # from [51c34985351d3f80ed3f3b42ca266f641be56625] # to [2f6b3747ecf3673d185c8fe29c889aa029a7201e] # # patch "work.cc" # from [ae2e7599c46af656b7f01058e90c501ffad0fd3d] # to [766cbbfd5b78c442ed6fc650846daa55f9d42768] # # patch "work.hh" # from [e78bc57d1e78333c06e831ec917384eecbe3c44f] # to [d6167a82e9e8fefa17d892c09af2ed0c78f8ded5] # ============================================================ --- tests/merge_into_workspace_mtn_execute/__driver__.lua c9acd161378a6c6e8c0a0db7346c7b8b42fce386 +++ tests/merge_into_workspace_mtn_execute/__driver__.lua c9acd161378a6c6e8c0a0db7346c7b8b42fce386 @@ -0,0 +1,28 @@ +-- +-- test setting/clearing of the the execute file attribute works +-- +skip_if(ostype=="Windows") + +mtn_setup() + +writefile("foo", "some data") +check(mtn("add", "foo"), 0, false, false) +commit() +rev1 = base_revision() + +check(mtn("attr", "set", "foo", "mtn:execute", "true"), 0, false, false) +check({"test", "-x","foo"}, 0, false, false) +commit() +rev2 = base_revision() + +check(mtn("update", "-r", rev1), 0, false, false) +check({"test", "!", "-x","foo"}, 0, false, false) + +writefile("baz", "some data") +check(mtn("add", "baz"), 0, false, false) +commit() +rev3 = base_revision() + +-- merge_into_workspace the revision that set foo's execute bits +check(mtn("merge_into_workspace", rev2), 0, false, false) +check({"test", "-x","foo"}, 0, false, false) ============================================================ --- tests/pluck_mtn_execute/__driver__.lua 68dbe8dfec677cfb77867ae0133c0b714e85d3b6 +++ tests/pluck_mtn_execute/__driver__.lua 68dbe8dfec677cfb77867ae0133c0b714e85d3b6 @@ -0,0 +1,33 @@ +-- +-- test setting/clearing of the the execute file attribute works +-- +skip_if(ostype=="Windows") + +mtn_setup() + +writefile("foo", "some data") +check(mtn("add", "foo"), 0, false, false) +commit() +rev1 = base_revision() + +check(mtn("attr", "set", "foo", "mtn:execute", "true"), 0, false, false) +check({"test", "-x","foo"}, 0, false, false) +commit() +rev2 = base_revision() + +writefile("bar", "bar data") +check(mtn("add", "bar"), 0, false, false) +commit() +rev3 = base_revision() + +check(mtn("update", "-r", rev1), 0, false, false) +check({"test", "!", "-x","foo"}, 0, false, false) + +writefile("baz", "some data") +check(mtn("add", "baz"), 0, false, false) +commit() +rev4 = base_revision() + +-- pluck the revision that set foo's execute bits +check(mtn("pluck", "-r", rev2), 0, false, false) +check({"test", "-x","foo"}, 0, false, false) ============================================================ --- NEWS 0bad929ea63c745532616f7f7218f56eadf2aa93 +++ NEWS 8202c3016255d079485dbade377f0feea1ad276f @@ -73,6 +73,13 @@ - The update command previously did not clear execute permissions from files that had their associated 'mtn:execute' attribute cleared. + - Several minor problems with workspace attributes have been fixed. + Earlier versions of monotone would reset attributes such as + mtn:execute on all files when any workspace modifying command was + executed. Applying attribute changes to workspace files is now done + much more selectively in the same manner that content and name changes + are applied. + New features - The `mtn_automate' lua function now correctly parses and sets ============================================================ --- cmd_merging.cc 43295b660dbeef73009f01d85ceb7f0c3f5261b2 +++ cmd_merging.cc 8253dd6a55ffc02d922f4dc21b634802a1ac5a2d @@ -338,7 +338,6 @@ CMD(update, "update", "", CMD_REF(worksp // small race condition here... FIXME: what is it? work.put_update_id(old_rid); work.put_work_rev(remaining); - work.update_any_attrs(db); work.maybe_update_inodeprints(db); work.set_options(app.opts, true); @@ -842,7 +841,6 @@ CMD(merge_into_workspace, "merge_into_wo // small race condition here... work.perform_content_update(db, update, wca); work.put_work_rev(merged_rev); - work.update_any_attrs(db); work.maybe_update_inodeprints(db); P(F("updated to result of merge\n" @@ -1346,7 +1344,6 @@ CMD(pluck, "pluck", "", CMD_REF(workspac // small race condition here... work.put_work_rev(remaining); - work.update_any_attrs(db); // add a note to the user log file about what we did { ============================================================ --- cmd_netsync.cc ec8f8dad70788df8364337edbf02ef6d6c7080e4 +++ cmd_netsync.cc daaee53881abbda9c400148f4870098cb03508de @@ -453,10 +453,8 @@ CMD(clone, "clone", "", CMD_REF(network) make_cset(empty_roster, current_roster, checkout); content_merge_checkout_adaptor wca(db); - work.perform_content_update(db, checkout, wca, false); - work.update_any_attrs(db); work.maybe_update_inodeprints(db); guard.commit(); remove_on_fail.commit(); ============================================================ --- cmd_ws_commit.cc 0ab8f9138081d781fe1e341c7e7e9ff61c3ce0a6 +++ cmd_ws_commit.cc 24b0dc37e55ee1d3bce37c4d92708b4e026388b6 @@ -724,10 +724,8 @@ CMD(checkout, "checkout", "co", CMD_REF( make_cset(empty_roster, current_roster, checkout); content_merge_checkout_adaptor wca(db); - work.perform_content_update(db, checkout, wca, false); - work.update_any_attrs(db); work.maybe_update_inodeprints(db); guard.commit(); } @@ -1318,7 +1316,6 @@ CMD(commit, "commit", "ci", CMD_REF(work % prog_name); } - work.update_any_attrs(db); work.maybe_update_inodeprints(db); { ============================================================ --- tests/attr_mtn_execute/__driver__.lua 51c34985351d3f80ed3f3b42ca266f641be56625 +++ tests/attr_mtn_execute/__driver__.lua 2f6b3747ecf3673d185c8fe29c889aa029a7201e @@ -20,3 +20,15 @@ check({"test", "-x","foo"}, 0, false, fa check(mtn("update", "-r", with_x), 0, false, false) check({"test", "-x","foo"}, 0, false, false) + +-- test checkout with mtn:execute + +check(mtn("checkout", "checkout"), 0, false, false) +check(indir("checkout", {"test", "-x","foo"}, 0, false, false)) + +-- test clone with mtn:execute + +testURI="file:" .. test.root .. "/test.db" + +check(nodb_mtn("clone", testURI, "testbranch", "clone"), 0, false, true) +check(indir("clone", {"test", "-x","foo"}, 0, false, false)) ============================================================ --- work.cc ae2e7599c46af656b7f01058e90c501ffad0fd3d +++ work.cc 766cbbfd5b78c442ed6fc650846daa55f9d42768 @@ -1804,7 +1804,6 @@ workspace::perform_pivot_root(database & content_merge_empty_adaptor cmea; perform_content_update(db, cs, cmea); } - update_any_attrs(db); } void @@ -1841,27 +1840,6 @@ workspace::perform_content_update(databa delete_dir_shallow(detached); } -void -workspace::update_any_attrs(database & db) -{ - temp_node_id_source nis; - roster_t new_roster; - get_current_roster_shape(db, nis, new_roster); - node_map const & nodes = new_roster.all_nodes(); - for (node_map::const_iterator i = nodes.begin(); - i != nodes.end(); ++i) - { - file_path fp; - new_roster.get_name(i->first, fp); - - node_t n = i->second; - for (attr_map_t::const_iterator j = n->attrs.begin(); - j != n->attrs.end(); ++j) - if (j->second.first) - lua.hook_set_attribute(j->first(), fp, j->second.second()); - } -} - // Local Variables: // mode: C++ // fill-column: 76 ============================================================ --- work.hh e78bc57d1e78333c06e831ec917384eecbe3c44f +++ work.hh d6167a82e9e8fefa17d892c09af2ed0c78f8ded5 @@ -156,7 +156,6 @@ public: content_merge_adaptor const & ca, bool messages = true); - void update_any_attrs(database & db); void init_attributes(file_path const & path, editable_roster_base & er); bool has_changes(database & db);