|
svn commit: r13151 - in trunk/subversion: libsvn_client tests/clients/cmdli: msg#00331version-control.subversion.svn
Author: jszakmeister Date: Fri Feb 25 05:58:11 2005 New Revision: 13151 Modified: trunk/subversion/libsvn_client/export.c trunk/subversion/tests/clients/cmdline/export_tests.py Log: Fix Issue #2226 (exporting deleted directories from wc produces empty dirs). This also fixes 'svn export -rBASE' from the working copy with items scheduled for deletion, Added a couple of tests so that we avoid breaking these in the future. * subversion/libsvn_client/export.c (copy_one_versioned_file): Don't export deleted files when exporting at revision WORKING from a working copy. Updated the comment accordingly. (copy_versioned_files): Don't export deleted files when exporting at revision WORKING from a working copy. Updated the comment accordingly. Also, stop walking through the main working copy area to collect the list of files to export, and use the entries files instead. * subversion/tests/clients/cmdline/export_tests.py (export_working_copy_with_mods, export_working_copy_at_base_revision): Remove a couple of files and directories to test a couple more edge cases in the export code. Modified: trunk/subversion/libsvn_client/export.c Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/libsvn_client/export.c?view=diff&rev=13151&p1=trunk/subversion/libsvn_client/export.c&r1=13150&p2=trunk/subversion/libsvn_client/export.c&r2=13151 ============================================================================== --- trunk/subversion/libsvn_client/export.c (original) +++ trunk/subversion/libsvn_client/export.c Fri Feb 25 05:58:11 2005 @@ -119,9 +119,18 @@ /* Only export 'added' files when the revision is WORKING. Otherwise, skip the 'added' files, since they didn't exist - in the BASE revision and don't have an associated text-base. */ - if (! entry || (revision->kind != svn_opt_revision_working && - entry->schedule == svn_wc_schedule_add)) + in the BASE revision and don't have an associated text-base. + + Don't export 'deleted' files and directories unless it's a + revision other than WORKING. These files and directories + don't really exists in WORKING. + + Finally, don't export an unversioned item. */ + if (! entry || + (revision->kind != svn_opt_revision_working && + entry->schedule == svn_wc_schedule_add) || + (revision->kind == svn_opt_revision_working && + entry->schedule == svn_wc_schedule_delete)) return SVN_NO_ERROR; if (revision->kind != svn_opt_revision_working) @@ -223,7 +232,7 @@ const svn_wc_entry_t *entry; svn_error_t *err; apr_pool_t *iterpool; - apr_hash_t *dirents; + apr_hash_t *entries; apr_hash_index_t *hi; apr_finfo_t finfo; @@ -246,11 +255,17 @@ return SVN_NO_ERROR; } - /* Only export entries with the 'added' status if revision - is WORKING. Otherwise, skip it, as it doesn't exist in any - revision other than WORKING. */ - if (revision->kind != svn_opt_revision_working && - entry->schedule == svn_wc_schedule_add) + /* Only export 'added' files when the revision is WORKING. + Otherwise, skip the 'added' files, since they didn't exist + in the BASE revision and don't have an associated text-base. + + Don't export 'deleted' files and directories unless it's a + revision other than WORKING. These files and directories + don't really exists in WORKING. */ + if ((revision->kind != svn_opt_revision_working && + entry->schedule == svn_wc_schedule_add) || + (revision->kind == svn_opt_revision_working && + entry->schedule == svn_wc_schedule_delete)) return SVN_NO_ERROR; if (entry->kind == svn_node_dir) @@ -271,12 +286,11 @@ svn_error_clear (err); } - SVN_ERR (svn_io_get_dirents (&dirents, from, pool)); + SVN_ERR (svn_wc_entries_read (&entries, adm_access, TRUE, pool)); iterpool = svn_pool_create (pool); - for (hi = apr_hash_first (pool, dirents); hi; hi = apr_hash_next (hi)) + for (hi = apr_hash_first (pool, entries); hi; hi = apr_hash_next (hi)) { - const svn_node_kind_t *type; const char *item; const void *key; void *val; @@ -286,7 +300,7 @@ apr_hash_this (hi, &key, NULL, &val); item = key; - type = val; + entry = val; if (ctx->cancel_func) SVN_ERR (ctx->cancel_func (ctx->cancel_baton)); @@ -294,11 +308,12 @@ /* ### We could also invoke ctx->notify_func somewhere in ### here... Is it called for, though? Not sure. */ - if (*type == svn_node_dir) + if (entry->kind == svn_node_dir) { - if (strcmp (item, SVN_WC_ADM_DIR_NAME) == 0) + if (strcmp (item, SVN_WC_ENTRY_THIS_DIR) == 0) { - ; /* skip this, it's an administrative directory. */ + ; /* skip this, it's the current directory that we're + handling now. */ } else { @@ -315,7 +330,7 @@ } } } - else if (*type == svn_node_file) + else if (entry->kind == svn_node_file) { const char *new_from = svn_path_join (from, item, iterpool); const char *new_to = svn_path_join (to, item, iterpool); Modified: trunk/subversion/tests/clients/cmdline/export_tests.py Url: http://svn.collab.net/viewcvs/svn/trunk/subversion/tests/clients/cmdline/export_tests.py?view=diff&rev=13151&p1=trunk/subversion/tests/clients/cmdline/export_tests.py&r1=13150&p2=trunk/subversion/tests/clients/cmdline/export_tests.py&r2=13151 ============================================================================== --- trunk/subversion/tests/clients/cmdline/export_tests.py (original) +++ trunk/subversion/tests/clients/cmdline/export_tests.py Fri Feb 25 05:58:11 2005 @@ -85,12 +85,15 @@ mu_path = os.path.join(wc_dir, 'A', 'mu') rho_path = os.path.join(wc_dir, 'A', 'D', 'G', 'rho') kappa_path = os.path.join(wc_dir, 'kappa') + gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma') + E_path = os.path.join(wc_dir, 'A', 'B', 'E') svntest.main.file_append(mu_path, 'appended mu text') svntest.main.file_append(rho_path, 'new appended text for rho') svntest.main.file_append(kappa_path, "This is the file 'kappa'.") svntest.main.run_svn(None, 'add', kappa_path) + svntest.main.run_svn(None, 'rm', E_path, gamma_path) expected_disk = svntest.main.greek_state.copy() expected_disk.tweak('A/mu', @@ -100,6 +103,7 @@ contents=expected_disk.desc['A/D/G/rho'].contents + 'new appended text for rho') expected_disk.add({'kappa' : Item("This is the file 'kappa'.")}) + expected_disk.remove('A/B/E/alpha', 'A/B/E/beta', 'A/B/E', 'A/D/gamma') export_target = sbox.add_wc_path('export') @@ -254,6 +258,8 @@ mu_path = os.path.join(wc_dir, 'A', 'mu') kappa_path = os.path.join(wc_dir, 'kappa') + gamma_path = os.path.join(wc_dir, 'A', 'D', 'gamma') + E_path = os.path.join(wc_dir, 'A', 'B', 'E') # Appends some text to A/mu, and add a new file # called kappa. These modifications should *not* @@ -261,6 +267,7 @@ svntest.main.file_append(mu_path, 'Appended text') svntest.main.file_append(kappa_path, "This is the file 'kappa'.") svntest.main.run_svn(None, 'add', kappa_path) + svntest.main.run_svn(None, 'rm', E_path, gamma_path) # Note that we don't tweak the expected disk tree at all, # since the appended text and kappa should not be present. |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | svn commit: r13150 - trunk/subversion/libsvn_repos: 00331, nori-jqHnx1hy4Dsdnm+yROfE0A |
|---|---|
| Next by Date: | svn commit: r13152 - trunk/subversion/po: 00331, nori-jqHnx1hy4Dsdnm+yROfE0A |
| Previous by Thread: | svn commit: r13150 - trunk/subversion/libsvn_reposi: 00331, nori-jqHnx1hy4Dsdnm+yROfE0A |
| Next by Thread: | svn commit: r13152 - trunk/subversion/po: 00331, nori-jqHnx1hy4Dsdnm+yROfE0A |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |