Return-Path: X-Original-To: apmail-subversion-commits-archive@minotaur.apache.org Delivered-To: apmail-subversion-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 544759605 for ; Fri, 23 Sep 2011 13:02:51 +0000 (UTC) Received: (qmail 62096 invoked by uid 500); 23 Sep 2011 13:02:51 -0000 Delivered-To: apmail-subversion-commits-archive@subversion.apache.org Received: (qmail 62073 invoked by uid 500); 23 Sep 2011 13:02:51 -0000 Mailing-List: contact commits-help@subversion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@subversion.apache.org Delivered-To: mailing list commits@subversion.apache.org Received: (qmail 62066 invoked by uid 99); 23 Sep 2011 13:02:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Sep 2011 13:02:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Sep 2011 13:02:46 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 095D5238897A for ; Fri, 23 Sep 2011 13:02:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1174725 - in /subversion/branches/1.7.x-i4016: ./ subversion/include/private/svn_wc_private.h subversion/libsvn_client/cleanup.c subversion/libsvn_wc/upgrade.c subversion/libsvn_wc/wc_db.c subversion/libsvn_wc/wc_db.h Date: Fri, 23 Sep 2011 13:02:23 -0000 To: commits@subversion.apache.org From: neels@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20110923130224.095D5238897A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: neels Date: Fri Sep 23 13:02:22 2011 New Revision: 1174725 URL: http://svn.apache.org/viewvc?rev=1174725&view=rev Log: Merge r1174342, part one of issue #4016 fix. Issue #4016. Try to find proper URL information on externals during upgrade. Do this after the entire upgrade ran through, as repository information is easiest to obtain after all the rest has been upgraded. (This might obsolete some parts of the existing externals prop upgrade code. But removing is for another patch, and might just be micro-optimization.) * subversion/libsvn_client/cleanup.c (svn_client_upgrade): Fetch all URL and revisions information from upgraded externals' working copies, or from fetch_repos_info() if not checked out yet. This properly populates the EXTERNALS table rows for upgraded externals of all kinds. Furthermore, change error handling in the externals upgrade loop so that one externals failure does not abort upgrade of other externals. * subversion/include/private/svn_wc_private.h, * subversion/libsvn_wc/upgrade.c (svn_wc__upgrade_add_external_info): New function. * subversion/libsvn_wc/wc_db.h, * subversion/libsvn_wc/wc_db.c (svn_wc__db_upgrade_insert_external): New function. Modified: subversion/branches/1.7.x-i4016/ (props changed) subversion/branches/1.7.x-i4016/subversion/include/private/svn_wc_private.h subversion/branches/1.7.x-i4016/subversion/libsvn_client/cleanup.c subversion/branches/1.7.x-i4016/subversion/libsvn_wc/upgrade.c subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.c subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.h Propchange: subversion/branches/1.7.x-i4016/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Fri Sep 23 13:02:22 2011 @@ -64,4 +64,4 @@ /subversion/branches/tree-conflicts:868291-873154 /subversion/branches/tree-conflicts-notify:873926-874008 /subversion/branches/uris-as-urls:1060426-1064427 -/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147299,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,115 8187,1158193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158924,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1162974,1162995,1163557,1163792,1163953,1164027,1164517,1164535,1164554,1164580,1164645,1164760,1164765,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1169524,1169531,1169650,1171708,1173111,1173574,1174051,1174060 +/subversion/trunk:1146013,1146121,1146219,1146222,1146274,1146492,1146555,1146606,1146620,1146684,1146781,1146832,1146834,1146870,1146899,1146904,1147293,1147299,1147309,1147882,1148071,1148083,1148094,1148131,1148374,1148424,1148566,1148588,1148853,1148877,1148882,1148936,1149105,1149141,1149160,1149228,1149240,1149343,1149371-1149372,1149377,1149398,1149401,1149539,1149572,1149627,1149675,1149701,1149713,1150242,1150254,1150260-1150261,1150266,1150302,1150327,1150368,1150372,1150441,1150506,1150812,1150853,1151036,1151177,1151610,1151906,1151911,1152129,1152140,1152189-1152190,1152267,1152282,1152286,1152726,1152809,1153138,1153141,1153416,1153799,1153807,1153968,1154009,1154023,1154115,1154119,1154121,1154144,1154155,1154159,1154165,1154215,1154225,1154273,1154461,1154717-1154718,1154733,1154908,1154982,1155015,1155044,1155124,1155131,1155160,1155313,1155334,1155391,1155404,1156085,1156098,1156216,1156218,1156312,1156527,1156717,1156721,1156750,1156827,1156838,1157416,115 8187,1158193-1158194,1158196,1158201,1158207,1158209-1158210,1158217,1158285,1158288,1158303,1158309,1158407,1158419,1158421,1158436,1158455,1158616-1158617,1158634,1158854,1158875,1158886,1158893,1158896,1158919,1158924,1158963,1159093,1159098,1159101,1159132,1159136,1159148,1159230,1159275,1159400,1159686,1159760,1159772,1160605,1160671,1160682,1160704-1160705,1160756,1161063,1161080,1161185,1161210,1161683,1161721,1162024,1162033,1162201,1162516,1162880,1162974,1162995,1163557,1163792,1163953,1164027,1164517,1164535,1164554,1164580,1164645,1164760,1164765,1166500,1166555,1166678,1167062,1167173,1167209,1167269,1167503,1169524,1169531,1169650,1171708,1173111,1173574,1174051,1174060,1174342 Modified: subversion/branches/1.7.x-i4016/subversion/include/private/svn_wc_private.h URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-i4016/subversion/include/private/svn_wc_private.h?rev=1174725&r1=1174724&r2=1174725&view=diff ============================================================================== --- subversion/branches/1.7.x-i4016/subversion/include/private/svn_wc_private.h (original) +++ subversion/branches/1.7.x-i4016/subversion/include/private/svn_wc_private.h Fri Sep 23 13:02:22 2011 @@ -1096,6 +1096,21 @@ svn_wc__get_info(svn_wc_context_t *wc_ct void *cancel_baton, apr_pool_t *scratch_pool); +/* During an upgrade to wc-ng, supply known details about an existing + * external. The working copy will suck in and store the information supplied + * about the existing external at @a local_abspath. */ +svn_error_t * +svn_wc__upgrade_add_external_info(svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_node_kind_t kind, + const char *def_local_abspath, + const char *repos_relpath, + const char *repos_root_url, + const char *repos_uuid, + svn_revnum_t def_peg_revision, + svn_revnum_t def_revision, + apr_pool_t *scratch_pool); + #ifdef __cplusplus } #endif /* __cplusplus */ Modified: subversion/branches/1.7.x-i4016/subversion/libsvn_client/cleanup.c URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-i4016/subversion/libsvn_client/cleanup.c?rev=1174725&r1=1174724&r2=1174725&view=diff ============================================================================== --- subversion/branches/1.7.x-i4016/subversion/libsvn_client/cleanup.c (original) +++ subversion/branches/1.7.x-i4016/subversion/libsvn_client/cleanup.c Fri Sep 23 13:02:22 2011 @@ -171,7 +171,12 @@ svn_client_upgrade(const char *path, svn_wc_external_item2_t *item; const char *external_abspath; const char *external_path; + const char *repos_relpath; + const char *repos_root_url; + const char *repos_uuid; svn_node_kind_t kind; + svn_revnum_t peg_revision; + svn_revnum_t revision; svn_error_t *err; item = APR_ARRAY_IDX(externals_p, i, svn_wc_external_item2_t*); @@ -180,8 +185,10 @@ svn_client_upgrade(const char *path, external_path = svn_dirent_join(externals_parent, item->target_dir, iterpool2); - SVN_ERR(svn_dirent_get_absolute(&external_abspath, external_path, - iterpool2)); + err = svn_dirent_get_absolute(&external_abspath, external_path, + iterpool2); + if (err) + goto handle_error; /* This is hack. We can only send dirs to svn_wc_upgrade(). This way we will get an exception saying that the wc must be @@ -195,10 +202,106 @@ svn_client_upgrade(const char *path, { svn_error_clear(err); - SVN_ERR(svn_client_upgrade(external_abspath, ctx, iterpool2)); + err = svn_client_upgrade(external_abspath, ctx, iterpool2); + } + + if (err) + goto handle_error; + + /* The upgrade of any dir should be done now, get the (supposedly + * now reliable) kind. */ + err = svn_wc_read_kind(&kind, ctx->wc_ctx, external_abspath, + FALSE, iterpool2); + if (err) + goto handle_error; + + /* Update the EXTERNALS table according to the root URL, + * relpath and uuid known in the upgraded external WC. */ + + /* We should probably have a function that provides all three + * of root URL, repos relpath and uuid at once, but here goes... */ + + /* First get the relpath, as that returns SVN_ERR_WC_PATH_NOT_FOUND + * when the node is not present in the file system. + * (svn_wc__node_get_repos_info() would try to derive the URL). */ + err = svn_wc__node_get_repos_relpath(&repos_relpath, + ctx->wc_ctx, + external_abspath, + iterpool2, iterpool2); + if (! err) + { + /* We got a repos relpath from a WC. So also get the root. */ + err = svn_wc__node_get_repos_info(&repos_root_url, + &repos_uuid, + ctx->wc_ctx, + external_abspath, + iterpool2, iterpool2); + } + else if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND) + { + /* The external is not currently checked out. Try to figure out + * the URL parts via the defined URL and fetch_repos_info(). */ + svn_error_clear(err); + + /* The repos root / uuid from above get_repos_info() call, if it + * was successful, has returned the URL as derived from the WC's + * parent path, which is not what we want for the external. Only + * makes sense for added/deleted/not-present files. So make sure + * those values are not used. */ + repos_root_url = NULL; + repos_relpath = NULL; + + err = fetch_repos_info(&repos_root_url, + &repos_uuid, + &info_baton, + item->url, + scratch_pool, scratch_pool); + if (err) + goto handle_error; + + + repos_relpath = svn_uri_skip_ancestor(repos_root_url, item->url, + iterpool2); + + /* There's just this URL, no idea what kind it is. */ + kind = svn_node_unknown; + } + + if (err) + goto handle_error; + + peg_revision = (item->peg_revision.kind == svn_opt_revision_number + ? item->peg_revision.value.number + : SVN_INVALID_REVNUM); + + revision = (item->revision.kind == svn_opt_revision_number + ? item->revision.value.number + : SVN_INVALID_REVNUM); + + err = svn_wc__upgrade_add_external_info(ctx->wc_ctx, + external_abspath, + kind, + externals_parent, + repos_relpath, + repos_root_url, + repos_uuid, + peg_revision, + revision, + iterpool2); +handle_error: + if (err) + { + svn_wc_notify_t *notify = + svn_wc_create_notify(external_abspath, + svn_wc_notify_failed_external, + scratch_pool); + notify->err = err; + + ctx->notify_func2(ctx->notify_baton2, + notify, scratch_pool); + + svn_error_clear(err); } - else - SVN_ERR(err); } } Modified: subversion/branches/1.7.x-i4016/subversion/libsvn_wc/upgrade.c URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-i4016/subversion/libsvn_wc/upgrade.c?rev=1174725&r1=1174724&r2=1174725&view=diff ============================================================================== --- subversion/branches/1.7.x-i4016/subversion/libsvn_wc/upgrade.c (original) +++ subversion/branches/1.7.x-i4016/subversion/libsvn_wc/upgrade.c Fri Sep 23 13:02:22 2011 @@ -1985,3 +1985,44 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx, return SVN_NO_ERROR; } +svn_error_t * +svn_wc__upgrade_add_external_info(svn_wc_context_t *wc_ctx, + const char *local_abspath, + svn_node_kind_t kind, + const char *def_local_abspath, + const char *repos_relpath, + const char *repos_root_url, + const char *repos_uuid, + svn_revnum_t def_peg_revision, + svn_revnum_t def_revision, + apr_pool_t *scratch_pool) +{ + svn_wc__db_kind_t db_kind; + switch (kind) + { + case svn_node_dir: + db_kind = svn_wc__db_kind_dir; + break; + + case svn_node_file: + db_kind = svn_wc__db_kind_file; + break; + + case svn_node_unknown: + db_kind = svn_wc__db_kind_unknown; + break; + + default: + SVN_ERR_MALFUNCTION(); + } + + SVN_ERR(svn_wc__db_upgrade_insert_external(wc_ctx->db, local_abspath, + db_kind, + svn_dirent_dirname(local_abspath, + scratch_pool), + def_local_abspath, repos_relpath, + repos_root_url, repos_uuid, + def_peg_revision, def_revision, + scratch_pool)); + return SVN_NO_ERROR; +} Modified: subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.c URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.c?rev=1174725&r1=1174724&r2=1174725&view=diff ============================================================================== --- subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.c (original) +++ subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.c Fri Sep 23 13:02:22 2011 @@ -9888,6 +9888,79 @@ svn_wc__db_upgrade_apply_props(svn_sqlit return SVN_NO_ERROR; } +svn_error_t * +svn_wc__db_upgrade_insert_external(svn_wc__db_t *db, + const char *local_abspath, + svn_wc__db_kind_t kind, + const char *parent_abspath, + const char *def_local_abspath, + const char *repos_relpath, + const char *repos_root_url, + const char *repos_uuid, + svn_revnum_t def_peg_revision, + svn_revnum_t def_revision, + apr_pool_t *scratch_pool) +{ + svn_wc__db_wcroot_t *wcroot; + const char *def_local_relpath; + svn_sqlite__stmt_t *stmt; + svn_boolean_t have_row; + apr_int64_t repos_id; + + SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath)); + + /* We know only of DEF_LOCAL_ABSPATH that it definitely belongs to "this" + * WC, i.e. where the svn:externals prop is set. The external target path + * itself may be "hidden behind" other working copies. */ + SVN_ERR(svn_wc__db_wcroot_parse_local_abspath(&wcroot, &def_local_relpath, + db, def_local_abspath, + scratch_pool, scratch_pool)); + VERIFY_USABLE_WCROOT(wcroot); + + + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_SELECT_REPOSITORY)); + SVN_ERR(svn_sqlite__bindf(stmt, "s", repos_root_url)); + SVN_ERR(svn_sqlite__step(&have_row, stmt)); + + if (have_row) + repos_id = svn_sqlite__column_int64(stmt, 0); + SVN_ERR(svn_sqlite__reset(stmt)); + + if (!have_row) + { + /* Need to set up a new repository row. */ + SVN_ERR(create_repos_id(&repos_id, repos_root_url, repos_uuid, + wcroot->sdb, scratch_pool)); + } + + SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb, + STMT_INSERT_EXTERNAL)); + + /* wc_id, local_relpath, parent_relpath, presence, kind, def_local_relpath, + * repos_id, def_repos_relpath, def_operational_revision, def_revision */ + SVN_ERR(svn_sqlite__bindf(stmt, "issstsis", + wcroot->wc_id, + svn_dirent_skip_ancestor(wcroot->abspath, + local_abspath), + svn_dirent_skip_ancestor(wcroot->abspath, + parent_abspath), + "normal", + kind_map, kind, + def_local_relpath, + repos_id, + repos_relpath)); + + if (SVN_IS_VALID_REVNUM(def_peg_revision)) + SVN_ERR(svn_sqlite__bind_revnum(stmt, 9, def_peg_revision)); + + if (SVN_IS_VALID_REVNUM(def_revision)) + SVN_ERR(svn_sqlite__bind_revnum(stmt, 10, def_revision)); + + SVN_ERR(svn_sqlite__insert(NULL, stmt)); + + return SVN_NO_ERROR; +} svn_error_t * svn_wc__db_upgrade_get_repos_id(apr_int64_t *repos_id, Modified: subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.h URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.h?rev=1174725&r1=1174724&r2=1174725&view=diff ============================================================================== --- subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.h (original) +++ subversion/branches/1.7.x-i4016/subversion/libsvn_wc/wc_db.h Fri Sep 23 13:02:22 2011 @@ -2632,6 +2632,19 @@ svn_wc__db_upgrade_apply_props(svn_sqlit apr_int64_t wc_id, apr_pool_t *scratch_pool); +/* Simply insert (or replace) one row in the EXTERNALS table. */ +svn_error_t * +svn_wc__db_upgrade_insert_external(svn_wc__db_t *db, + const char *local_abspath, + svn_wc__db_kind_t kind, + const char *parent_abspath, + const char *def_local_abspath, + const char *repos_relpath, + const char *repos_root_url, + const char *repos_uuid, + svn_revnum_t def_peg_revision, + svn_revnum_t def_revision, + apr_pool_t *scratch_pool); /* Get the repository identifier corresponding to REPOS_ROOT_URL from the database in SDB. The value is returned in *REPOS_ID. All allocations