You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ne...@apache.org on 2010/02/19 01:55:47 UTC

svn commit: r911661 - in /subversion/trunk/subversion: libsvn_wc/update_editor.c svn/cl.h svn/util.c

Author: neels
Date: Fri Feb 19 00:55:46 2010
New Revision: 911661

URL: http://svn.apache.org/viewvc?rev=911661&view=rev
Log:
Instead of giving wrong information, rather give no information on source-
left in 'svn info' output with a tree-conflict on a locally added node during
update.

The long term goal for source-left information on a locally added node is to
say which URL at which revision did not exist before the local add took place
(a large todo-comment in this patch outlines desired behavior). So, for now,
rather say less wrong stuff for source-left, i.e. nothing, on add vs. add
during update/switch.

Note: This does not change behavior for tree-conflicts during merge. Only the
tree-conflict info that came from an update is affected, and only for
tree conflicts with locally added nodes (add vs. add).

* subversion/libsvn_wc/update_editor.c
  (check_tree_conflict):
    In case of a tree conflict with a locally added node, pass a
    SRC_LEFT_VERSION of NULL. Still use the relpath of the added node
    for the source-right URL. Comment.

* subversion/svn/util.c
  (svn_cl__node_description): 
    If SRC_LEFT_VERSION is NULL, simply print "(none)" (or equivalent).

* subversion/svn/cl.h (svn_cl__node_description): Comment.


Modified:
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/svn/cl.h
    subversion/trunk/subversion/svn/util.c

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=911661&r1=911660&r2=911661&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Fri Feb 19 00:55:46 2010
@@ -1746,11 +1746,12 @@
   /* A conflict was detected. Append log commands to the log accumulator
    * to record it. */
   {
-    const char *repos_root_url;
+    const char *repos_root_url = NULL;
     const char *left_repos_relpath;
     svn_revnum_t left_revision;
     svn_node_kind_t left_kind;
     const char *right_repos_relpath;
+    const char *added_repos_relpath = NULL;
     svn_node_kind_t conflict_node_kind;
     svn_wc_conflict_version_t *src_left_version;
     svn_wc_conflict_version_t *src_right_version;
@@ -1760,25 +1761,36 @@
      * node would have if it was reverted. */
     if (reason == svn_wc_conflict_reason_added)
       {
-        /* Source-left does not exist.
-         * We will still report the URL and revision onto which this node
-         * is locally added. We don't report the locally added node kind,
-         * since that would be 'target', not 'source-left'. */
         svn_wc__db_status_t added_status;
 
+        /* ###TODO: It would be nice to tell the user at which URL and
+         * ### revision source-left was empty, which could be quite difficult
+         * ### to code, and is a slight theoretical leap of the svn mind.
+         * ### Update should show
+         * ###   URL: svn_wc__db_scan_addition( &repos_relpath )
+         * ###   REV: The base revision of the parent of before this update
+         * ###        started
+         * ###        ### BUT what if parent was updated/switched away with
+         * ###        ### depth=empty after this node was added?
+         * ### Switch should show
+         * ###   URL: scan_addition URL of before this switch started
+         * ###   REV: same as above */
+
+        /* In case of a local addition, source-left is non-existent / empty. */
         left_kind = svn_node_none;
+        left_revision = SVN_INVALID_REVNUM;
+        left_repos_relpath = NULL;
 
+        /* Still get the repository root needed by both 'update' and 'switch',
+         * and the would-be repos_relpath needed to construct the source-right
+         * in case of an 'update'. Check sanity while we're at it. */
         SVN_ERR(svn_wc__db_scan_addition(&added_status, NULL,
-                                         &left_repos_relpath,
+                                         &added_repos_relpath,
                                          &repos_root_url,
-                                         NULL, NULL, NULL, NULL,
-                                         &left_revision,
-                                         eb->db,
-                                         local_abspath,
-                                         pool,
-                                         pool));
+                                         NULL, NULL, NULL, NULL, NULL,
+                                         eb->db, local_abspath, pool, pool));
 
-        /* Sanity. */
+        /* This better really be an added status. */
         SVN_ERR_ASSERT(added_status == svn_wc__db_status_added
                        || added_status == svn_wc__db_status_obstructed_add
                        || added_status == svn_wc__db_status_copied
@@ -1843,15 +1855,18 @@
       }
     else
       {
-        /* This is an 'update', so REPOS_RELPATH is the same as for
-         * source-left. */
-        right_repos_relpath = left_repos_relpath;
+        /* This is an 'update', so REPOS_RELPATH would be the same as for
+         * source-left. However, we don't have a source-left for locally
+         * added files. */
+        right_repos_relpath = (reason == svn_wc_conflict_reason_added ?
+                               added_repos_relpath : left_repos_relpath);
       }
 
-    /* Determine PCONFLICT's overall node kind. We give it the source-right
-     * revision (THEIR_NODE_KIND) -- unless source-right is deleted and hence
-     * == svn_node_none, in which case we take it from source-left, which has
-     * to be the node kind that was deleted in source-right. */
+    /* Determine PCONFLICT's overall node kind, which is not allowed to be
+     * svn_node_none. We give it the source-right revision (THEIR_NODE_KIND)
+     * -- unless source-right is deleted and hence == svn_node_none, in which
+     * case we take it from source-left, which has to be the node kind that
+     * was deleted. */
     conflict_node_kind = (action == svn_wc_conflict_action_delete ?
                           left_kind : their_node_kind);
     SVN_ERR_ASSERT(conflict_node_kind == svn_node_file
@@ -1860,11 +1875,16 @@
 
     /* Construct the tree conflict info structs. */
 
-    src_left_version = svn_wc_conflict_version_create(repos_root_url,
-                                                      left_repos_relpath,
-                                                      left_revision,
-                                                      left_kind,
-                                                      pool);
+    if (left_repos_relpath == NULL)
+      /* A locally added path in conflict with an incoming add.
+       * Send an 'empty' left revision. */
+      src_left_version = NULL;
+    else
+      src_left_version = svn_wc_conflict_version_create(repos_root_url,
+                                                        left_repos_relpath,
+                                                        left_revision,
+                                                        left_kind,
+                                                        pool);
     
     src_right_version = svn_wc_conflict_version_create(repos_root_url,
                                                        right_repos_relpath,

Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=911661&r1=911660&r2=911661&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Fri Feb 19 00:55:46 2010
@@ -698,7 +698,8 @@
 
 
 /* Return a string showing NODE's kind, URL and revision, to the extent that
- * that information is available in NODE.
+ * that information is available in NODE. If NODE itself is NULL, this prints
+ * just a 'none' node kind.
  * WC_REPOS_ROOT_URL should reflect the target working copy's repository
  * root URL. If NODE is from that same URL, the printed URL is abbreviated
  * to caret notation (^/). WC_REPOS_ROOT_URL may be NULL, in which case

Modified: subversion/trunk/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/util.c?rev=911661&r1=911660&r2=911661&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/util.c (original)
+++ subversion/trunk/subversion/svn/util.c Fri Feb 19 00:55:46 2010
@@ -1266,6 +1266,12 @@
   const char *root_str = "^";
   const char *path_str = "...";
 
+  if (!node)
+    /* Printing "(none)" the harder way to ensure conformity (mostly with
+     * translations). */
+    return apr_psprintf(pool, "(%s)",
+                        svn_cl__node_kind_str_human_readable(svn_node_none));
+
   /* Construct a "caret notation" ^/URL if NODE matches WC_REPOS_ROOT_URL.
    * Otherwise show the complete URL, and if we can't, show dots. */