| 1 |
* Do not fail 'svn up' if it has to remove a directory with unversioned
|
| 2 |
files or localy modified ones. For further information see:
|
| 3 |
http://subversion.tigris.org/issues/show_bug.cgi?id=1806
|
| 4 |
|
| 5 |
diff -Nur subversion-1.0.9.orig/subversion/libsvn_wc/log.c subversion-1.0.9/subversion/libsvn_wc/log.c
|
| 6 |
--- subversion-1.0.9.orig/subversion/libsvn_wc/log.c 2004-03-31 21:48:02.000000000 +0000
|
| 7 |
+++ subversion-1.0.9/subversion/libsvn_wc/log.c 2004-10-21 19:42:46.000000000 +0000
|
| 8 |
@@ -601,7 +601,7 @@
|
| 9 |
err = svn_wc_remove_from_revision_control (adm_access,
|
| 10 |
SVN_WC_ENTRY_THIS_DIR,
|
| 11 |
TRUE, /* destroy */
|
| 12 |
- TRUE, /* instant_error */
|
| 13 |
+ FALSE, /* instant_error */
|
| 14 |
NULL, NULL,
|
| 15 |
loggy->pool);
|
| 16 |
}
|
| 17 |
@@ -610,12 +610,18 @@
|
| 18 |
{
|
| 19 |
err = svn_wc_remove_from_revision_control (loggy->adm_access, name,
|
| 20 |
TRUE, /* destroy */
|
| 21 |
- TRUE, /* instant_error */
|
| 22 |
+ FALSE, /* instant_error */
|
| 23 |
NULL, NULL,
|
| 24 |
loggy->pool);
|
| 25 |
}
|
| 26 |
|
| 27 |
- return err;
|
| 28 |
+ if ((err) && (err->apr_err == SVN_ERR_WC_LEFT_LOCAL_MOD))
|
| 29 |
+ {
|
| 30 |
+ svn_error_clear (err);
|
| 31 |
+ return SVN_NO_ERROR;
|
| 32 |
+ }
|
| 33 |
+ else
|
| 34 |
+ return err;
|
| 35 |
}
|
| 36 |
|
| 37 |
/* Note: assuming that svn_wc__log_commit() is what created all of
|
| 38 |
diff -Nur subversion-1.0.9.orig/subversion/libsvn_wc/update_editor.c subversion-1.0.9/subversion/libsvn_wc/update_editor.c
|
| 39 |
--- subversion-1.0.9.orig/subversion/libsvn_wc/update_editor.c 2004-03-12 02:10:01.000000000 +0000
|
| 40 |
+++ subversion-1.0.9/subversion/libsvn_wc/update_editor.c 2004-10-21 19:37:34.000000000 +0000
|
| 41 |
@@ -809,23 +809,6 @@
|
| 42 |
logfile_path = svn_wc__adm_path (parent_path, FALSE, pool,
|
| 43 |
SVN_WC__ADM_LOG, NULL);
|
| 44 |
|
| 45 |
- /* If trying to delete a locally-modified file, throw an 'obstructed
|
| 46 |
- update' error. */
|
| 47 |
- if (kind == svn_node_file)
|
| 48 |
- {
|
| 49 |
- svn_boolean_t tmodified_p, pmodified_p;
|
| 50 |
- SVN_ERR (svn_wc_text_modified_p (&tmodified_p, full_path, FALSE,
|
| 51 |
- adm_access, pool));
|
| 52 |
- SVN_ERR (svn_wc_props_modified_p (&pmodified_p, full_path,
|
| 53 |
- adm_access, pool));
|
| 54 |
-
|
| 55 |
- if (tmodified_p || pmodified_p)
|
| 56 |
- return svn_error_createf
|
| 57 |
- (SVN_ERR_WC_OBSTRUCTED_UPDATE, NULL,
|
| 58 |
- "Won't delete locally modified file '%s'",
|
| 59 |
- base_name);
|
| 60 |
- }
|
| 61 |
-
|
| 62 |
SVN_ERR (svn_wc__open_adm_file (&log_fp,
|
| 63 |
parent_path,
|
| 64 |
SVN_WC__ADM_LOG,
|
| 65 |
diff -Nur subversion-1.0.9.orig/subversion/tests/clients/cmdline/switch_tests.py subversion-1.0.9/subversion/tests/clients/cmdline/switch_tests.py
|
| 66 |
--- subversion-1.0.9.orig/subversion/tests/clients/cmdline/switch_tests.py 2004-03-12 02:10:01.000000000 +0000
|
| 67 |
+++ subversion-1.0.9/subversion/tests/clients/cmdline/switch_tests.py 2004-10-21 19:42:46.000000000 +0000
|
| 68 |
@@ -635,7 +635,8 @@
|
| 69 |
psi_path = os.path.join(H_path, 'psi')
|
| 70 |
svntest.main.file_append(psi_path, "more text")
|
| 71 |
|
| 72 |
- # This switch will fail as it will not delete psi with local mods
|
| 73 |
+ # This switch leaves psi unversioned, because of the local mods,
|
| 74 |
+ # then fails because it tries to add a directory of the same name.
|
| 75 |
out, err = svntest.main.run_svn(1, 'switch',
|
| 76 |
'--username', svntest.main.wc_author,
|
| 77 |
'--password', svntest.main.wc_passwd,
|
| 78 |
@@ -645,11 +646,16 @@
|
| 79 |
|
| 80 |
# Some items under H show up as switched because, while H itself was
|
| 81 |
# switched, the switch command failed before it reached all items
|
| 82 |
+ #
|
| 83 |
+ # NOTE: I suspect this whole test is dependent on the order in
|
| 84 |
+ # which changes are received, but since the new psi is a dir, it
|
| 85 |
+ # appears we can count on it being received last. But if this test
|
| 86 |
+ # ever starts failing, you read it here first :-).
|
| 87 |
expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
|
| 88 |
expected_status.tweak(wc_rev=1)
|
| 89 |
expected_status.tweak('A/D/H', status='! ', switched='S', wc_rev=2)
|
| 90 |
expected_status.tweak('A/D/H/chi', 'A/D/H/omega', switched='S')
|
| 91 |
- expected_status.tweak('A/D/H/psi', status='M ', switched='S')
|
| 92 |
+ expected_status.remove('A/D/H/psi')
|
| 93 |
expected_status.add({
|
| 94 |
'A/D/H/pi' : Item(status=' ', wc_rev=2, repos_rev=2),
|
| 95 |
'A/D/H/tau' : Item(status=' ', wc_rev=2, repos_rev=2),
|
| 96 |
@@ -657,8 +663,8 @@
|
| 97 |
})
|
| 98 |
svntest.actions.run_and_verify_status(wc_dir, expected_status)
|
| 99 |
|
| 100 |
- # At one stage the failed switch left the wrong URL in the target
|
| 101 |
- # directory H.
|
| 102 |
+ # There was a bug whereby the failed switch left the wrong URL in
|
| 103 |
+ # the target directory H. Check for that.
|
| 104 |
out, err = svntest.actions.run_and_verify_svn(None, None, [], 'info', H_path)
|
| 105 |
for line in out:
|
| 106 |
if line.find('URL: ' + G_url) != -1:
|
| 107 |
@@ -666,8 +672,9 @@
|
| 108 |
else:
|
| 109 |
raise svntest.Failure
|
| 110 |
|
| 111 |
- # Revert local mod and repeat the switch
|
| 112 |
- svntest.actions.run_and_verify_svn(None, None, [], 'revert', psi_path)
|
| 113 |
+ # Remove the now-unversioned psi, and repeat the switch. This
|
| 114 |
+ # should complete the switch.
|
| 115 |
+ os.remove(psi_path)
|
| 116 |
svntest.actions.run_and_verify_svn(None, None, [], 'switch',
|
| 117 |
'--username', svntest.main.wc_author,
|
| 118 |
'--password', svntest.main.wc_passwd,
|
| 119 |
@@ -675,9 +682,13 @@
|
| 120 |
|
| 121 |
expected_status.remove('A/D/H/chi', 'A/D/H/omega')
|
| 122 |
expected_status.tweak('A/D/H', status=' ') # remains switched
|
| 123 |
- expected_status.tweak('A/D/H/psi', status=' ', switched=None, wc_rev=2)
|
| 124 |
+ expected_status.add({ 'A/D/H/psi' : Item(status=' ',
|
| 125 |
+ switched=None,
|
| 126 |
+ repos_rev=2,
|
| 127 |
+ wc_rev=2) })
|
| 128 |
svntest.actions.run_and_verify_status(wc_dir, expected_status)
|
| 129 |
|
| 130 |
+
|
| 131 |
########################################################################
|
| 132 |
# Run the tests
|
| 133 |
|
| 134 |
diff -Nur subversion-1.0.9.orig/subversion/tests/clients/cmdline/update_tests.py subversion-1.0.9/subversion/tests/clients/cmdline/update_tests.py
|
| 135 |
--- subversion-1.0.9.orig/subversion/tests/clients/cmdline/update_tests.py 2004-01-09 22:07:57.000000000 +0000
|
| 136 |
+++ subversion-1.0.9/subversion/tests/clients/cmdline/update_tests.py 2004-10-21 19:42:22.000000000 +0000
|
| 137 |
@@ -680,17 +680,31 @@
|
| 138 |
|
| 139 |
svntest.actions.run_and_verify_status(wc_dir, expected_status)
|
| 140 |
|
| 141 |
- # Update that 'deletes' modified files. We should get an
|
| 142 |
- # 'obstructed update' error (see issue #1196).
|
| 143 |
- output, errput = svntest.actions.run_and_verify_svn(
|
| 144 |
- "Updating failed", None, SVNAnyOutput, 'up', wc_dir)
|
| 145 |
-
|
| 146 |
- for line in errput:
|
| 147 |
- if re.match("svn: Won't delete locally modified file 'alpha'", line):
|
| 148 |
- return
|
| 149 |
-
|
| 150 |
- # Else never matched the expected error output, so the test failed.
|
| 151 |
- raise svntest.main.SVNUnmatchedError
|
| 152 |
+ # Now update to 'delete' modified files -- that is, remove them from
|
| 153 |
+ # version control, but leave them on disk. It used to be we would
|
| 154 |
+ # expect an 'obstructed update' error (see issue #1196), but
|
| 155 |
+ # nowadays we expect success (see issue #1806).
|
| 156 |
+ expected_output = svntest.wc.State(wc_dir, {
|
| 157 |
+ 'A/B/E/alpha' : Item(status='D '),
|
| 158 |
+ 'A/D/G' : Item(status='D '),
|
| 159 |
+ })
|
| 160 |
+ expected_disk = svntest.main.greek_state.copy()
|
| 161 |
+ expected_disk.tweak('A/B/E/alpha',
|
| 162 |
+ contents="This is the file 'alpha'.appended alpha text")
|
| 163 |
+ expected_disk.tweak('A/D/G/pi',
|
| 164 |
+ contents="This is the file 'pi'.appended pi text")
|
| 165 |
+ expected_disk.remove('A/D/G/rho')
|
| 166 |
+ expected_disk.remove('A/D/G/tau')
|
| 167 |
+ expected_status = svntest.actions.get_virginal_state(wc_dir, 2)
|
| 168 |
+ expected_status.remove('A/B/E/alpha')
|
| 169 |
+ expected_status.remove('A/D/G')
|
| 170 |
+ expected_status.remove('A/D/G/pi')
|
| 171 |
+ expected_status.remove('A/D/G/rho')
|
| 172 |
+ expected_status.remove('A/D/G/tau')
|
| 173 |
+ svntest.actions.run_and_verify_update(wc_dir,
|
| 174 |
+ expected_output,
|
| 175 |
+ expected_disk,
|
| 176 |
+ expected_status)
|
| 177 |
|
| 178 |
#----------------------------------------------------------------------
|
| 179 |
|