Hi all,
i am interested in doing isssue #960 "separate canonical repository URL
from repos path in wc"
I started on it with a first small step and before i go on I would like
to discuss the necessary steps so we agree on the implementation.
some thoughts as a starting point:
- i think it should be backward compatible with the current url entry.
This will need some code to update the entries files on the fly.
- two new members (repos_url and repos_path) are needed in svn_wc_entry_t
(see diff..)
- the two string have to be passed to libsnv_wc/entries.c
I am thinking of replacing the current single url parameter with a
structure containing the current (full) url and the seperated url/path
strings.
- Maybe use this structure as member in svn_wc_entry_t instead of
single strings?
- what should happen with the url member, remove it or keep it?
I would like to remove it and replace its usage with
svn_path_url_add_component or a wrapper that hides the string cat.
But it may be possible that it is needed for a while to keep
compatibility.
what do you think?
bye Martin
Index: include/svn_error_codes.h
===================================================================
--- include/svn_error_codes.h (revision 5740)
+++ include/svn_error_codes.h (working copy)
@@ -261,6 +261,14 @@
SVN_ERR_ENTRY_CATEGORY_START + 5,
"Entry has an invalid attribute")
+ SVN_ERRDEF (SVN_ERR_ENTRY_MISSING_REPOS_URL,
+ SVN_ERR_ENTRY_CATEGORY_START + 6,
+ "Entry has an no repos-url")
+
+ SVN_ERRDEF (SVN_ERR_ENTRY_MISSING_REPOS_PATH,
+ SVN_ERR_ENTRY_CATEGORY_START + 7,
+ "Entry has an no repos-path")
+
/* wc errors */
SVN_ERRDEF (SVN_ERR_WC_OBSTRUCTED_UPDATE,
Index: include/svn_wc.h
===================================================================
--- include/svn_wc.h (revision 5740)
+++ include/svn_wc.h (working copy)
@@ -550,6 +550,12 @@
/** url in repository */
const char *url;
+ /** repository url */
+ const char *repos_url;
+
+ /** path below repository url */
+ const char *repos_path;
+
/** canonical repository url */
const char *repos;
Index: libsvn_wc/entries.c
===================================================================
--- libsvn_wc/entries.c (revision 5740)
+++ libsvn_wc/entries.c (working copy)
@@ -98,6 +98,10 @@
initial_revstr,
SVN_WC__ENTRY_ATTR_URL,
url,
+ SVN_WC__ENTRY_ATTR_REPOS_URL,
+ "todo",
+ SVN_WC__ENTRY_ATTR_REPOS_PATH,
+ "todo",
NULL);
/* Close the top-level form. */
@@ -193,6 +197,21 @@
*modify_flags |= SVN_WC__ENTRY_MODIFY_URL;
}
+ /* set up repos_url and repos_path (may replace url) */
+ {
+ entry->repos_url
+ = apr_hash_get (atts, SVN_WC__ENTRY_ATTR_REPOS_URL, APR_HASH_KEY_STRING);
+
+ if (entry->repos_url)
+ *modify_flags |= SVN_WC__ENTRY_MODIFY_REPOS_URL;
+
+ entry->repos_path
+ = apr_hash_get (atts, SVN_WC__ENTRY_ATTR_REPOS_PATH, APR_HASH_KEY_STRING);
+
+ if (entry->repos_path)
+ *modify_flags |= SVN_WC__ENTRY_MODIFY_REPOS_PATH;
+ }
+
/* Set up kind. */
{
const char *kindstr
@@ -478,6 +497,24 @@
{
dst->url = svn_path_url_add_component (src->url, dst->name, pool);
}
+
+ /* ... do the same for repos_url and repos_path
+ REVIEW ME i am not sure this is correct...
+ if it is, move url code into it.
+ */
+
+ if ((! ((dst->schedule == svn_wc_schedule_add)
+ || (dst->schedule == svn_wc_schedule_replace))))
+ {
+ if (! dst->repos_url)
+ {
+ dst->repos_url = apr_pstrdup (pool, src->repos_url);
+ }
+ if (! dst->repos_path)
+ {
+ dst->repos_path = svn_path_url_add_component (src->url, dst->name, pool);
+ }
+ }
}
@@ -507,6 +544,15 @@
NULL,
"default entry missing url");
+ if (! default_entry->repos_url)
+ return svn_error_create (SVN_ERR_ENTRY_MISSING_REPOS_URL,
+ NULL,
+ "default entry missing repos-url");
+
+ if (! default_entry->repos_path)
+ return svn_error_create (SVN_ERR_ENTRY_MISSING_REPOS_PATH,
+ NULL,
+ "default entry missing repos-path");
/* Then use it to fill in missing information in other entries. */
for (hi = apr_hash_first (pool, entries); hi; hi = apr_hash_next (hi))
@@ -825,6 +871,16 @@
if (entry->url)
apr_hash_set (atts, SVN_WC__ENTRY_ATTR_URL, APR_HASH_KEY_STRING,
entry->url);
+
+ /* repository url */
+ if (entry->repos_url)
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_REPOS_URL, APR_HASH_KEY_STRING,
+ entry->repos_url);
+
+ /* repository path */
+ if (entry->repos_path)
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_REPOS_PATH, APR_HASH_KEY_STRING,
+ entry->repos_path);
/* Kind */
switch (entry->kind)
@@ -963,12 +1019,16 @@
if (entry->kind == svn_node_dir)
{
- /* We don't write url, revision, or uuid for subdir
+ /* We don't write url, repos_url, repos_path, revision, or uuid for subdir
entries. */
apr_hash_set (atts, SVN_WC__ENTRY_ATTR_REVISION, APR_HASH_KEY_STRING,
NULL);
apr_hash_set (atts, SVN_WC__ENTRY_ATTR_URL, APR_HASH_KEY_STRING,
NULL);
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_REPOS_URL, APR_HASH_KEY_STRING,
+ NULL);
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_REPOS_PATH, APR_HASH_KEY_STRING,
+ NULL);
apr_hash_set (atts, SVN_WC__ENTRY_ATTR_UUID, APR_HASH_KEY_STRING,
NULL);
}
@@ -999,8 +1059,14 @@
if (strcmp (entry->url,
svn_path_url_add_component (this_dir->url,
name, pool)) == 0)
- apr_hash_set (atts, SVN_WC__ENTRY_ATTR_URL,
- APR_HASH_KEY_STRING, NULL);
+ {
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_URL,
+ APR_HASH_KEY_STRING, NULL);
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_REPOS_URL,
+ APR_HASH_KEY_STRING, NULL);
+ apr_hash_set (atts, SVN_WC__ENTRY_ATTR_REPOS_PATH,
+ APR_HASH_KEY_STRING, NULL);
+ }
}
}
}
@@ -1136,6 +1202,14 @@
if (modify_flags & SVN_WC__ENTRY_MODIFY_URL)
cur_entry->url = entry->url ? apr_pstrdup (pool, entry->url) : NULL;
+ /* repository url */
+ if (modify_flags & SVN_WC__ENTRY_MODIFY_REPOS_URL)
+ cur_entry->repos_url = entry->repos_url ? apr_pstrdup (pool, entry->repos_url) : NULL;
+
+ /* repository path */
+ if (modify_flags & SVN_WC__ENTRY_MODIFY_REPOS_PATH)
+ cur_entry->repos_path = entry->repos_path ? apr_pstrdup (pool, entry->repos_path) : NULL;
+
/* Kind */
if (modify_flags & SVN_WC__ENTRY_MODIFY_KIND)
cur_entry->kind = entry->kind;
@@ -1533,6 +1607,10 @@
dupentry->name = apr_pstrdup (pool, entry->name);
if (entry->url)
dupentry->url = apr_pstrdup (pool, entry->url);
+ if (entry->repos_url)
+ dupentry->repos_url = apr_pstrdup (pool, entry->repos_url);
+ if (entry->repos_path)
+ dupentry->repos_path = apr_pstrdup (pool, entry->repos_path);
if (entry->repos)
dupentry->repos = apr_pstrdup (pool, entry->repos);
if (entry->uuid)
Index: libsvn_wc/entries.h
===================================================================
--- libsvn_wc/entries.h (revision 5740)
+++ libsvn_wc/entries.h (working copy)
@@ -62,6 +62,8 @@
#define SVN_WC__ENTRY_ATTR_CMT_DATE "committed-date"
#define SVN_WC__ENTRY_ATTR_CMT_AUTHOR "last-author"
#define SVN_WC__ENTRY_ATTR_UUID "uuid"
+#define SVN_WC__ENTRY_ATTR_REPOS_URL "repos-url"
+#define SVN_WC__ENTRY_ATTR_REPOS_PATH "repos-path"
@@ -114,6 +116,8 @@
#define SVN_WC__ENTRY_MODIFY_CMT_DATE 0x00010000
#define SVN_WC__ENTRY_MODIFY_CMT_AUTHOR 0x00020000
#define SVN_WC__ENTRY_MODIFY_UUID 0x00040000
+#define SVN_WC__ENTRY_MODIFY_REPOS_URL 0x00080000
+#define SVN_WC__ENTRY_MODIFY_REPOS_PATH 0x00100000
/* ...or perhaps this to mean all of those above... */
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu May 1 17:23:33 2003