You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Rall <dl...@collab.net> on 2006/01/12 20:58:29 UTC

[PATCH] Issue #2287 - Make svn_client_log() take a peg revision

On Thu, 12 Jan 2006, Peter N. Lundblad wrote:

> On Thu, 12 Jan 2006, Norbert Unterberg wrote:
> 
> > So what is the status of issue #2287? Can TSVN users expect to have a
> > fully functional log viewer soon?
> >
> I've assigned this to myself, so this should be fixed before 1.4 goes out.
> Unfortunately, it can't be fixed in 1.3.x, since it is an API addition
> which is not allowed in a patch release.

Here's a straw-man patch which needs review and revision.  A couple
issues I've noticed so far include:

o The previous log function is passing its "end" parameter for
"peg_revision" (as done by svn_client_blame), but the doc string for
svn_client__open_ra_session_from_path makes me think that perhaps
svn_opt_revision_unspecified might be more appropriate?

o In the new call to svn_client__open_ra_session_from_path, the local
variable session_url is never used after being set.  What should be
done with it?  Similarly, end_revnum is used, but perhaps no longer
exactly right.

[[[

* subversion/libsvn_client/log.c
  (svn_client_log3): New function based on the previous incarnation of
   svn_client_log2() which accepts a peg revision argument.

  (svn_client_log2): Delegate to svn_client_log3(), passing "end" for
   the "peg_revision" parameter.

  (svn_client_log): Delegate to svn_client_log3() instead of
   svn_client_log2() (in the same fashion as that function).


* subversion/include/svn_client.h
  (svn_client_log3): New declaration based on the previous incarnation
   of svn_client_log2() which accepts a peg revision argument.

  (svn_client_log2): Deprecated, and adjusted doc string.

  (svn_client_log): Adjusted doc string.

]]]

Index: subversion/libsvn_client/log.c
===================================================================
--- subversion/libsvn_client/log.c	(revision 18084)
+++ subversion/libsvn_client/log.c	(working copy)
@@ -45,7 +45,8 @@
 
 
 svn_error_t *
-svn_client_log2 (const apr_array_header_t *targets,
+svn_client_log3 (const apr_array_header_t *targets,
+                 const svn_opt_revision_t *peg_revision,
                  const svn_opt_revision_t *start,
                  const svn_opt_revision_t *end,
                  int limit,
@@ -58,7 +59,7 @@
 {
   svn_ra_session_t *ra_session;
   const char *path;
-  const char *base_url;
+  const char *base_url, *session_url;
   const char *base_name = NULL;
   apr_array_header_t *condensed_targets;
   svn_revnum_t start_revnum, end_revnum;
@@ -159,10 +160,11 @@
 
   /* Open a repository session to the BASE_URL. */
   SVN_ERR (svn_path_condense_targets (&base_name, NULL, targets, TRUE, pool)); 
-  SVN_ERR (svn_client__open_ra_session_internal (&ra_session, base_url, 
-                                                 base_name, NULL, NULL,
-                                                 (NULL != base_name), TRUE, 
-                                                 ctx, pool));
+  SVN_ERR (svn_client__open_ra_session_from_path (&ra_session,
+                                                  &end_revnum,
+                                                  &session_url, base_url,
+                                                  peg_revision, end, ctx,
+                                                  pool));
 
   /* It's a bit complex to correctly handle the special revision words
    * such as "BASE", "COMMITTED", and "PREV".  For example, if the
@@ -270,6 +272,23 @@
 }
 
 svn_error_t *
+svn_client_log2 (const apr_array_header_t *targets,
+                 const svn_opt_revision_t *start,
+                 const svn_opt_revision_t *end,
+                 int limit,
+                 svn_boolean_t discover_changed_paths,
+                 svn_boolean_t strict_node_history,
+                 svn_log_message_receiver_t receiver,
+                 void *receiver_baton,
+                 svn_client_ctx_t *ctx,
+                 apr_pool_t *pool)
+{
+  return svn_client_log3 (targets, end, start, end, limit,
+                          discover_changed_paths, strict_node_history,
+                          receiver, receiver_baton, ctx, pool);
+}
+
+svn_error_t *
 svn_client_log (const apr_array_header_t *targets,
                 const svn_opt_revision_t *start,
                 const svn_opt_revision_t *end,
@@ -282,7 +301,7 @@
 {
   svn_error_t *err = SVN_NO_ERROR;
 
-  err = svn_client_log2 (targets, start, end, 0, discover_changed_paths,
+  err = svn_client_log3 (targets, end, start, end, 0, discover_changed_paths,
                          strict_node_history, receiver, receiver_baton, ctx,
                          pool);
     
Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h	(revision 18084)
+++ subversion/include/svn_client.h	(working copy)
@@ -1177,7 +1177,8 @@
  * for which log messages are desired.  The repository info is
  * determined by taking the common prefix of the target entries' URLs.
  * @a receiver is invoked only on messages whose revisions involved a
- * change to some path in @a targets.
+ * change to some path in @a targets.  @a peg_revision indicates in
+ * which revision @a targets are valid.
  *
  * If @a limit is non-zero only invoke @a receiver on the first @a limit
  * logs.
@@ -1202,6 +1203,27 @@
  * If @a ctx->notify_func2 is non-null, then call @a ctx->notify_func2/baton2
  * with a 'skip' signal on any unversioned targets.
  *
+ * @since New in 1.4.
+ */
+svn_error_t *
+svn_client_log3 (const apr_array_header_t *targets,
+                 const svn_opt_revision_t *peg_revision,
+                 const svn_opt_revision_t *start,
+                 const svn_opt_revision_t *end,
+                 int limit,
+                 svn_boolean_t discover_changed_paths,
+                 svn_boolean_t strict_node_history,
+                 svn_log_message_receiver_t receiver,
+                 void *receiver_baton,
+                 svn_client_ctx_t *ctx,
+                 apr_pool_t *pool);
+
+
+/**
+ * Similar to svn_client_log3(), but with the @a peg_revision
+ * parameter set to @c end.
+ *
+ * @deprecated Provided for backward compatibility with the 1.2 API.
  * @since New in 1.2.
  */
 svn_error_t *
@@ -1218,8 +1240,9 @@
 
 
 /**
- * Similar to svn_client_log2(), but with the @a limit parameter set to 0,
- * and the following special case:
+ * Similar to svn_client_log3(), but with the @a peg_revision
+ * parameter set to @c end, the @a limit parameter set to 0, and the
+ * following special case:
  *
  * Special case for repositories at revision 0:
  *


Re: [PATCH] Issue #2287 - Make svn_client_log() take a peg revision

Posted by "S.Ramaswamy" <sr...@gmail.com>.
The last patch that I sent and the discussions here:
http://svn.haxx.se/dev/archive-2005-09/0281.shtml


On 1/13/06, Daniel Rall <dl...@collab.net> wrote:
> Apparently I sent the wrong version of this patch.  Now re-attached
> below at end of message.
>
> On Thu, 12 Jan 2006, Daniel Rall wrote:
>
> > On Thu, 12 Jan 2006, Peter N. Lundblad wrote:
> >
> > > On Thu, 12 Jan 2006, Norbert Unterberg wrote:
> > >
> > > > So what is the status of issue #2287? Can TSVN users expect to have a
> > > > fully functional log viewer soon?
> > > >
> > > I've assigned this to myself, so this should be fixed before 1.4 goes out.
> > > Unfortunately, it can't be fixed in 1.3.x, since it is an API addition
> > > which is not allowed in a patch release.
> >
> > Here's a straw-man patch which needs review and revision.  A couple
> > issues I've noticed so far include:
> >
> > o The previous log function is passing its "end" parameter for
> > "peg_revision" (as done by svn_client_blame), but the doc string for
> > svn_client__open_ra_session_from_path makes me think that perhaps
> > svn_opt_revision_unspecified might be more appropriate?
> >
> > o In the new call to svn_client__open_ra_session_from_path, the local
> > variable session_url is never used after being set.  What should be
> > done with it?  Similarly, end_revnum is used, but perhaps no longer
> > exactly right.
> >
> > [[[
> >
> > * subversion/libsvn_client/log.c
> >   (svn_client_log3): New function based on the previous incarnation of
> >    svn_client_log2() which accepts a peg revision argument.
> >
> >   (svn_client_log2): Delegate to svn_client_log3(), passing "end" for
> >    the "peg_revision" parameter.
> >
> >   (svn_client_log): Delegate to svn_client_log3() instead of
> >    svn_client_log2() (in the same fashion as that function).
> >
> >
> > * subversion/include/svn_client.h
> >   (svn_client_log3): New declaration based on the previous incarnation
> >    of svn_client_log2() which accepts a peg revision argument.
> >
> >   (svn_client_log2): Deprecated, and adjusted doc string.
> >
> >   (svn_client_log): Adjusted doc string.
> >
> > ]]]
>
> Index: subversion/include/svn_client.h
> ===================================================================
> --- subversion/include/svn_client.h     (revision 18085)
> +++ subversion/include/svn_client.h     (working copy)
> @@ -1177,7 +1177,8 @@
>   * for which log messages are desired.  The repository info is
>   * determined by taking the common prefix of the target entries' URLs.
>   * @a receiver is invoked only on messages whose revisions involved a
> - * change to some path in @a targets.
> + * change to some path in @a targets.  @a peg_revision indicates in
> + * which revision @a targets are valid.
>   *
>   * If @a limit is non-zero only invoke @a receiver on the first @a limit
>   * logs.
> @@ -1202,6 +1203,27 @@
>   * If @a ctx->notify_func2 is non-null, then call @a ctx->notify_func2/baton2
>   * with a 'skip' signal on any unversioned targets.
>   *
> + * @since New in 1.4.
> + */
> +svn_error_t *
> +svn_client_log3 (const apr_array_header_t *targets,
> +                 const svn_opt_revision_t *peg_revision,
> +                 const svn_opt_revision_t *start,
> +                 const svn_opt_revision_t *end,
> +                 int limit,
> +                 svn_boolean_t discover_changed_paths,
> +                 svn_boolean_t strict_node_history,
> +                 svn_log_message_receiver_t receiver,
> +                 void *receiver_baton,
> +                 svn_client_ctx_t *ctx,
> +                 apr_pool_t *pool);
> +
> +
> +/**
> + * Similar to svn_client_log3(), but with the @a peg_revision
> + * parameter set to @c end.
> + *
> + * @deprecated Provided for backward compatibility with the 1.2 API.
>   * @since New in 1.2.
>   */
>  svn_error_t *
> @@ -1218,8 +1240,9 @@
>
>
>  /**
> - * Similar to svn_client_log2(), but with the @a limit parameter set to 0,
> - * and the following special case:
> + * Similar to svn_client_log3(), but with the @a peg_revision
> + * parameter set to @c end, the @a limit parameter set to 0, and the
> + * following special case:
>   *
>   * Special case for repositories at revision 0:
>   *
> Index: subversion/libsvn_client/log.c
> ===================================================================
> --- subversion/libsvn_client/log.c      (revision 18085)
> +++ subversion/libsvn_client/log.c      (working copy)
> @@ -45,7 +45,8 @@
>
>
>  svn_error_t *
> -svn_client_log2 (const apr_array_header_t *targets,
> +svn_client_log3 (const apr_array_header_t *targets,
> +                 const svn_opt_revision_t *peg_revision,
>                   const svn_opt_revision_t *start,
>                   const svn_opt_revision_t *end,
>                   int limit,
> @@ -58,7 +59,7 @@
>  {
>    svn_ra_session_t *ra_session;
>    const char *path;
> -  const char *base_url;
> +  const char *base_url, *session_url;
>    const char *base_name = NULL;
>    apr_array_header_t *condensed_targets;
>    svn_revnum_t start_revnum, end_revnum;
> @@ -159,10 +160,9 @@
>
>    /* Open a repository session to the BASE_URL. */
>    SVN_ERR (svn_path_condense_targets (&base_name, NULL, targets, TRUE, pool));
> -  SVN_ERR (svn_client__open_ra_session_internal (&ra_session, base_url,
> -                                                 base_name, NULL, NULL,
> -                                                 (NULL != base_name), TRUE,
> -                                                 ctx, pool));
> +  SVN_ERR (svn_client__ra_session_from_path (&ra_session, &end_revnum,
> +                                             &session_url, base_url,
> +                                             peg_revision, end, ctx, pool));
>
>    /* It's a bit complex to correctly handle the special revision words
>     * such as "BASE", "COMMITTED", and "PREV".  For example, if the
> @@ -270,6 +270,23 @@
>  }
>
>  svn_error_t *
> +svn_client_log2 (const apr_array_header_t *targets,
> +                 const svn_opt_revision_t *start,
> +                 const svn_opt_revision_t *end,
> +                 int limit,
> +                 svn_boolean_t discover_changed_paths,
> +                 svn_boolean_t strict_node_history,
> +                 svn_log_message_receiver_t receiver,
> +                 void *receiver_baton,
> +                 svn_client_ctx_t *ctx,
> +                 apr_pool_t *pool)
> +{
> +  return svn_client_log3 (targets, end, start, end, limit,
> +                          discover_changed_paths, strict_node_history,
> +                          receiver, receiver_baton, ctx, pool);
> +}
> +
> +svn_error_t *
>  svn_client_log (const apr_array_header_t *targets,
>                  const svn_opt_revision_t *start,
>                  const svn_opt_revision_t *end,
> @@ -282,7 +299,7 @@
>  {
>    svn_error_t *err = SVN_NO_ERROR;
>
> -  err = svn_client_log2 (targets, start, end, 0, discover_changed_paths,
> +  err = svn_client_log3 (targets, end, start, end, 0, discover_changed_paths,
>                           strict_node_history, receiver, receiver_baton, ctx,
>                           pool);
>
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: [PATCH] Issue #2287 - Make svn_client_log() take a peg revision

Posted by Daniel Rall <dl...@collab.net>.
Apparently I sent the wrong version of this patch.  Now re-attached
below at end of message.

On Thu, 12 Jan 2006, Daniel Rall wrote:

> On Thu, 12 Jan 2006, Peter N. Lundblad wrote:
> 
> > On Thu, 12 Jan 2006, Norbert Unterberg wrote:
> > 
> > > So what is the status of issue #2287? Can TSVN users expect to have a
> > > fully functional log viewer soon?
> > >
> > I've assigned this to myself, so this should be fixed before 1.4 goes out.
> > Unfortunately, it can't be fixed in 1.3.x, since it is an API addition
> > which is not allowed in a patch release.
> 
> Here's a straw-man patch which needs review and revision.  A couple
> issues I've noticed so far include:
> 
> o The previous log function is passing its "end" parameter for
> "peg_revision" (as done by svn_client_blame), but the doc string for
> svn_client__open_ra_session_from_path makes me think that perhaps
> svn_opt_revision_unspecified might be more appropriate?
> 
> o In the new call to svn_client__open_ra_session_from_path, the local
> variable session_url is never used after being set.  What should be
> done with it?  Similarly, end_revnum is used, but perhaps no longer
> exactly right.
> 
> [[[
> 
> * subversion/libsvn_client/log.c
>   (svn_client_log3): New function based on the previous incarnation of
>    svn_client_log2() which accepts a peg revision argument.
> 
>   (svn_client_log2): Delegate to svn_client_log3(), passing "end" for
>    the "peg_revision" parameter.
> 
>   (svn_client_log): Delegate to svn_client_log3() instead of
>    svn_client_log2() (in the same fashion as that function).
> 
> 
> * subversion/include/svn_client.h
>   (svn_client_log3): New declaration based on the previous incarnation
>    of svn_client_log2() which accepts a peg revision argument.
> 
>   (svn_client_log2): Deprecated, and adjusted doc string.
> 
>   (svn_client_log): Adjusted doc string.
> 
> ]]]

Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h	(revision 18085)
+++ subversion/include/svn_client.h	(working copy)
@@ -1177,7 +1177,8 @@
  * for which log messages are desired.  The repository info is
  * determined by taking the common prefix of the target entries' URLs.
  * @a receiver is invoked only on messages whose revisions involved a
- * change to some path in @a targets.
+ * change to some path in @a targets.  @a peg_revision indicates in
+ * which revision @a targets are valid.
  *
  * If @a limit is non-zero only invoke @a receiver on the first @a limit
  * logs.
@@ -1202,6 +1203,27 @@
  * If @a ctx->notify_func2 is non-null, then call @a ctx->notify_func2/baton2
  * with a 'skip' signal on any unversioned targets.
  *
+ * @since New in 1.4.
+ */
+svn_error_t *
+svn_client_log3 (const apr_array_header_t *targets,
+                 const svn_opt_revision_t *peg_revision,
+                 const svn_opt_revision_t *start,
+                 const svn_opt_revision_t *end,
+                 int limit,
+                 svn_boolean_t discover_changed_paths,
+                 svn_boolean_t strict_node_history,
+                 svn_log_message_receiver_t receiver,
+                 void *receiver_baton,
+                 svn_client_ctx_t *ctx,
+                 apr_pool_t *pool);
+
+
+/**
+ * Similar to svn_client_log3(), but with the @a peg_revision
+ * parameter set to @c end.
+ *
+ * @deprecated Provided for backward compatibility with the 1.2 API.
  * @since New in 1.2.
  */
 svn_error_t *
@@ -1218,8 +1240,9 @@
 
 
 /**
- * Similar to svn_client_log2(), but with the @a limit parameter set to 0,
- * and the following special case:
+ * Similar to svn_client_log3(), but with the @a peg_revision
+ * parameter set to @c end, the @a limit parameter set to 0, and the
+ * following special case:
  *
  * Special case for repositories at revision 0:
  *
Index: subversion/libsvn_client/log.c
===================================================================
--- subversion/libsvn_client/log.c	(revision 18085)
+++ subversion/libsvn_client/log.c	(working copy)
@@ -45,7 +45,8 @@
 
 
 svn_error_t *
-svn_client_log2 (const apr_array_header_t *targets,
+svn_client_log3 (const apr_array_header_t *targets,
+                 const svn_opt_revision_t *peg_revision,
                  const svn_opt_revision_t *start,
                  const svn_opt_revision_t *end,
                  int limit,
@@ -58,7 +59,7 @@
 {
   svn_ra_session_t *ra_session;
   const char *path;
-  const char *base_url;
+  const char *base_url, *session_url;
   const char *base_name = NULL;
   apr_array_header_t *condensed_targets;
   svn_revnum_t start_revnum, end_revnum;
@@ -159,10 +160,9 @@
 
   /* Open a repository session to the BASE_URL. */
   SVN_ERR (svn_path_condense_targets (&base_name, NULL, targets, TRUE, pool)); 
-  SVN_ERR (svn_client__open_ra_session_internal (&ra_session, base_url, 
-                                                 base_name, NULL, NULL,
-                                                 (NULL != base_name), TRUE, 
-                                                 ctx, pool));
+  SVN_ERR (svn_client__ra_session_from_path (&ra_session, &end_revnum,
+                                             &session_url, base_url,
+                                             peg_revision, end, ctx, pool));
 
   /* It's a bit complex to correctly handle the special revision words
    * such as "BASE", "COMMITTED", and "PREV".  For example, if the
@@ -270,6 +270,23 @@
 }
 
 svn_error_t *
+svn_client_log2 (const apr_array_header_t *targets,
+                 const svn_opt_revision_t *start,
+                 const svn_opt_revision_t *end,
+                 int limit,
+                 svn_boolean_t discover_changed_paths,
+                 svn_boolean_t strict_node_history,
+                 svn_log_message_receiver_t receiver,
+                 void *receiver_baton,
+                 svn_client_ctx_t *ctx,
+                 apr_pool_t *pool)
+{
+  return svn_client_log3 (targets, end, start, end, limit,
+                          discover_changed_paths, strict_node_history,
+                          receiver, receiver_baton, ctx, pool);
+}
+
+svn_error_t *
 svn_client_log (const apr_array_header_t *targets,
                 const svn_opt_revision_t *start,
                 const svn_opt_revision_t *end,
@@ -282,7 +299,7 @@
 {
   svn_error_t *err = SVN_NO_ERROR;
 
-  err = svn_client_log2 (targets, start, end, 0, discover_changed_paths,
+  err = svn_client_log3 (targets, end, start, end, 0, discover_changed_paths,
                          strict_node_history, receiver, receiver_baton, ctx,
                          pool);