You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2010/06/11 18:13:10 UTC
svn commit: r953751 - in /subversion/trunk/subversion:
bindings/javahl/native/CreateJ.cpp bindings/javahl/native/SVNClient.cpp
include/svn_wc.h libsvn_wc/status.c libsvn_wc/util.c
Author: rhuijben
Date: Fri Jun 11 16:13:09 2010
New Revision: 953751
URL: http://svn.apache.org/viewvc?rev=953751&view=rev
Log:
Remove the full url calculations from the status walker. We prefer to
use repos_root_url and repos_relpath instead in libsvn_wc.
* subversion/bindings/javahl/native/CreateJ.cpp
(includes): Include svn_path.h
(CreateJ::Status): Update user.
* subversion/bindings/javahl/native/SVNClient.cpp
(includes): Include svn_path.h
(CreateJ::Status): Update user.
* subversion/include/svn_wc.h
(svn_wc_status3_t): Remove url. Move repos_root_url and repos_relpath
in its place, and update documentation.
* subversion/libsvn_wc/status.c
(dir_baton): Remove url field.
(file_baton): Remove file field.
(assemble_status): Retrieve repos_relpath when we don't got it via our
caller. Stop retrieving the url.
(tweak_statushash): Stop calculating the now unused url.
(find_dir_url): Rename to ...
(find_dir_repos_relpath): ... and find the relpath instead.
(make_dir_baton,
make_file_baton): Remove setters of url.
(close_file): Use relpath directly, instead of getting that
via the url and repos_root_url.
(svn_wc_dup_status3): Remove field duplicate code.
* subversion/libsvn_wc/util.c
(svn_wc__status2_from_3): Create url from repos root and relpath.
Modified:
subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_wc/status.c
subversion/trunk/subversion/libsvn_wc/util.c
Modified: subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp?rev=953751&r1=953750&r2=953751&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CreateJ.cpp Fri Jun 11 16:13:09 2010
@@ -33,6 +33,7 @@
#include "CreateJ.h"
#include "../include/org_apache_subversion_javahl_Revision.h"
+#include "svn_path.h"
#include "private/svn_wc_private.h"
jobject
@@ -470,7 +471,10 @@ CreateJ::Status(svn_wc_context_t *wc_ctx
if (JNIUtil::isJavaExceptionThrown())
POP_AND_RETURN_NULL;
- jUrl = JNIUtil::makeJString(status->url);
+ jUrl = JNIUtil::makeJString(svn_path_url_add_component2(
+ status->repos_root_url,
+ status->repos_relpath,
+ pool));
if (JNIUtil::isJavaExceptionThrown())
POP_AND_RETURN_NULL;
Modified: subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp?rev=953751&r1=953750&r2=953751&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/SVNClient.cpp Fri Jun 11 16:13:09 2010
@@ -59,6 +59,7 @@
#include "svn_config.h"
#include "svn_io.h"
#include "svn_dirent_uri.h"
+#include "svn_path.h"
#include "svn_utf.h"
#include "svn_private_config.h"
#include "JNIStringHolder.h"
@@ -1722,7 +1723,9 @@ analyze_status(void *baton,
&& (! sb->wc_url)
&& (strcmp(local_abspath, sb->wc_abspath) == 0)
&& (status->versioned))
- sb->wc_url = apr_pstrdup(sb->pool, status->url);
+ sb->wc_url = svn_path_url_add_component2(status->repos_root_url,
+ status->repos_relpath,
+ pool);
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=953751&r1=953750&r2=953751&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Fri Jun 11 16:13:09 2010
@@ -3564,8 +3564,14 @@ typedef struct svn_wc_status3_t
/** The entry's lock in the repository, if any. */
const svn_lock_t *repos_lock;
- /** Set to the URI (actual or expected) of the item. */
- const char *url;
+ /** The URL of the repository */
+ const char *repos_root_url;
+
+ /** The in-repository path relative to the repository root.
+ * Use svn_path_url_component2() to join this value to the
+ * repos_root_url to get the full URL.
+ */
+ const char *repos_relpath;
/**
* @defgroup svn_wc_status_ood WC out-of-date info from the repository
@@ -3656,13 +3662,6 @@ typedef struct svn_wc_status3_t
/** Which changelist this item is part of, or NULL if not part of any. */
const char *changelist;
- /** The leading part of the url, not including the wc root and subsequent
- * paths. */
- const char *repos_root_url;
-
- /** The path relative to the wc root. */
- const char *repos_relpath;
-
/* NOTE! Please update svn_wc_dup_status3() when adding new fields here. */
} svn_wc_status3_t;
Modified: subversion/trunk/subversion/libsvn_wc/status.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/status.c?rev=953751&r1=953750&r2=953751&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/status.c (original)
+++ subversion/trunk/subversion/libsvn_wc/status.c Fri Jun 11 16:13:09 2010
@@ -185,9 +185,6 @@ struct dir_baton
/* The pool in which this baton itself is allocated. */
apr_pool_t *pool;
- /* The URI to this item in the repository. */
- const char *url;
-
/* out-of-date info corresponding to ood_* fields in svn_wc_status3_t. */
svn_revnum_t ood_last_cmt_rev;
apr_time_t ood_last_cmt_date;
@@ -227,9 +224,6 @@ struct file_baton
the code that syncs up the adm dir and working copy. */
svn_boolean_t prop_changed;
- /* The URI to this item in the repository. */
- const char *url;
-
/* out-of-date info corresponding to ood_* fields in svn_wc_status3_t. */
svn_revnum_t ood_last_cmt_rev;
apr_time_t ood_last_cmt_date;
@@ -286,7 +280,6 @@ assemble_status(svn_wc_status3_t **statu
svn_wc__db_kind_t db_kind;
const char *repos_relpath;
const char *repos_root_url;
- const char *url;
svn_boolean_t locked_p = FALSE;
svn_boolean_t switched_p = FALSE;
const svn_wc_conflict_description2_t *tree_conflict;
@@ -326,11 +319,6 @@ assemble_status(svn_wc_status3_t **statu
&conflicted, &lock, db, local_abspath,
result_pool, scratch_pool));
- /* ### Temporary until we've revved svn_wc_status3_t to only use
- * ### repos_{root_url,relpath} */
- SVN_ERR(svn_wc__internal_node_get_url(&url, db, local_abspath,
- result_pool, scratch_pool));
-
SVN_ERR(svn_wc__internal_is_file_external(&file_external_p, db,
local_abspath, scratch_pool));
@@ -346,8 +334,8 @@ assemble_status(svn_wc_status3_t **statu
if (! repos_relpath)
{
- repos_relpath = svn_relpath_join( parent_repos_relpath, base,
- result_pool);
+ repos_relpath = svn_relpath_join(parent_repos_relpath, base,
+ result_pool);
/* If _read_info() doesn't give us a repos_relpath, it means
* that it is implied by the parent, thus the path can not be
* switched. */
@@ -362,6 +350,32 @@ assemble_status(svn_wc_status3_t **statu
}
}
+ if (!repos_relpath)
+ {
+ if (db_status == svn_wc__db_status_added)
+ SVN_ERR(svn_wc__db_scan_addition(NULL, NULL, &repos_relpath,
+ &repos_root_url, NULL, NULL, NULL,
+ NULL, NULL,
+ db, local_abspath,
+ result_pool, scratch_pool));
+ else if (base_shadowed)
+ SVN_ERR(svn_wc__db_scan_base_repos(&repos_relpath,
+ &repos_root_url, NULL,
+ db, local_abspath,
+ result_pool, scratch_pool));
+ else
+ {
+ SVN_ERR_ASSERT(parent_repos_relpath != NULL);
+
+ repos_relpath = svn_relpath_join(parent_repos_relpath,
+ svn_dirent_basename(local_abspath,
+ NULL),
+ result_pool);
+ }
+ }
+ if (!repos_root_url && parent_repos_root_url)
+ repos_root_url = apr_pstrdup(result_pool, parent_repos_root_url);
+
/* Examine whether our directory metadata is present, and compensate
if it is missing.
@@ -662,7 +676,6 @@ assemble_status(svn_wc_status3_t **statu
stat->file_external = file_external_p;
stat->copied = copied;
stat->repos_lock = repos_lock;
- stat->url = url;
stat->revision = revision;
stat->changed_rev = changed_rev;
stat->changed_author = changed_author;
@@ -1493,22 +1506,6 @@ tweak_statushash(void *baton,
{
struct dir_baton *b = this_dir_baton;
- if (b->url)
- {
- if (statstruct->repos_text_status == svn_wc_status_deleted)
- {
- /* When deleting PATH, BATON is for PATH's parent,
- so we must construct PATH's real statstruct->url. */
- statstruct->url =
- svn_path_url_add_component2(b->url,
- svn_dirent_basename(local_abspath,
- NULL),
- pool);
- }
- else
- statstruct->url = apr_pstrdup(pool, b->url);
- }
-
/* The last committed date, and author for deleted items
isn't available. */
if (statstruct->repos_text_status == svn_wc_status_deleted)
@@ -1540,8 +1537,6 @@ tweak_statushash(void *baton,
else
{
struct file_baton *b = baton;
- if (b->url)
- statstruct->url = apr_pstrdup(pool, b->url);
statstruct->ood_last_cmt_rev = b->ood_last_cmt_rev;
statstruct->ood_last_cmt_date = b->ood_last_cmt_date;
statstruct->ood_kind = b->ood_kind;
@@ -1554,14 +1549,14 @@ tweak_statushash(void *baton,
/* Returns the URL for DB, or NULL: */
static const char *
-find_dir_url(const struct dir_baton *db, apr_pool_t *pool)
+find_dir_repos_relpath(const struct dir_baton *db, apr_pool_t *pool)
{
/* If we have no name, we're the root, return the anchor URL. */
if (! db->name)
- return db->edit_baton->anchor_status->url;
+ return db->edit_baton->anchor_status->repos_relpath;
else
{
- const char *url;
+ const char *repos_relpath;
struct dir_baton *pb = db->parent_baton;
const svn_wc_status3_t *status = apr_hash_get(pb->statii,
db->local_abspath,
@@ -1570,11 +1565,11 @@ find_dir_url(const struct dir_baton *db,
* directory, which means we need to recurse up another level to
* get a useful URL. */
if (status)
- return status->url;
+ return status->repos_relpath;
- url = find_dir_url(pb, pool);
- if (url)
- return svn_path_url_add_component2(url, db->name, pool);
+ repos_relpath = find_dir_repos_relpath(pb, pool);
+ if (repos_relpath)
+ return svn_relpath_join(repos_relpath, db->name, pool);
else
return NULL;
}
@@ -1611,7 +1606,6 @@ make_dir_baton(void **dir_baton,
d->parent_baton = parent_baton;
d->pool = pool;
d->statii = apr_hash_make(pool);
- d->url = apr_pstrdup(pool, find_dir_url(d, pool));
d->ood_last_cmt_rev = SVN_INVALID_REVNUM;
d->ood_last_cmt_date = 0;
d->ood_kind = svn_node_dir;
@@ -1707,9 +1701,6 @@ make_file_baton(struct dir_baton *parent
f->pool = pool;
f->dir_baton = pb;
f->edit_baton = eb;
- f->url = svn_path_url_add_component2(find_dir_url(pb, pool),
- f->name,
- pool);
f->ood_last_cmt_rev = SVN_INVALID_REVNUM;
f->ood_last_cmt_date = 0;
f->ood_kind = svn_node_file;
@@ -2252,21 +2243,26 @@ close_file(void *file_baton,
/* If this is a new file, add it to the statushash. */
if (fb->added)
{
- const char *url;
repos_text_status = svn_wc_status_added;
repos_prop_status = fb->prop_changed ? svn_wc_status_added : 0;
if (fb->edit_baton->wb.repos_locks)
{
- url = find_dir_url(fb->dir_baton, pool);
- if (url)
+ const char *dir_repos_relpath = find_dir_repos_relpath(fb->dir_baton,
+ pool);
+
+ if (dir_repos_relpath)
{
- url = svn_path_url_add_component2(url, fb->name, pool);
- repos_lock = apr_hash_get
- (fb->edit_baton->wb.repos_locks,
- svn_path_uri_decode(url +
- strlen(fb->edit_baton->wb.repos_root),
- pool), APR_HASH_KEY_STRING);
+ /* repos_lock still uses the deprecated filesystem absolute path
+ format */
+
+ const char *repos_relpath = svn_relpath_join(dir_repos_relpath,
+ fb->name, pool);
+
+ repos_lock = apr_hash_get(fb->edit_baton->wb.repos_locks,
+ svn_uri_join("/", repos_relpath,
+ pool),
+ APR_HASH_KEY_STRING);
}
}
}
@@ -2673,9 +2669,6 @@ svn_wc_dup_status3(const svn_wc_status3_
if (orig_stat->repos_lock)
new_stat->repos_lock = svn_lock_dup(orig_stat->repos_lock, pool);
- if (orig_stat->url)
- new_stat->url = apr_pstrdup(pool, orig_stat->url);
-
if (orig_stat->changed_author)
new_stat->changed_author = apr_pstrdup(pool, orig_stat->changed_author);
Modified: subversion/trunk/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/util.c?rev=953751&r1=953750&r2=953751&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/util.c Fri Jun 11 16:13:09 2010
@@ -591,7 +591,9 @@ svn_wc__status2_from_3(svn_wc_status2_t
(*status)->repos_text_status = old_status->repos_text_status;
(*status)->repos_prop_status = old_status->repos_prop_status;
(*status)->repos_lock = svn_lock_dup(old_status->repos_lock, result_pool);
- (*status)->url = apr_pstrdup(result_pool, old_status->url);
+ (*status)->url = svn_path_url_add_component2(old_status->repos_root_url,
+ old_status->repos_relpath,
+ result_pool);
(*status)->ood_last_cmt_rev = old_status->ood_last_cmt_rev;
(*status)->ood_last_cmt_date = old_status->ood_last_cmt_date;
(*status)->ood_kind = old_status->ood_kind;