You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2014/08/14 12:55:43 UTC

svn commit: r1617909 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/conflicts.c libsvn_wc/update_editor.c libsvn_wc/util.c svn/util.c

Author: stsp
Date: Thu Aug 14 10:55:42 2014
New Revision: 1617909

URL: http://svn.apache.org/r1617909
Log:
Record the update/switch target revision for missing tree conflicts
victims in the tree conflict description so the revision can always
be retrieved during conflict resolution.

For instance, 'svn info' might show:

Tree conflict: local file edit, incoming file delete or move upon update
  Source  left: (file) ^/trunk/alpha@2
  Source right: (none)

With this change, 'svn info' shows the target revision ("source right')
of the update/switch which recorded the conflict, even if the node
was missing:

Tree conflict: local file edit, incoming file delete or move upon update
  Source  left: (file) ^/trunk/alpha@2
  Source right: (none) @4

There is a slight API change involved which shouldn't affect compatibility.
The semantics of svn_wc_conflict_version_create2() change such that the
conflict victim's repos relpath is allowed to be NULL if the node kind
is 'none'. Previously the API required a canonical path in all cases
and would ASSERT otherwise, a contract which made it impossible to create
conflict versions for nodes which don't exist. The provided revision
number must still be valid in all cases, of course.

* subversion/include/svn_wc.h
  (svn_wc_conflict_version_create2): Update docstring.
   A NULL 'repos_relpath' is now valid if 'kind' is svn_node_none.

* subversion/libsvn_wc/conflicts.c
  (conflict__prepend_location, conflict__read_location): Handle NULL
   repos-relpath fields in conflict description.

* subversion/libsvn_wc/update_editor.c
  (complete_conflict): Create conflict versions for paths which don't exist
   so revision number information will be recorded.

* subversion/libsvn_wc/util.c
  (svn_wc_conflict_version_create2): Accept a NULL repos_relpath if the
   node kind is svn_node_none.

* subversion/svn/util.c
  (svn_cl__node_description): Print an empty path if the victim's kind
   is svn_node_none, instead of printing the ^/... placeholder path.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/conflicts.c
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/util.c
    subversion/trunk/subversion/svn/util.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1617909&r1=1617908&r2=1617909&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Thu Aug 14 10:55:42 2014
@@ -1711,11 +1711,12 @@ typedef struct svn_wc_conflict_version_t
  * @a revision and the @c node_kind to @a kind. Make only shallow
  * copies of the pointer arguments.
  *
- * @a repos_root_url, @a repos_relpath and @a revision must be valid,
- * non-null values. @a repos_uuid should be a valid UUID, but can be
+ * @a repos_root_url, and @a revision must be valid, non-null values.
+ * @a repos_relpath must be a canonical fspath, but can be @c NULL if kind
+ * is @svn_node_none. @a repos_uuid should be a valid UUID, but can be
  * NULL if unknown. @a kind can be any kind, even 'none' or 'unknown'.
  *
- * @since New in 1.8.
+ * @since New in 1.8. As of 1.9 @a repos_relpath may be NULL if kind is 'none'.
  */
 svn_wc_conflict_version_t *
 svn_wc_conflict_version_create2(const char *repos_root_url,

Modified: subversion/trunk/subversion/libsvn_wc/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/conflicts.c?rev=1617909&r1=1617908&r2=1617909&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_wc/conflicts.c Thu Aug 14 10:55:42 2014
@@ -117,8 +117,11 @@ conflict__prepend_location(svn_skel_t *s
 
   svn_skel__prepend_int(location->peg_rev, loc, result_pool);
 
-  svn_skel__prepend_str(apr_pstrdup(result_pool, location->path_in_repos), loc,
-                        result_pool);
+  if (!location->path_in_repos) /* can be NULL if non-existent */
+    svn_skel__prepend(svn_skel__make_empty_list(result_pool), loc);
+  else
+    svn_skel__prepend_str(apr_pstrdup(result_pool, location->path_in_repos), loc,
+                          result_pool);
 
   if (!location->repos_uuid) /* Can theoretically be NULL */
     svn_skel__prepend(svn_skel__make_empty_list(result_pool), loc);
@@ -168,7 +171,10 @@ conflict__read_location(svn_wc_conflict_
     repos_uuid = NULL;
   c = c->next;
 
-  repos_relpath = apr_pstrmemdup(result_pool, c->data, c->len);
+  if (c->is_atom)
+    repos_relpath = apr_pstrmemdup(result_pool, c->data, c->len);
+  else
+    repos_relpath = NULL;
   c = c->next;
 
   SVN_ERR(svn_skel__parse_int(&v, c, scratch_pool));

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1617909&r1=1617908&r2=1617909&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Thu Aug 14 10:55:42 2014
@@ -840,7 +840,9 @@ complete_conflict(svn_skel_t *conflict,
   if (is_complete)
     return SVN_NO_ERROR; /* Already completed */
 
-  if (old_repos_relpath)
+  if (old_repos_relpath == NULL)
+    local_kind = svn_node_none;
+  if (SVN_IS_VALID_REVNUM(old_revision))
     original_version = svn_wc_conflict_version_create2(eb->repos_root,
                                                        eb->repos_uuid,
                                                        old_repos_relpath,
@@ -850,15 +852,14 @@ complete_conflict(svn_skel_t *conflict,
   else
     original_version = NULL;
 
-  if (new_repos_relpath)
-    target_version = svn_wc_conflict_version_create2(eb->repos_root,
-                                                        eb->repos_uuid,
-                                                        new_repos_relpath,
-                                                        *eb->target_revision,
-                                                        target_kind,
-                                                        result_pool);
-  else
-    target_version = NULL;
+  if (new_repos_relpath == NULL)
+    target_kind = svn_node_none;
+  target_version = svn_wc_conflict_version_create2(eb->repos_root,
+                                                   eb->repos_uuid,
+                                                   new_repos_relpath,
+                                                   *eb->target_revision,
+                                                   target_kind,
+                                                   result_pool);
 
   if (eb->switch_repos_relpath)
     SVN_ERR(svn_wc__conflict_skel_set_op_switch(conflict,

Modified: subversion/trunk/subversion/libsvn_wc/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/util.c?rev=1617909&r1=1617908&r2=1617909&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/util.c (original)
+++ subversion/trunk/subversion/libsvn_wc/util.c Thu Aug 14 10:55:42 2014
@@ -296,10 +296,14 @@ svn_wc_conflict_version_create2(const ch
 
   version = apr_pcalloc(result_pool, sizeof(*version));
 
-    SVN_ERR_ASSERT_NO_RETURN(svn_uri_is_canonical(repos_url, result_pool)
-                             && svn_relpath_is_canonical(repos_relpath)
-                             && SVN_IS_VALID_REVNUM(revision)
-                             /* ### repos_uuid can be NULL :( */);
+  if (repos_relpath)
+    SVN_ERR_ASSERT_NO_RETURN(svn_relpath_is_canonical(repos_relpath));
+  else
+    SVN_ERR_ASSERT_NO_RETURN(kind == svn_node_none);
+
+  SVN_ERR_ASSERT_NO_RETURN(svn_uri_is_canonical(repos_url, result_pool)
+                           && SVN_IS_VALID_REVNUM(revision)
+                           /* ### repos_uuid can be NULL :( */);
 
   version->repos_url = repos_url;
   version->peg_rev = revision;

Modified: subversion/trunk/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/util.c?rev=1617909&r1=1617908&r2=1617909&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/util.c (original)
+++ subversion/trunk/subversion/svn/util.c Thu Aug 14 10:55:42 2014
@@ -923,6 +923,11 @@ svn_cl__node_description(const svn_wc_co
 
   if (node->path_in_repos)
     path_str = node->path_in_repos;
+  else if (node->node_kind == svn_node_none)
+    {
+      root_str = "";
+      path_str = "";
+    }
 
   return apr_psprintf(pool, "(%s) %s@%ld",
                       svn_cl__node_kind_str_human_readable(node->node_kind),



RE: svn commit: r1617909 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_wc/conflicts.c libsvn_wc/update_editor.c libsvn_wc/util.c svn/util.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: stsp@apache.org [mailto:stsp@apache.org]
> Sent: donderdag 14 augustus 2014 12:56
> To: commits@subversion.apache.org
> Subject: svn commit: r1617909 - in /subversion/trunk/subversion:
> include/svn_wc.h libsvn_wc/conflicts.c libsvn_wc/update_editor.c
> libsvn_wc/util.c svn/util.c
> 
> Author: stsp
> Date: Thu Aug 14 10:55:42 2014
> New Revision: 1617909
> 
> URL: http://svn.apache.org/r1617909
> Log:
> Record the update/switch target revision for missing tree conflicts
> victims in the tree conflict description so the revision can always
> be retrieved during conflict resolution.
> 
> For instance, 'svn info' might show:
> 
> Tree conflict: local file edit, incoming file delete or move upon update
>   Source  left: (file) ^/trunk/alpha@2
>   Source right: (none)
> 
> With this change, 'svn info' shows the target revision ("source right')
> of the update/switch which recorded the conflict, even if the node
> was missing:
> 
> Tree conflict: local file edit, incoming file delete or move upon update
>   Source  left: (file) ^/trunk/alpha@2
>   Source right: (none) @4
> 
> There is a slight API change involved which shouldn't affect compatibility.
> The semantics of svn_wc_conflict_version_create2() change such that the
> conflict victim's repos relpath is allowed to be NULL if the node kind
> is 'none'. Previously the API required a canonical path in all cases
> and would ASSERT otherwise, a contract which made it impossible to create
> conflict versions for nodes which don't exist. The provided revision
> number must still be valid in all cases, of course.

In all these cases you still have a really interesing path, to where you tried to switch/update the original path to. If you don't store that you don't know what you tried to switch/update to.

Why don't you store *that path* and the revision?

Note: I don't care about the 'svn' output... Feel free to not show it there, if that might make more sense.

But if I look at the tree conflict information through an API, that path that you tried to switch to is 100% essential information, while a revision is useless information without a repository path. That the node is not there (kind=none) still says me that the node is not there.

"I switched that working copy to r123" doesn't tell me anything, while the information "I switched that working copy to '^/branches/major-QQQ-refactoring@r123' tells me everything.

I wish the average user, asking for support knew that...

Even if that path does not exist, I can still chop of one component and use that information with the parent directory's path to perhaps retry the switch at a different revision... Or use it to merge some missing information in.

And a smart tree conflict resolver might even use more tricks than that.... which would be impossible without a path.

	Bert