You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2010/09/02 18:28:51 UTC
svn commit: r992007 - /subversion/trunk/subversion/libsvn_wc/upgrade.c
Author: philip
Date: Thu Sep 2 16:28:32 2010
New Revision: 992007
URL: http://svn.apache.org/viewvc?rev=992007&view=rev
Log:
Implement pre-1.7 working copy root check for upgrade.
* subversion/libsvn_wc/upgrade.c
(is_old_wcroot): New.
(svn_wc_upgrade): Check path is a working copy root.
Modified:
subversion/trunk/subversion/libsvn_wc/upgrade.c
Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=992007&r1=992006&r2=992007&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Thu Sep 2 16:28:32 2010
@@ -1583,6 +1583,44 @@ upgrade_working_copy(svn_wc__db_t *db,
}
+/* Return TRUE if LOCAL_ABSPATH is a pre-1.7 working copy root, FALSE
+ otherwise. */
+static svn_boolean_t
+is_old_wcroot(const char *local_abspath,
+ apr_pool_t *scratch_pool)
+{
+ apr_hash_t *entries;
+ const char *parent_abspath, *name;
+ svn_wc_entry_t *entry;
+ svn_error_t *err = svn_wc__read_entries_old(&entries, local_abspath,
+ scratch_pool, scratch_pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return FALSE;
+ }
+
+ svn_dirent_split(&parent_abspath, &name, local_abspath, scratch_pool);
+
+ err = svn_wc__read_entries_old(&entries, parent_abspath,
+ scratch_pool, scratch_pool);
+ if (err)
+ {
+ svn_error_clear(err);
+ return TRUE;
+ }
+
+ entry = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
+ if (!entry
+ || entry->absent
+ || (entry->deleted && entry->schedule != svn_wc_schedule_add))
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
svn_error_t *
svn_wc_upgrade(svn_wc_context_t *wc_ctx,
const char *local_abspath,
@@ -1596,9 +1634,6 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
{
svn_wc__db_t *db;
struct upgrade_data_t data = { NULL };
-#if 0
- svn_boolean_t is_wcroot;
-#endif
/* We need a DB that does not attempt an auto-upgrade, nor require
running a stale work queue. We'll handle everything manually. */
@@ -1606,15 +1641,10 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
NULL /* ### config */, FALSE, FALSE,
scratch_pool, scratch_pool));
- /* ### this expects a wc-ng working copy. sigh. fix up soonish... */
-#if 0
- SVN_ERR(svn_wc__strictly_is_wc_root(&is_wcroot, wc_ctx, local_abspath,
- scratch_pool));
- if (!is_wcroot)
+ if (!is_old_wcroot(local_abspath, scratch_pool))
return svn_error_create(
SVN_ERR_WC_INVALID_OP_ON_CWD, NULL,
- _("'svn upgrade' can only be run from the root of the working copy."));
-#endif
+ _("Upgrade can only be used on the root of a pre-1.7 working copy."));
/* Upgrade this directory and/or its subdirectories. */
SVN_ERR(upgrade_working_copy(db, local_abspath,