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 2016/06/14 13:43:38 UTC

svn commit: r1748414 - in /subversion/trunk/subversion: include/svn_wc.h libsvn_client/conflicts.c svn/notify.c

Author: stsp
Date: Tue Jun 14 13:43:37 2016
New Revision: 1748414

URL: http://svn.apache.org/viewvc?rev=1748414&view=rev
Log:
Show progress output while searching the repository for tree conflict details.

We do this only for RA operations which potentially access multiple revisions.
No progress is shown when getting information from a single revision.

Scanning the log can take a while and happens before we show the conflict
description. So show a "spinning wheel" (or rather, a self-updating display
of revision numbers) to keep the audience entertained.

* subversion/include/svn_wc.h
  (svn_wc_notify_begin_search_tree_conflict_details,
   svn_wc_notify_tree_conflict_details_progress,
   svn_wc_notify_end_search_tree_conflict_details): New notification types.

* subversion/libsvn_client/conflicts.c
  (find_deleted_rev_baton): Add victim_abspath for notifications.
  (find_deleted_rev): Send progress notifications.
  (find_revision_for_suspected_deletion): Send begin/end notifications.
  (find_added_rev_baton): Add victim_abspath and 'ctx'.
  (find_added_rev): Send progress notifications.
  (get_incoming_delete_details_for_reverse_addition): Add 'victim_abspath'
   parameter. Send begin/end notifications.
  (conflict_tree_get_details_incoming_delete): Update caller. 
  (conflict_tree_get_details_incoming_add): Send begin/end notifications.
  (find_modified_rev_baton): Add victim_abspath and 'ctx'.
  (find_modified_rev): Send progress notifications.
  (conflict_tree_get_details_incoming_edit): Send begin/end notifications.
  (merge_incoming_added_dir_replace): Send begin/end notifications.

* subversion/svn/notify.c
  (notify_body): Display new notification types.

Modified:
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_client/conflicts.c
    subversion/trunk/subversion/svn/notify.c

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1748414&r1=1748413&r2=1748414&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Jun 14 13:43:37 2016
@@ -1292,6 +1292,19 @@ typedef enum svn_wc_notify_action_t
    * @since New in 1.10. */
   svn_wc_notify_resolved_tree,
 
+  /** Starting to search the repository for details about a tree conflict.
+   * @since New in 1.10. */
+  svn_wc_notify_begin_search_tree_conflict_details,
+
+  /** Progressing in search of repository for details about a tree conflict.
+   * The revision being searched is specified in #svn_wc_notify_t.revision.
+   * @since New in 1.10. */
+  svn_wc_notify_tree_conflict_details_progress,
+
+  /** Done searching the repository for details about a conflict.
+   * @since New in 1.10. */
+  svn_wc_notify_end_search_tree_conflict_details,
+
 } svn_wc_notify_action_t;
 
 

Modified: subversion/trunk/subversion/libsvn_client/conflicts.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/conflicts.c?rev=1748414&r1=1748413&r2=1748414&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/conflicts.c (original)
+++ subversion/trunk/subversion/libsvn_client/conflicts.c Tue Jun 14 13:43:37 2016
@@ -445,6 +445,7 @@ struct find_deleted_rev_baton
   const char *repos_root_url;
   const char *repos_uuid;
   svn_client_ctx_t *ctx;
+  const char *victim_abspath; /* for notifications */
 
   /* Variables below are results for the caller of svn_ra_get_log2(). */
   svn_revnum_t deleted_rev;
@@ -535,6 +536,18 @@ find_deleted_rev(void *baton,
   apr_array_header_t *deleted_paths;
   apr_hash_t *copies;
 
+  if (b->ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify;
+
+      notify = svn_wc_create_notify(
+                 b->victim_abspath,
+                 svn_wc_notify_tree_conflict_details_progress,
+                 scratch_pool),
+      notify->revision = log_entry->revision;
+      b->ctx->notify_func2(b->ctx->notify_baton2, notify, scratch_pool);
+    }
+
   /* No paths were changed in this revision.  Nothing to do. */
   if (! log_entry->changed_paths2)
     return SVN_NO_ERROR;
@@ -1121,6 +1134,7 @@ find_revision_for_suspected_deletion(svn
   const char *repos_root_url;
   const char *repos_uuid;
   struct find_deleted_rev_baton b;
+  const char *victim_abspath;
   svn_error_t *err;
 
   SVN_ERR_ASSERT(start_rev > end_rev);
@@ -1141,6 +1155,8 @@ find_revision_for_suspected_deletion(svn
   revprops = apr_array_make(scratch_pool, 1, sizeof(const char *));
   APR_ARRAY_PUSH(revprops, const char *) = SVN_PROP_REVISION_AUTHOR;
 
+ victim_abspath = svn_client_conflict_get_local_abspath(conflict);
+  b.victim_abspath = victim_abspath;
   b.deleted_repos_relpath = svn_relpath_join(parent_repos_relpath,
                                              deleted_basename, scratch_pool);
   b.related_repos_relpath = related_repos_relpath;
@@ -1154,6 +1170,18 @@ find_revision_for_suspected_deletion(svn
   b.moved_paths = apr_hash_make(scratch_pool);
   b.result_pool = result_pool;
 
+  if (conflict->ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify;
+
+      notify = svn_wc_create_notify(
+                 victim_abspath,
+                 svn_wc_notify_begin_search_tree_conflict_details,
+                 scratch_pool),
+      conflict->ctx->notify_func2(conflict->ctx->notify_baton2, notify,
+                                  scratch_pool);
+    }
+
   err = svn_ra_get_log2(ra_session, paths, start_rev, end_rev,
                         0, /* no limit */
                         TRUE, /* need the changed paths list */
@@ -1166,6 +1194,7 @@ find_revision_for_suspected_deletion(svn
     {
       if (err->apr_err == SVN_ERR_CANCELLED &&
           b.deleted_rev != SVN_INVALID_REVNUM)
+
         {
           /* Log operation was aborted because we found deleted rev. */
           svn_error_clear(err);
@@ -1174,6 +1203,18 @@ find_revision_for_suspected_deletion(svn
         return svn_error_trace(err);
     }
 
+  if (conflict->ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify;
+
+      notify = svn_wc_create_notify(
+                 victim_abspath,
+                 svn_wc_notify_end_search_tree_conflict_details,
+                 scratch_pool),
+      conflict->ctx->notify_func2(conflict->ctx->notify_baton2, notify,
+                                  scratch_pool);
+    }
+
   if (b.deleted_rev == SVN_INVALID_REVNUM)
     {
       /* We could not determine the revision in which the node was
@@ -2877,6 +2918,8 @@ conflict_tree_get_description_incoming_d
 /* Baton for find_added_rev(). */
 struct find_added_rev_baton
 {
+  const char *victim_abspath;
+  svn_client_ctx_t *ctx;
   svn_revnum_t added_rev;
   const char *repos_relpath;
   const char *parent_repos_relpath;
@@ -2895,6 +2938,18 @@ find_added_rev(svn_location_segment_t *s
 {
   struct find_added_rev_baton *b = baton;
 
+  if (b->ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify;
+
+      notify = svn_wc_create_notify(
+                 b->victim_abspath,
+                 svn_wc_notify_tree_conflict_details_progress,
+                 scratch_pool),
+      notify->revision = segment->range_start;
+      b->ctx->notify_func2(b->ctx->notify_baton2, notify, scratch_pool);
+    }
+
   if (segment->path) /* not interested in gaps */
     {
       if (b->parent_repos_relpath == NULL ||
@@ -2919,6 +2974,7 @@ get_incoming_delete_details_for_reverse_
   svn_revnum_t old_rev,
   svn_revnum_t new_rev,
   svn_client_ctx_t *ctx,
+  const char *victim_abspath,
   apr_pool_t *result_pool,
   apr_pool_t *scratch_pool)
 {
@@ -2940,15 +2996,41 @@ get_incoming_delete_details_for_reverse_
                                                scratch_pool));
 
   *details = apr_pcalloc(result_pool, sizeof(**details));
+  b.ctx = ctx;
+  b.victim_abspath = victim_abspath;
   b.added_rev = SVN_INVALID_REVNUM;
   b.repos_relpath = NULL;
   b.parent_repos_relpath = NULL;
   b.pool = scratch_pool;
+
+  if (ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify;
+
+      notify = svn_wc_create_notify(
+                 victim_abspath,
+                 svn_wc_notify_begin_search_tree_conflict_details,
+                 scratch_pool),
+      ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
+    }
+
   /* Figure out when this node was added. */
   SVN_ERR(svn_ra_get_location_segments(ra_session, "", old_rev,
                                        old_rev, new_rev,
                                        find_added_rev, &b,
                                        scratch_pool));
+
+  if (ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify;
+
+      notify = svn_wc_create_notify(
+                 victim_abspath,
+                 svn_wc_notify_end_search_tree_conflict_details,
+                 scratch_pool),
+      ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
+    }
+
   SVN_ERR(svn_ra_rev_prop(ra_session, b.added_rev,
                           SVN_PROP_REVISION_AUTHOR,
                           &author_revprop, scratch_pool));
@@ -3051,6 +3133,7 @@ conflict_tree_get_details_incoming_delet
           SVN_ERR(get_incoming_delete_details_for_reverse_addition(
                     &details, repos_root_url, old_repos_relpath,
                     old_rev, new_rev, conflict->ctx,
+                    svn_client_conflict_get_local_abspath(conflict),
                     conflict->pool, scratch_pool));
         }
     }
@@ -3102,6 +3185,7 @@ conflict_tree_get_details_incoming_delet
           SVN_ERR(get_incoming_delete_details_for_reverse_addition(
                     &details, repos_root_url, old_repos_relpath,
                     old_rev, new_rev, conflict->ctx,
+                    svn_client_conflict_get_local_abspath(conflict),
                     conflict->pool, scratch_pool));
         }
     }
@@ -3195,15 +3279,43 @@ conflict_tree_get_details_incoming_add(s
                                                    scratch_pool));
 
       details = apr_pcalloc(conflict->pool, sizeof(*details));
+      b.ctx = conflict->ctx,
+      b.victim_abspath = svn_client_conflict_get_local_abspath(conflict),
       b.added_rev = SVN_INVALID_REVNUM;
       b.repos_relpath = NULL;
       b.parent_repos_relpath = NULL;
       b.pool = scratch_pool;
+
+      if (conflict->ctx->notify_func2)
+        {
+          svn_wc_notify_t *notify;
+
+          notify = svn_wc_create_notify(
+                     b.victim_abspath,
+                     svn_wc_notify_begin_search_tree_conflict_details,
+                     scratch_pool),
+          conflict->ctx->notify_func2(conflict->ctx->notify_baton2, notify,
+                                      scratch_pool);
+        }
+
       /* Figure out when this node was added. */
       SVN_ERR(svn_ra_get_location_segments(ra_session, "", new_rev,
                                            new_rev, SVN_INVALID_REVNUM,
                                            find_added_rev, &b,
                                            scratch_pool));
+
+      if (conflict->ctx->notify_func2)
+        {
+          svn_wc_notify_t *notify;
+
+          notify = svn_wc_create_notify(
+                     b.victim_abspath,
+                     svn_wc_notify_end_search_tree_conflict_details,
+                     scratch_pool),
+          conflict->ctx->notify_func2(conflict->ctx->notify_baton2, notify,
+                                      scratch_pool);
+        }
+
       SVN_ERR(svn_ra_rev_prop(ra_session, b.added_rev,
                               SVN_PROP_REVISION_AUTHOR,
                               &author_revprop, scratch_pool));
@@ -3259,15 +3371,43 @@ conflict_tree_get_details_incoming_add(s
                                                        scratch_pool));
 
           details = apr_pcalloc(conflict->pool, sizeof(*details));
+          b.victim_abspath = svn_client_conflict_get_local_abspath(conflict);
+          b.ctx = conflict->ctx;
           b.added_rev = SVN_INVALID_REVNUM;
           b.repos_relpath = NULL;
           b.parent_repos_relpath = NULL;
           b.pool = scratch_pool;
+
+          if (conflict->ctx->notify_func2)
+            {
+              svn_wc_notify_t *notify;
+
+              notify = svn_wc_create_notify(
+                         b.victim_abspath,
+                         svn_wc_notify_begin_search_tree_conflict_details,
+                         scratch_pool),
+              conflict->ctx->notify_func2(conflict->ctx->notify_baton2, notify,
+                                          scratch_pool);
+            }
+
           /* Figure out when this node was added. */
           SVN_ERR(svn_ra_get_location_segments(ra_session, "", new_rev,
                                                new_rev, old_rev,
                                                find_added_rev, &b,
                                                scratch_pool));
+
+          if (conflict->ctx->notify_func2)
+            {
+              svn_wc_notify_t *notify;
+
+              notify = svn_wc_create_notify(
+                         b.victim_abspath,
+                         svn_wc_notify_end_search_tree_conflict_details,
+                         scratch_pool),
+              conflict->ctx->notify_func2(conflict->ctx->notify_baton2, notify,
+                                          scratch_pool);
+            }
+
           SVN_ERR(svn_ra_rev_prop(ra_session, b.added_rev,
                                   SVN_PROP_REVISION_AUTHOR,
                                   &author_revprop, scratch_pool));
@@ -3707,6 +3847,8 @@ struct conflict_tree_incoming_edit_detai
 
 /* Baton for find_modified_rev(). */
 struct find_modified_rev_baton {
+  const char *victim_abspath;
+  svn_client_ctx_t *ctx;
   apr_array_header_t *edits;
   const char *repos_relpath;
   svn_node_kind_t node_kind;
@@ -3726,6 +3868,18 @@ find_modified_rev(void *baton,
   apr_hash_index_t *hi;
   apr_pool_t *iterpool;
 
+  if (b->ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify;
+
+      notify = svn_wc_create_notify(
+                 b->victim_abspath,
+                 svn_wc_notify_tree_conflict_details_progress,
+                 scratch_pool),
+      notify->revision = log_entry->revision;
+      b->ctx->notify_func2(b->ctx->notify_baton2, notify, scratch_pool);
+    }
+
   /* No paths were changed in this revision.  Nothing to do. */
   if (! log_entry->changed_paths2)
     return SVN_NO_ERROR;
@@ -3822,6 +3976,8 @@ conflict_tree_get_details_incoming_edit(
                                              scratch_pool, scratch_pool));
   operation = svn_client_conflict_get_operation(conflict);
 
+  b.ctx = conflict->ctx;
+  b.victim_abspath = svn_client_conflict_get_local_abspath(conflict);
   b.result_pool = conflict->pool;
   b.scratch_pool = scratch_pool;
   b.edits = apr_array_make(
@@ -3862,6 +4018,19 @@ conflict_tree_get_details_incoming_edit(
                                                conflict->ctx,
                                                scratch_pool,
                                                scratch_pool));
+
+  if (conflict->ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify;
+
+      notify = svn_wc_create_notify(
+                 b.victim_abspath,
+                 svn_wc_notify_begin_search_tree_conflict_details,
+                 scratch_pool),
+      conflict->ctx->notify_func2(conflict->ctx->notify_baton2, notify,
+                                  scratch_pool);
+    }
+
   SVN_ERR(svn_ra_get_log2(ra_session, paths,
                           old_rev < new_rev ? old_rev : new_rev,
                           old_rev < new_rev ? new_rev : old_rev,
@@ -3873,6 +4042,19 @@ conflict_tree_get_details_incoming_edit(
                           find_modified_rev, &b,
                           scratch_pool));
 
+  if (conflict->ctx->notify_func2)
+    {
+      svn_wc_notify_t *notify;
+
+      notify = svn_wc_create_notify(
+                 b.victim_abspath,
+                 svn_wc_notify_end_search_tree_conflict_details,
+                 scratch_pool),
+      conflict->ctx->notify_func2(conflict->ctx->notify_baton2, notify,
+                                  scratch_pool);
+    }
+
+
   conflict->tree_conflict_incoming_details = b.edits;
 
   return SVN_NO_ERROR;
@@ -5228,15 +5410,40 @@ merge_incoming_added_dir_replace(svn_cli
       err = svn_ra_reparent(ra_session, url, scratch_pool);
       if (err)
         goto unlock_wc;
+      b.victim_abspath = local_abspath;
+      b.ctx = ctx;
       b.added_rev = SVN_INVALID_REVNUM;
       b.repos_relpath = NULL;
       b.parent_repos_relpath = svn_relpath_dirname(base_repos_relpath,
                                                    scratch_pool);
       b.pool = scratch_pool;
+
+      if (ctx->notify_func2)
+        {
+          svn_wc_notify_t *notify;
+
+          notify = svn_wc_create_notify(
+                     local_abspath,
+                     svn_wc_notify_begin_search_tree_conflict_details,
+                     scratch_pool),
+          ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
+        }
+
       err = svn_ra_get_location_segments(ra_session, "", base_revision,
                                          base_revision, SVN_INVALID_REVNUM,
                                          find_added_rev, &b,
                                          scratch_pool);
+      if (ctx->notify_func2)
+        {
+          svn_wc_notify_t *notify;
+
+          notify = svn_wc_create_notify(
+                     local_abspath,
+                     svn_wc_notify_end_search_tree_conflict_details,
+                     scratch_pool),
+          ctx->notify_func2(ctx->notify_baton2, notify, scratch_pool);
+        }
+
       if (err)
         goto unlock_wc;
 

Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=1748414&r1=1748413&r2=1748414&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Tue Jun 14 13:43:37 2016
@@ -472,6 +472,21 @@ notify_body(struct notify_baton *nb,
                                  path_local));
       break;
 
+    case svn_wc_notify_begin_search_tree_conflict_details:
+      SVN_ERR(svn_cmdline_printf(pool,
+                                 _("Searching tree conflict details for '%s' "
+                                   "in repository:\n"),
+                                 path_local));
+      break;
+
+    case svn_wc_notify_tree_conflict_details_progress:
+      SVN_ERR(svn_cmdline_printf(pool, _("\rChecking r%ld..."), n->revision));
+      break;
+
+    case svn_wc_notify_end_search_tree_conflict_details:
+      SVN_ERR(svn_cmdline_printf(pool, _(" done\n")));
+      break;
+
     case svn_wc_notify_add:
       /* We *should* only get the MIME_TYPE if PATH is a file.  If we
          do get it, and the mime-type is not textual, note that this