Hi,

conflict stats don't seem to be printed for externals during update.

Running the attached script gives this output at the end:

  + svn up --accept=postpone conflict-stats-externals/trunk2
  C    conflict-stats-externals/trunk2/alpha
  
  Fetching external item into 'conflict-stats-externals/trunk2/ext'
  C    conflict-stats-externals/trunk2/ext/zeta
  Updated external to revision 5.
  
  Updated to revision 5.
  Summary of conflicts:
    Text conflicts: 1
  + svn st conflict-stats-externals/trunk2
  X       conflict-stats-externals/trunk2/ext
  C       conflict-stats-externals/trunk2/alpha
  ?       conflict-stats-externals/trunk2/alpha.r3
  ?       conflict-stats-externals/trunk2/alpha.r5
  ?       conflict-stats-externals/trunk2/alpha.mine
  
  Performing status on external item at 'conflict-stats-externals/trunk2/ext'
  C       /tmp/conflict-stats-externals/trunk2/ext/zeta
  ?       /tmp/conflict-stats-externals/trunk2/ext/zeta.r3
  ?       /tmp/conflict-stats-externals/trunk2/ext/zeta.r5
  ?       /tmp/conflict-stats-externals/trunk2/ext/zeta.mine
  Summary of conflicts:
    Text conflicts: 2
  
Note how the update never prints a conflict count for the external,
and how its summary only accounts for conflicts which happened outside
the external.
I think the new 'svn status' summary does what we want -- it prints
the summary for the entire operation, including externals.

With the patch below, the update output changes to:

  + svn up --accept=postpone conflict-stats-externals/trunk2
  C    conflict-stats-externals/trunk2/alpha
  
  Fetching external item into 'conflict-stats-externals/trunk2/ext'
  C    conflict-stats-externals/trunk2/ext/zeta
  Updated external to revision 5.
  
  Updated to revision 5.
  Summary of conflicts:
    Text conflicts: 2

Any objections? Does anyone remember what the rationale was for
treating externals separately?

I haven't run this through make check yet.

Stefan


Index: subversion/svn/notify.c
===================================================================
--- subversion/svn/notify.c     (revision 915566)
+++ subversion/svn/notify.c     (working copy)
@@ -58,12 +58,6 @@ struct notify_baton
   unsigned int tree_conflicts;
   unsigned int skipped_paths;
 
-  /* Conflict stats for update and merge (for externals). */
-  unsigned int ext_text_conflicts;
-  unsigned int ext_prop_conflicts;
-  unsigned int ext_tree_conflicts;
-  unsigned int ext_skipped_paths;
-
   /* The cwd, for use in decomposing absolute paths. */
   const char *path_prefix;
 };
@@ -79,22 +73,11 @@ svn_cl__print_conflict_stats(void *notify_baton, a
   unsigned int tree_conflicts;
   unsigned int skipped_paths;
 
-  if (nb->in_external)
-    {
-      header = _("Summary of conflicts in external item:\n");
-      text_conflicts = nb->ext_text_conflicts;
-      prop_conflicts = nb->ext_prop_conflicts;
-      tree_conflicts = nb->ext_tree_conflicts;
-      skipped_paths = nb->ext_skipped_paths;
-    }
-  else
-    {
-      header = _("Summary of conflicts:\n");
-      text_conflicts = nb->text_conflicts;
-      prop_conflicts = nb->prop_conflicts;
-      tree_conflicts = nb->tree_conflicts;
-      skipped_paths = nb->skipped_paths;
-    }
+  header = _("Summary of conflicts:\n");
+  text_conflicts = nb->text_conflicts;
+  prop_conflicts = nb->prop_conflicts;
+  tree_conflicts = nb->tree_conflicts;
+  skipped_paths = nb->skipped_paths;
 
   if (text_conflicts > 0 || prop_conflicts > 0
     || tree_conflicts > 0 || skipped_paths > 0)
@@ -146,8 +129,7 @@ notify(void *baton, const svn_wc_notify_t *n, apr_
   switch (n->action)
     {
     case svn_wc_notify_skip:
-      nb->in_external ? nb->ext_skipped_paths++
-                      : nb->skipped_paths++;
+      nb->skipped_paths++;
       if (n->content_state == svn_wc_notify_state_missing)
         {
           if ((err = svn_cmdline_printf
@@ -194,8 +176,7 @@ notify(void *baton, const svn_wc_notify_t *n, apr_
       nb->received_some_change = TRUE;
       if (n->content_state == svn_wc_notify_state_conflicted)
         {
-          nb->in_external ? nb->ext_text_conflicts++
-                          : nb->text_conflicts++;
+          nb->text_conflicts++;
           if ((err = svn_cmdline_printf(pool, "C    %s\n", path_local)))
             goto print_error;
         }
@@ -210,8 +191,7 @@ notify(void *baton, const svn_wc_notify_t *n, apr_
       nb->received_some_change = TRUE;
       if (n->content_state == svn_wc_notify_state_conflicted)
         {
-          nb->in_external ? nb->ext_text_conflicts++
-                          : nb->text_conflicts++;
+          nb->text_conflicts++;
           statchar_buf[0] = 'C';
         }
       else
@@ -219,8 +199,7 @@ notify(void *baton, const svn_wc_notify_t *n, apr_
 
       if (n->prop_state == svn_wc_notify_state_conflicted)
         {
-          nb->in_external ? nb->ext_prop_conflicts++
-                          : nb->prop_conflicts++;
+          nb->prop_conflicts++;
           statchar_buf[1] = 'C';
         }
       else if (n->prop_state == svn_wc_notify_state_merged)
@@ -286,8 +265,7 @@ notify(void *baton, const svn_wc_notify_t *n, apr_
         nb->received_some_change = TRUE;
         if (n->content_state == svn_wc_notify_state_conflicted)
           {
-            nb->in_external ? nb->ext_text_conflicts++
-                            : nb->text_conflicts++;
+            nb->text_conflicts++;
             statchar_buf[0] = 'C';
           }
         else if (n->kind == svn_node_file)
@@ -391,8 +369,7 @@ notify(void *baton, const svn_wc_notify_t *n, apr_
       {
         if (n->content_state == svn_wc_notify_state_conflicted)
           {
-            nb->in_external ? nb->ext_text_conflicts++
-                            : nb->text_conflicts++;
+            nb->text_conflicts++;
             statchar_buf[0] = 'C';
           }
         else if (n->kind == svn_node_file)
@@ -405,8 +382,7 @@ notify(void *baton, const svn_wc_notify_t *n, apr_
 
         if (n->prop_state == svn_wc_notify_state_conflicted)
           {
-            nb->in_external ? nb->ext_prop_conflicts++
-                            : nb->prop_conflicts++;
+            nb->prop_conflicts++;
             statchar_buf[1] = 'C';
           }
         else if (n->prop_state == svn_wc_notify_state_merged)
@@ -451,8 +427,6 @@ notify(void *baton, const svn_wc_notify_t *n, apr_
         {
           svn_handle_warning2(stderr, n->err, "svn: ");
           nb->in_external = FALSE;
-          nb->ext_text_conflicts = nb->ext_prop_conflicts
-            = nb->ext_tree_conflicts = nb->ext_skipped_paths = 0;
           if ((err = svn_cmdline_printf(pool, "\n")))
             goto print_error;
         }
@@ -768,8 +742,7 @@ notify(void *baton, const svn_wc_notify_t *n, apr_
       break;
 
     case svn_wc_notify_tree_conflict:
-      nb->in_external ? nb->ext_tree_conflicts++
-                      : nb->tree_conflicts++;
+      nb->tree_conflicts++;
       if ((err = svn_cmdline_printf(pool, "   C %s\n", path_local)))
         goto print_error;
       break;
@@ -856,10 +829,6 @@ svn_cl__get_notifier(svn_wc_notify_func2_t *notify
   nb->prop_conflicts = 0;
   nb->tree_conflicts = 0;
   nb->skipped_paths = 0;
-  nb->ext_text_conflicts = 0;
-  nb->ext_prop_conflicts = 0;
-  nb->ext_tree_conflicts = 0;
-  nb->ext_skipped_paths = 0;
   SVN_ERR(svn_dirent_get_absolute(&nb->path_prefix, "", pool));
 
   *notify_func_p = notify;
#!/bin/sh

set -e

cwd=`pwd`
basename=`basename $0`
scratch_area="`echo $basename | sed -e s/\.sh$//`"
repos=$scratch_area/repos
trunk=$scratch_area/trunk
branch=$scratch_area/branch
trunk_url=file:///$cwd/$repos/trunk
branch_url=file:///$cwd/$repos/branch

set -x

rm -rf $scratch_area
mkdir -p $scratch_area

mkdir -p $trunk
echo alpha > $trunk/alpha
echo beta > $trunk/beta
mkdir $trunk/gamma
echo delta > $trunk/gamma/delta
mkdir $trunk/epsilon
echo zeta > $trunk/epsilon/zeta

svnadmin create $cwd/$repos
svn import $trunk $trunk_url -m "importing project tree"
svn copy $trunk_url $branch_url -m "creating branch"
rm -rf $trunk
svn checkout $trunk_url $trunk
svn checkout $trunk_url ${trunk}2
svn checkout $branch_url $branch

svn ps svn:externals '^/branch/epsilon ext' $trunk
svn commit -m 'setting external' $trunk

svn update $trunk
svn update ${trunk}2

echo a > $trunk/alpha
echo a > $trunk/ext/zeta
svn commit -m 'change alpha' $trunk
svn commit -m 'change zeta' $trunk/ext

echo b > ${trunk}2/alpha
echo b > ${trunk}2/ext/zeta
svn up --accept=postpone ${trunk}2
svn st ${trunk}2

Reply via email to