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 2010/06/13 13:44:37 UTC

svn commit: r954205 - in /subversion/trunk/subversion: include/svn_error_codes.h include/svn_wc.h libsvn_wc/adm_ops.c svn/notify.c tests/cmdline/changelist_tests.py

Author: stsp
Date: Sun Jun 13 11:44:37 2010
New Revision: 954205

URL: http://svn.apache.org/viewvc?rev=954205&view=rev
Log:
Change the way notifications for changelists are printed by the CLI client.
Also, clean up abuse of an svn_error_t as a container for notification
information.

* subversion/include/svn_wc.h
  (svn_wc_notify_action_t): Deprecate svn_wc_notify_changelist_moved.
  (svn_wc_notify_t): Clear up docstring of changelist_name.

* subversion/include/svn_error_codes.h
  (SVN_ERR_WC_CHANGELIST_MOVE): Deprecate. Moving something from one
   changelist to another is not an error.

* subversion/svn/notify.c
  (notify): Print notifications such as 'A [changelist name] path' instead
   of printing English sentences that contain the same information but
   take a lot longer to parse for both humans and machines.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc_set_changelist2): Stop sending errors about files that get moved
   from one changelist to another (the CLI client was peeking into the ERR
   member of the notification baton to obtain and print a warning message
   generated within libsvn_wc!). Instead, provide clear separation between
   logic and presentation layers: Just send delete from / add to changelist
   notifications to clients and let them figure out their own way of
   presenting the changelist move to the user.

* subversion/tests/cmdline/changelist_tests.py
  (_re_cl_add, _re_cl_rem, verify_changelist_output,
   add_remove_changelists): Adjust expected output.

Modified:
    subversion/trunk/subversion/include/svn_error_codes.h
    subversion/trunk/subversion/include/svn_wc.h
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/svn/notify.c
    subversion/trunk/subversion/tests/cmdline/changelist_tests.py

Modified: subversion/trunk/subversion/include/svn_error_codes.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_error_codes.h?rev=954205&r1=954204&r2=954205&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_error_codes.h (original)
+++ subversion/trunk/subversion/include/svn_error_codes.h Sun Jun 13 11:44:37 2010
@@ -470,7 +470,9 @@ SVN_ERROR_START
              SVN_ERR_WC_CATEGORY_START + 28,
              "Failed to locate 'copyfrom' path in working copy")
 
-  /** @since New in 1.5. */
+  /** @since New in 1.5.
+   * @deprecated This event is not an error, and is now reported
+   * via the standard notification mechanism instead. */
   SVN_ERRDEF(SVN_ERR_WC_CHANGELIST_MOVE,
              SVN_ERR_WC_CATEGORY_START + 29,
              "Moving a path from one changelist to another")

Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=954205&r1=954204&r2=954205&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Sun Jun 13 11:44:37 2010
@@ -994,7 +994,8 @@ typedef enum svn_wc_notify_action_t
   svn_wc_notify_changelist_clear,
 
   /** Warn user that a path has moved from one changelist to another.
-      @since New in 1.5. */
+      @since New in 1.5.
+      @deprecated As of 1.7, separate clear and set notifications are sent. */
   svn_wc_notify_changelist_moved,
 
   /** A merge operation (to path) has begun.  See #svn_wc_notify_t.merge_range.
@@ -1209,7 +1210,7 @@ typedef struct svn_wc_notify_t {
    */
   svn_revnum_t revision;
 
-  /** When @c action is #svn_wc_notify_changelist_add or name. (### What?)
+  /** If @c action pertains to a changelist, this is the changelist name.
    * In all other cases, it is @c NULL.  @since New in 1.5 */
   const char *changelist_name;
 

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=954205&r1=954204&r2=954205&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Sun Jun 13 11:44:37 2010
@@ -2909,22 +2909,6 @@ svn_wc_set_changelist2(svn_wc_context_t 
       && strcmp(existing_changelist, changelist) == 0)
     return SVN_NO_ERROR;
 
-  /* If the path is already a member of a changelist, warn the
-     user about this, but still allow the reassignment to happen. */
-  if (existing_changelist && changelist && notify_func)
-    {
-      svn_error_t *reassign_err =
-        svn_error_createf(SVN_ERR_WC_CHANGELIST_MOVE, NULL,
-                          _("Removing '%s' from changelist '%s'."),
-                          local_abspath, existing_changelist);
-      notify = svn_wc_create_notify(local_abspath,
-                                    svn_wc_notify_changelist_moved,
-                                    scratch_pool);
-      notify->err = reassign_err;
-      notify_func(notify_baton, notify, scratch_pool);
-      svn_error_clear(notify->err);
-    }
-
   /* Set the changelist. */
   SVN_ERR(svn_wc__db_op_set_changelist(wc_ctx->db, local_abspath, changelist,
                                        scratch_pool));
@@ -2932,13 +2916,23 @@ svn_wc_set_changelist2(svn_wc_context_t 
   /* And tell someone what we've done. */
   if (notify_func)
     {
-      notify = svn_wc_create_notify(local_abspath,
-                                    changelist
-                                    ? svn_wc_notify_changelist_set
-                                    : svn_wc_notify_changelist_clear,
-                                    scratch_pool);
-      notify->changelist_name = changelist;
-      notify_func(notify_baton, notify, scratch_pool);
+      if (existing_changelist)
+        {
+          notify = svn_wc_create_notify(local_abspath,
+                                        svn_wc_notify_changelist_clear,
+                                        scratch_pool);
+          notify->changelist_name = existing_changelist;
+          notify_func(notify_baton, notify, scratch_pool);
+        }
+
+      if (changelist)
+        {
+          notify = svn_wc_create_notify(local_abspath,
+                                        svn_wc_notify_changelist_set,
+                                        scratch_pool);
+          notify->changelist_name = changelist;
+          notify_func(notify_baton, notify, scratch_pool);
+        }
     }
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=954205&r1=954204&r2=954205&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Sun Jun 13 11:44:37 2010
@@ -613,24 +613,19 @@ notify(void *baton, const svn_wc_notify_
       break;
 
     case svn_wc_notify_changelist_set:
-      if ((err = svn_cmdline_printf(pool, _("Path '%s' is now a member of "
-                                            "changelist '%s'.\n"),
-                                    path_local, n->changelist_name)))
+      if ((err = svn_cmdline_printf(pool, "A [%s] %s\n",
+                                    n->changelist_name, path_local)))
         goto print_error;
       break;
 
     case svn_wc_notify_changelist_clear:
+    case svn_wc_notify_changelist_moved:
       if ((err = svn_cmdline_printf(pool,
-                                    _("Path '%s' is no longer a member of "
-                                      "a changelist.\n"),
-                                    path_local)))
+                                    "D [%s] %s\n",
+                                    n->changelist_name, path_local)))
         goto print_error;
       break;
 
-    case svn_wc_notify_changelist_moved:
-      svn_handle_warning2(stderr, n->err, "svn: ");
-      break;
-
     case svn_wc_notify_merge_begin:
       if (n->merge_range == NULL)
         err = svn_cmdline_printf(pool,

Modified: subversion/trunk/subversion/tests/cmdline/changelist_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/changelist_tests.py?rev=954205&r1=954204&r2=954205&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/changelist_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/changelist_tests.py Sun Jun 13 11:44:37 2010
@@ -101,8 +101,8 @@ def clname_from_lastchar_cb(full_path):
 
 # Regular expressions for 'svn changelist' output.
 _re_cl_skip = re.compile("Skipped '(.*)'")
-_re_cl_add  = re.compile("Path '(.*)' is now a member of changelist '(.*)'.")
-_re_cl_rem  = re.compile("Path '(.*)' is no longer a member of a changelist.")
+_re_cl_add  = re.compile("^A \[(.*)\] (.*)")
+_re_cl_rem  = re.compile("^D \[(.*)\] (.*)")
 
 def verify_changelist_output(output, expected_adds=None,
                              expected_removals=None,
@@ -133,21 +133,21 @@ def verify_changelist_output(output, exp
     match = _re_cl_rem.match(line)
     if match \
        and expected_removals \
-       and match.group(1) in expected_removals:
+       and match.group(2) in expected_removals:
         continue
     elif match:
       raise svntest.Failure("Unexpected changelist removal line: " + line)
     match = _re_cl_add.match(line)
     if match \
        and expected_adds \
-       and expected_adds.get(match.group(1)) == match.group(2):
+       and expected_adds.get(match.group(2)) == match.group(1):
         continue
     elif match:
       raise svntest.Failure("Unexpected changelist add line: " + line)
     match = _re_cl_skip.match(line)
     if match \
        and expected_skips \
-       and match.group(1) in expected_skips:
+       and match.group(2) in expected_skips:
         continue
     elif match:
       raise svntest.Failure("Unexpected changelist skip line: " + line)
@@ -277,7 +277,8 @@ def add_remove_changelists(sbox):
     os.path.join(wc_dir, 'A', 'D', 'H', 'psi') : 'bar',
     os.path.join(wc_dir, 'A', 'D', 'gamma') : 'bar',
     }
-  verify_changelist_output(output, expected_adds)
+  expected_removals = expected_adds
+  verify_changelist_output(output, expected_adds, expected_removals)
 
   # svn changelist baz WC_DIR/A/D/H --depth infinity
   exit_code, output, errput = svntest.main.run_svn(".*", "changelist", "baz",
@@ -289,7 +290,8 @@ def add_remove_changelists(sbox):
     os.path.join(wc_dir, 'A', 'D', 'H', 'omega') : 'baz',
     os.path.join(wc_dir, 'A', 'D', 'H', 'psi') : 'baz',
     }
-  verify_changelist_output(output, expected_adds)
+  expected_removals = expected_adds
+  verify_changelist_output(output, expected_adds, expected_removals)
 
   ### Now, let's selectively rename some changelists ###
 
@@ -306,7 +308,8 @@ def add_remove_changelists(sbox):
     os.path.join(wc_dir, 'A', 'mu') : 'foo-rename',
     os.path.join(wc_dir, 'iota') : 'foo-rename',
     }
-  verify_changelist_output(output, expected_adds)
+  expected_removals = expected_adds
+  verify_changelist_output(output, expected_adds, expected_removals)
 
   # svn changelist bar WC_DIR --depth infinity
   #     --changelist foo-rename --changelist baz
@@ -324,7 +327,8 @@ def add_remove_changelists(sbox):
     os.path.join(wc_dir, 'A', 'mu') : 'bar',
     os.path.join(wc_dir, 'iota') : 'bar',
     }
-  verify_changelist_output(output, expected_adds)
+  expected_removals = expected_adds
+  verify_changelist_output(output, expected_adds, expected_removals)
 
   ### Okay.  Time to remove some stuff from changelists now. ###