You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "S.Ramaswamy" <ra...@collab.net> on 2004/04/19 04:46:17 UTC
[PATCH] - svn blame doesn't use the working revision ( Issue #1777
)
John Szakmeister, Mike, Karl - Thanks.
The revised patch:
Log Message:
Fix Issue #1777: 'svn blame' should default to the working revision,
when no revision is specified.
* subversion/clients/cmdline/blame-cmd.c
(svn_cl__blame) : Set end revision to svn_opt_revision_base if
the target is a working copy, and to svn_opt_revision_head if
the target is a URL.
Index: subversion/clients/cmdline/blame-cmd.c
===================================================================
--- subversion/clients/cmdline/blame-cmd.c (revision 9374)
+++ subversion/clients/cmdline/blame-cmd.c (working copy)
@@ -85,6 +85,8 @@
svn_stream_t *out;
blame_baton_t bl;
int i;
+ svn_boolean_t is_head_or_base = FALSE;
+ svn_boolean_t is_url;
SVN_ERR (svn_opt_args_to_target_array (&targets, os,
opt_state->targets,
@@ -108,7 +110,9 @@
opt_state->start_revision.value.number = 1;
}
else
- opt_state->end_revision.kind = svn_opt_revision_head;
+ {
+ is_head_or_base = TRUE;
+ }
}
if (opt_state->start_revision.kind == svn_opt_revision_unspecified)
@@ -129,6 +133,14 @@
const char *target = ((const char **) (targets->elts))[i];
svn_pool_clear (subpool);
SVN_ERR (svn_cl__check_cancel (ctx->cancel_baton));
+ if (is_head_or_base)
+ {
+ is_url = svn_path_is_url(target);
+ if (is_url)
+ opt_state->end_revision.kind = svn_opt_revision_head;
+ else
+ opt_state->end_revision.kind = svn_opt_revision_base;
+ }
err = svn_client_blame (target,
&opt_state->start_revision,
&opt_state->end_revision,
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] - svn blame doesn't use the working revision ( Issue #1777 )
Posted by John Szakmeister <jo...@szakmeister.net>.
Committed in r9440 with a couple minor changes. I have some comments below
for future patches. :-) Thanks for the patch!
-John
On Monday 19 April 2004 00:46, S.Ramaswamy wrote:
> John Szakmeister, Mike, Karl - Thanks.
>
> The revised patch:
>
> Log Message:
> Fix Issue #1777: 'svn blame' should default to the working revision,
> when no revision is specified.
>
> * subversion/clients/cmdline/blame-cmd.c
> (svn_cl__blame) : Set end revision to svn_opt_revision_base if
> the target is a working copy, and to svn_opt_revision_head if
> the target is a URL.
>
> Index: subversion/clients/cmdline/blame-cmd.c
> ===================================================================
> --- subversion/clients/cmdline/blame-cmd.c (revision 9374)
> +++ subversion/clients/cmdline/blame-cmd.c (working copy)
> @@ -85,6 +85,8 @@
> svn_stream_t *out;
> blame_baton_t bl;
> int i;
> + svn_boolean_t is_head_or_base = FALSE;
> + svn_boolean_t is_url;
>
> SVN_ERR (svn_opt_args_to_target_array (&targets, os,
> opt_state->targets,
> @@ -108,7 +110,9 @@
> opt_state->start_revision.value.number = 1;
> }
> else
> - opt_state->end_revision.kind = svn_opt_revision_head;
> + {
> + is_head_or_base = TRUE;
> + }
No need for the extra braces here.
> }
>
> if (opt_state->start_revision.kind == svn_opt_revision_unspecified)
> @@ -129,6 +133,14 @@
> const char *target = ((const char **) (targets->elts))[i];
> svn_pool_clear (subpool);
> SVN_ERR (svn_cl__check_cancel (ctx->cancel_baton));
> + if (is_head_or_base)
> + {
> + is_url = svn_path_is_url(target);
There is also no need to have another variable to hold the result of the path
check. This is a pretty simple operation, and the result doesn't get used
again anywhere else.
> + if (is_url)
> + opt_state->end_revision.kind = svn_opt_revision_head;
> + else
> + opt_state->end_revision.kind = svn_opt_revision_base;
> + }
The indentation was a little off here. We generally only use 2 spaces for the
indentation.
> err = svn_client_blame (target,
> &opt_state->start_revision,
> &opt_state->end_revision,
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org