# # add_file "tests/t_add_vs_commit.at" # # add_file "tests/t_update_nonexistent.at" # # patch "ChangeLog" # from [3ab04183dd540cb0209d59b6a945d2c98a91fcff] # to [a4e2cd7768c78ad715c7f5425977a48c6cb82eef] # # patch "commands.cc" # from [958cd3bbc982aef81f63b90b24dcebaddf135166] # to [5c5ffeb1c705633a442c8abe9d14ffd03db99869] # # patch "tests/t_add_vs_commit.at" # from [] # to [7fd4b57e97609427e699e0cf3cca5c984ffd1330] # # patch "tests/t_netsync_defaults.at" # from [8f37b7de81c532b83851011586762f8c7fd91083] # to [09eba929e451e94f6075bd99fe75fc0469ba84e1] # # patch "tests/t_netsync_single.at" # from [1fa271a852629b392339705a3b6d5e143b7948c3] # to [faa5253849ae86d140b67fb93609d191456b0ec3] # # patch "tests/t_update_nonexistent.at" # from [] # to [a7f5255b645f8be25c40d15a62f9f5279bf2aa59] # # patch "testsuite.at" # from [d2d93700980437bc4d42f041d1d088c06b4e5200] # to [43031d5d196cfda4496ed11d9f46f448bc973697] # --- ChangeLog +++ ChangeLog @@ -15,6 +15,46 @@ 2005-04-16 Nathaniel Smith +2005-04-16 Nathaniel Smith + + * tests/t_update_nonexistent.at: New test. + * testsuite.at: Add it. + + * commands.cc (update): Verify that user's requested revision + exists. + +2005-04-16 Nathaniel Smith + + * ChangeLog: Fixup after merge. + +2005-04-16 Emile Snyder + + * tests/t_add_vs_commit.at: New test for failing case. If you + add a file in you working dir, someone else adds the same file + and commits, then you do an update it messes up your working + directory. + * testsuite.at: Add it. + +2005-04-16 Nathaniel Smith + + * commands.cc (checkout): Move check for existence of revision + earlier. + + * tests/t_netsync_defaults.at, tests/t_netsync_single.at: + Don't hard-code netsync port. + +2005-04-16 Nathaniel Smith + + * testsuite.at: Use a random server port. + + * .mt-attrs, contrib/README: Update for Notify.pl -> + monotone-notify.pl rename. + + * monotone.1: Warn people off rcs_import. + * monotone.texi (Commands): Likewise. + +2005-04-16 Nathaniel Smith + * AUTHORS: Add Emile Snyder . 2005-04-16 Nathaniel Smith --- commands.cc +++ commands.cc @@ -1793,6 +1793,9 @@ dir = idx(args, 1)(); complete(app, idx(args, 0)(), ident); + N(app.db.revision_exists(ident), + F("no revision %s found in database") % ident); + { cert_value b; guess_branch(ident, app, b); @@ -1824,9 +1827,6 @@ manifest_id mid; manifest_map m; - N(app.db.revision_exists(ident), - F("no revision %s found in database") % ident); - app.db.get_revision_manifest(ident, mid); put_revision_id(ident); @@ -3142,7 +3142,11 @@ r_chosen_id = *(candidates.begin()); } else - complete(app, idx(args, 0)(), r_chosen_id); + { + complete(app, idx(args, 0)(), r_chosen_id); + N(app.db.revision_exists(r_chosen_id), + F("no revision %s found in database") % r_chosen_id); + } if (r_old_id == r_chosen_id) { --- tests/t_add_vs_commit.at +++ tests/t_add_vs_commit.at @@ -0,0 +1,47 @@ +AT_SETUP([add working copy commit in another]) +MONOTONE_SETUP + +# This test is a bug report +AT_XFAIL_IF(true) + +# 1. Alice writes a file, does an add, *doesn't* do a commit, and sends patch +# 2. Bob applies (modified) patch to tree, does the add, then a commit. +# 3. Now Alice does an update (resolves the merge conflict, choosing Bob's changes). +# +# Alice's working dir now give I()'s when she tries to do stuff (diff, update, etc.). + +AT_DATA(initial, [some initial data +]) + +AT_DATA(foo.alice, [foo +change me +bar +]) + +AT_DATA(foo.bob, [foo +me change +bar +]) + +# Alice does her add +AT_CHECK(mkdir alicewd) +AT_CHECK(cp initial alicewd/initial) +AT_CHECK(MONOTONE --branch=testbranch setup alicewd, [], [ignore], [ignore]) +AT_CHECK( (cd alicewd; MONOTONE --root=. add initial), [], [ignore], [ignore]) +AT_CHECK( (cd alicewd; MONOTONE --root=. commit -m 'initial commit'), [], [ignore], [ignore]) +AT_CHECK(cp foo.alice alicewd/foo) +AT_CHECK( (cd alicewd; MONOTONE add --root=. foo), [], [ignore], [ignore]) +# Note, alice does not commit this add... + +# Bob does add of same file, with edits, and commits +AT_CHECK(MONOTONE --branch=testbranch checkout bobwd, [], [ignore], [ignore]) +AT_CHECK(cp foo.bob bobwd/foo) +AT_CHECK( (cd bobwd; MONOTONE --root=. add foo), [], [ignore], [ignore]) +AT_CHECK( (cd bobwd; MONOTONE --root=. commit -m 'bob commit'), [], [ignore], [ignore]) +REV=`BASE_REVISION` + +# Alice does her update, then attempts, eg., a diff +AT_CHECK( (cd alicewd; MONOTONE --root=. update $REV), [], [ignore], [ignore]) +AT_CHECK( (cd alicewd; MONOTONE --root=. diff), [], [ignore], [ignore]) + +AT_CLEANUP --- tests/t_netsync_defaults.at +++ tests/t_netsync_defaults.at @@ -35,7 +35,7 @@ AT_CHECK(test -f testdir2/testfile) # And finally, -AT_CHECK(MONOTONE2 set database default-server 127.0.0.1:5555, [], [ignore], [ignore]) +AT_CHECK(MONOTONE2 set database default-server 127.0.0.1:$_PORT, [], [ignore], [ignore]) AT_CHECK(MONOTONE2 set database default-collection thirdbranch, [], [ignore], [ignore]) AT_CHECK(MONOTONE2 sync, [], [ignore], [ignore]) AT_CHECK(MONOTONE2 checkout --branch=thirdbranch $THIRDBRANCH_R testdir3, [], [ignore], [ignore]) --- tests/t_netsync_single.at +++ tests/t_netsync_single.at @@ -24,9 +24,9 @@ VER0=`BASE_REVISION` NETSYNC_KILLHARD - MONOTONE --rcfile=netsync.lua serve 127.0.0.1:5555 testbranch & + MONOTONE --rcfile=netsync.lua serve 127.0.0.1:$_PORT testbranch & sleep 5 -AT_CHECK(MONOTONE --rcfile=netsync.lua --db=test2.db pull 127.0.0.1:5555 testbranch, [], [ignore], [ignore]) +AT_CHECK(MONOTONE --rcfile=netsync.lua --db=test2.db pull 127.0.0.1:$_PORT testbranch, [], [ignore], [ignore]) NETSYNC_KILLHARD AT_CHECK(MONOTONE --db=test2.db ls certs $VER0, [], [stdout]) --- tests/t_update_nonexistent.at +++ tests/t_update_nonexistent.at @@ -0,0 +1,10 @@ +AT_SETUP([update to non-existent rev]) +MONOTONE_SETUP + +ADD_FILE(testfile, [blah blah +]) +COMMIT(testbranch) + +AT_CHECK(MONOTONE update 73070030f7b0d0f3d4ee02545d45ca4bbe5e189f, [1], [ignore], [ignore]) + +AT_CLEANUP --- testsuite.at +++ testsuite.at @@ -559,3 +559,5 @@ m4_include(tests/t_rcs_import.at) m4_include(tests/t_cvsimport2.at) m4_include(tests/t_lf_crlf.at) +m4_include(tests/t_add_vs_commit.at) +m4_include(tests/t_update_nonexistent.at)