[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] new parameter option '--verbose' for 'svn update'

From: <Mathias.Weinert_at_gfa-net.de>
Date: 2005-09-29 13:35:00 CEST

Hi there,

as I sometimes wanted to know what 'svn update' will do and which was the current revision of my working copy I implemented a '--verbose' option for 'svn update' which provides these information:

$ svn up -v myWorkingCopy/
Current revision 409
will be updated to revision 413.
U    foo.c
A    bar.c
Updated to revision 413.

The information is only shown when current revision is not the same as the new revision.

If you find this option usefull I would be happy if you added it to subversion. If not, never mind.

Mathias

P. S.: I hope that you can read this mail properly and that you can use the patches as I can't send it in a better way at the moment.

---------------------------------------------------------------------------------

Proposed commit message:
---------------------------------------------------------------------------------
new parameter option '--verbose' for 'svnlook update'

* subversion/bindings/java/javahl/native/org/tigris/subversion/javahl/SVNClient.cpp
  new parameter 'jverbose' added to Java_org_tigris_subversion_javahl_SVNClient_update()

* subversion/bindings/java/javahl/native/SVNClient.cpp
  new parameter 'verbose' added to update()
  now calling svn_client_update3() instead of svn_client_update2() in update()

* subversion/bindings/java/javahl/native/SVNClient.h
  new parameter 'verbose' added to update()

* subversion/clients/cmdline/main.c
  new parameter 'v' added to update's entry in svn_cl__cmd_table[]

* subversion/clients/cmdline/update-cmd.c
  now calling svn_client_update3() instead of svn_client_update2() in svn_cl__update()

* subversion/include/svn/client.h
  svn_client_update3() added

* subversion/libsvn_client/checkout.c
  new parameter 'verbose' added to calls of svn_client__update_internal() in svn_client__checkout_internal()

* subversion/libsvn_client/client.h
  new parameter 'verbose' added to svn_client__update_internal()

* subversion/libsvn_client/externals.c
  new parameter 'verbose' added to call of svn_client__update_internal() in handle_external_item_change()

* subversion/libsvn_client/update.c
  new parameter 'verbose' added to svn_client__update_internal()
  svn_client_update3() added
  new parameter 'verbose' added to call of svn_client__update_internal() in svn_client_update()
---------------------------------------------------------------------------------

Patches (against revision 16227):
---------------------------------------------------------------------------------
--- subversion/bindings/java/javahl/native/org_tigris_subversion_javahl_SVNClient.cpp.orig        2005-03-28 11:00:37.000000000 +0200
+++ subversion/bindings/java/javahl/native/org_tigris_subversion_javahl_SVNClient.cpp        2005-04-28 12:42:48.248423300 +0200
@@ -481,7 +481,7 @@
  */
 JNIEXPORT jlongArray JNICALL Java_org_tigris_subversion_javahl_SVNClient_update
   (JNIEnv* env, jobject jthis, jobjectArray jpath, jobject jrevision,
-   jboolean jrecurse, jboolean jignoreExternals)
+   jboolean jverbose, jboolean jrecurse, jboolean jignoreExternals)
 {
     JNIEntry(SVNClient, update);
     SVNClient *cl = SVNClient::getCppObject(jthis);
@@ -500,8 +500,8 @@
     {
         return NULL;
     }
-    return cl->update(targets, revision, jrecurse ? true : false,
-        jignoreExternals ? true : false);
+    return cl->update(targets, revision, jverbose ? true : false,
+        jrecurse ? true : false, jignoreExternals ? true : false);
 }
 
 /*
--- subversion/bindings/java/javahl/native/SVNClient.cpp.orig        2005-04-04 14:04:39.000000000 +0200
+++ subversion/bindings/java/javahl/native/SVNClient.cpp        2005-04-28 12:43:09.639595900 +0200
@@ -664,8 +664,8 @@
          JNIUtil::handleSVNError(Err);
 }
 
-jlongArray SVNClient::update(Targets &targets, Revision &revision, bool recurse,
-                             bool ignoreExternals)
+jlongArray SVNClient::update(Targets &targets, Revision &revision, bool verbose,
+                             bool recurse, bool ignoreExternals)
 {
     Pool requestPool;
     apr_pool_t * apr_pool = requestPool.pool ();
@@ -683,8 +683,9 @@
         JNIUtil::handleSVNError(Err);
         return NULL;
     }
-    Err = svn_client_update2 (&retval, array,
+    Err = svn_client_update3 (&retval, array,
                                           revision.revision (),
+                                          verbose,
                                           recurse,
                                           ignoreExternals,
                                           ctx,
--- subversion/bindings/java/javahl/native/SVNClient.h.orig        2005-08-18 09:59:12.000000000 +0200
+++ subversion/bindings/java/javahl/native/SVNClient.h        2005-08-18 10:25:18.953357700 +0200
@@ -98,8 +98,8 @@
                   const char *message, Revision &revision);
     jlong commit(Targets &targets, const char *message, bool recurse,
                   bool noUnlock);
-    jlongArray update(Targets &targets, Revision &revision, bool recurse,
-        bool ignoreExternals);
+    jlongArray update(Targets &targets, Revision &revision, bool verbose,
+        bool recurse, bool ignoreExternals);
     void add(const char *path, bool recurse, bool force);
     void revert(const char *path, bool recurse);
     void remove(Targets &targets, const char *message,bool force);
--- subversion/clients/cmdline/main.c.orig        2005-08-18 09:56:06.000000000 +0200
+++ subversion/clients/cmdline/main.c        2005-08-18 10:25:19.047107100 +0200
@@ -751,7 +751,7 @@
        "  A 'B' in the third column signifies that the lock for the file has\n"
        "  been broken or stolen.\n"
        ),
-    {'r', 'N', 'q', svn_cl__merge_cmd_opt, SVN_CL__AUTH_OPTIONS,
+    {'r', 'v', 'N', 'q', svn_cl__merge_cmd_opt, SVN_CL__AUTH_OPTIONS,
      svn_cl__config_dir_opt, svn_cl__ignore_externals_opt} },
 
   { NULL, NULL, {0}, NULL, {0} }
--- subversion/clients/cmdline/update-cmd.c.orig        2005-03-20 01:12:53.000000000 +0100
+++ subversion/clients/cmdline/update-cmd.c        2005-04-28 12:42:17.341382100 +0200
@@ -51,8 +51,9 @@
     svn_cl__get_notifier (&ctx->notify_func2, &ctx->notify_baton2,
                           FALSE, FALSE, FALSE, pool);
 
-  SVN_ERR (svn_client_update2 (NULL, targets,
+  SVN_ERR (svn_client_update3 (NULL, targets,
                                &(opt_state->start_revision),
+                               opt_state->verbose,
                                opt_state->nonrecursive ? FALSE : TRUE,
                                opt_state->ignore_externals,
                                ctx, pool));
--- subversion/include/svn_client.h.orig        2005-09-23 12:27:38.000000000 +0200
+++ subversion/include/svn_client.h        2005-09-23 14:22:38.818029000 +0200
@@ -647,7 +647,21 @@
  * it passing @a ctx->cancel_baton at various places during the update.
  *
  * Use @a pool for any temporary allocation.
+ */
+svn_error_t *
+svn_client_update3 (apr_array_header_t **result_revs,
+                    const apr_array_header_t *paths,
+                    const svn_opt_revision_t *revision,
+                    svn_boolean_t verbose,
+                    svn_boolean_t recurse,
+                    svn_boolean_t ignore_externals,
+                    svn_client_ctx_t *ctx,
+                    apr_pool_t *pool);
+
+/**
+ * @deprecated Provided for backward compatibility with the 1.2 API.
  *
+ * Similar to svn_client_update3 except that verbose is always set to @c FALSE.
  * @since New in 1.2.
  */
 svn_error_t *
--- subversion/libsvn_client/checkout.c.orig        2005-09-23 12:28:14.000000000 +0200
+++ subversion/libsvn_client/checkout.c        2005-09-23 14:19:26.943029000 +0200
@@ -118,7 +118,7 @@
         
         /* Have update fix the incompleteness. */
         err = svn_client__update_internal (result_rev, path, revision,
-                                           recurse, ignore_externals,
+                                           FALSE, recurse, ignore_externals,
                                            use_sleep, ctx, pool);
       }
     else if (kind == svn_node_dir)
@@ -134,7 +134,7 @@
             SVN_ERR (svn_wc_ensure_adm2 (path, uuid, session_url,
                                          repos, revnum, pool));
             err = svn_client__update_internal (result_rev, path, revision,
-                                               recurse, ignore_externals,
+                                               FALSE, recurse, ignore_externals,
                                                use_sleep, ctx, pool);
             goto done;
           }
@@ -152,7 +152,7 @@
         if (entry->url && (strcmp (entry->url, session_url) == 0))
           {
             err = svn_client__update_internal (result_rev, path, revision,
-                                               recurse, ignore_externals,
+                                               FALSE, recurse, ignore_externals,
                                                use_sleep, ctx, pool);
           }
         else
--- subversion/libsvn_client/client.h.orig        2005-09-23 12:28:16.000000000 +0200
+++ subversion/libsvn_client/client.h        2005-09-23 14:22:39.036779000 +0200
@@ -325,6 +325,7 @@
 svn_client__update_internal (svn_revnum_t *result_rev,
                              const char *path,
                              const svn_opt_revision_t *revision,
+                             svn_boolean_t verbose,
                              svn_boolean_t recurse,
                              svn_boolean_t ignore_externals,
                              svn_boolean_t *timestamp_sleep,
--- subversion/libsvn_client/externals.c.orig        2005-03-30 23:02:40.000000000 +0200
+++ subversion/libsvn_client/externals.c        2005-04-28 12:44:35.735549900 +0200
@@ -343,7 +343,7 @@
             {
               SVN_ERR (svn_client__update_internal (NULL, path,
                                                     &(new_item->revision),
-                                                    TRUE, FALSE,
+                                                    FALSE, TRUE, FALSE,
                                                     ib->timestamp_sleep,
                                                     ib->ctx, ib->pool));
             }
--- subversion/libsvn_client/update.c.orig        2005-08-18 09:48:54.000000000 +0200
+++ subversion/libsvn_client/update.c        2005-08-18 10:25:19.672103100 +0200
@@ -42,6 +42,7 @@
 svn_client__update_internal (svn_revnum_t *result_rev,
                              const char *path,
                              const svn_opt_revision_t *revision,
+                             svn_boolean_t verbose,
                              svn_boolean_t recurse,
                              svn_boolean_t ignore_externals,
                              svn_boolean_t *timestamp_sleep,
@@ -134,6 +135,21 @@
                                       traversal_info,
                                       pool));
 
+  if(verbose)
+  {
+    svn_revnum_t revnumverbose = revnum;
+    if(revnumverbose < 0)
+      SVN_ERR (svn_ra_get_latest_revnum (ra_session, &revnumverbose, pool));
+    if(entry->revision != revnumverbose)
+    {
+      SVN_ERR (svn_cmdline_printf (pool, _("Current revision %ld\n"),
+                                   entry->revision));
+      SVN_ERR (svn_cmdline_printf (pool,
+                                   _("will be updated to revision %ld.\n"),
+                                   revnumverbose));
+    }
+  }
+
   /* Tell RA to do an update of URL+TARGET to REVISION; if we pass an
      invalid revnum, that means RA will use the latest revision.  */
   SVN_ERR (svn_ra_do_update (ra_session,
@@ -194,9 +210,10 @@
 }
 
 svn_error_t *
-svn_client_update2 (apr_array_header_t **result_revs,
+svn_client_update3 (apr_array_header_t **result_revs,
                     const apr_array_header_t *paths,
                     const svn_opt_revision_t *revision,
+                    svn_boolean_t verbose,
                     svn_boolean_t recurse,
                     svn_boolean_t ignore_externals,
                     svn_client_ctx_t *ctx,
@@ -221,7 +238,7 @@
         break;
 
       err = svn_client__update_internal (&result_rev, path, revision,
-                                         recurse, ignore_externals,
+                                         verbose, recurse, ignore_externals,
                                          &sleep, ctx, subpool);
       if (err && err->apr_err != SVN_ERR_WC_NOT_DIRECTORY)
         {
@@ -257,6 +274,19 @@
                    svn_client_ctx_t *ctx,
                    apr_pool_t *pool)
 {
-  return svn_client__update_internal (result_rev, path, revision, recurse,
-                                      FALSE, NULL, ctx, pool);
+  return svn_client__update_internal (result_rev, path, revision, FALSE,
+                                      recurse, FALSE, NULL, ctx, pool);
+}
+
+svn_error_t *
+svn_client_update2 (apr_array_header_t **result_revs,
+                    const apr_array_header_t *paths,
+                    const svn_opt_revision_t *revision,
+                    svn_boolean_t recurse,
+                    svn_boolean_t ignore_externals,
+                    svn_client_ctx_t *ctx,
+                    apr_pool_t *pool)
+{
+  return svn_client_update3 (result_revs, paths, revision, FALSE,
+                             recurse, ignore_externals, ctx, pool);
 }
--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org For additional commands, e-mail: dev-help@subversion.tigris.org Received on Thu Sep 29 13:36:56 2005

This is an archived mail posted to the Subversion Dev mailing list.