You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Madan U Sreenivasan <ma...@collab.net> on 2006/07/17 12:30:50 UTC
[PATCH] Handle loop-critical variable in parse_mergeinfo_from_db()
Hi,
In the merge-tracking branch:
Currently parse_mergeinfo_from_db() - I wonder why it is not
parse_merge_info_from_db() - will fail for mergeinfo from more than one
source. This is because, the variable lastmergedfrom (which is used in the
if condition that creates new hash key-value pairs and reinitializes the
value array) is never set. The attached patch fixes this.
I feel the while loop could be simpler, but this patch only does whats
best with the existing code. The while loop fixing is a different problem.
:)
I also see that the parse_mergeinfo_from_db() function contains empty
lines with whitespaces. Maybe we should take this up and remove the
whitespaces. Any committer volunteers?
[[[
Fix loop-critical variable handling in parse_mergeinfo_from_db().
Currently, this variable is never set, but is tested against in an 'if'
condition.
(In branches/merge-tracking)
* subversion/libsvn_fs_fs/tree.c:
(parse_mergeinfo_from_db): Set lastmergedfrom before before looping
again.
]]]
Regards,
Madan.
Re: [PATCH] Handle loop-critical variable in parse_mergeinfo_from_db()
Posted by Daniel Rall <dl...@collab.net>.
On Mon, 17 Jul 2006, Daniel Berlin wrote:
> Madan U Sreenivasan wrote:
...
> > Currently parse_mergeinfo_from_db() - I wonder why it is not
> > parse_merge_info_from_db() -
This name would be more consistent.
> > ...will fail for mergeinfo from more than one source.
>
> > This is because, the variable lastmergedfrom (which is used in the
> > if condition that creates new hash key-value pairs and reinitializes the
> > value array) is never set. The attached patch fixes this.
Committed in r20713.
> > I feel the while loop could be simpler, but this patch only does whats
> > best with the existing code.
>
> It's not the easiest code in the world to understand, granted.
> It could be written nicer, I just wanted something that worked.
I've had a hard time understanding this code, too. Refactoring it for
comprehensibility after writing some regression tests wouldn't be out
of line.
> The while loop fixing is a different problem.
>
> > I also see that the parse_mergeinfo_from_db() function contains empty
> > lines with whitespaces. Maybe we should take this up and remove the
> > whitespaces. Any committer volunteers?
>
> Feel free to just whitespace-cleanup the region and commit the result.
Handled in r20714.
Re: [PATCH] Handle loop-critical variable in parse_mergeinfo_from_db()
Posted by Daniel Berlin <db...@dberlin.org>.
Madan U Sreenivasan wrote:
> Hi,
>
> In the merge-tracking branch:
>
> Currently parse_mergeinfo_from_db() - I wonder why it is not
> parse_merge_info_from_db() - will fail for mergeinfo from more than one
> source.
> This is because, the variable lastmergedfrom (which is used in the
> if condition that creates new hash key-value pairs and reinitializes the
> value array) is never set. The attached patch fixes this.
>
> I feel the while loop could be simpler, but this patch only does whats
> best with the existing code.
It's not the easiest code in the world to understand, granted.
It could be written nicer, I just wanted something that worked.
The while loop fixing is a different problem.
> :)
>
> I also see that the parse_mergeinfo_from_db() function contains empty
> lines with whitespaces. Maybe we should take this up and remove the
> whitespaces. Any committer volunteers?
Feel free to just whitespace-cleanup the region and commit the result.
>
> [[[
> Fix loop-critical variable handling in parse_mergeinfo_from_db().
> Currently, this variable is never set, but is tested against in an 'if'
> condition.
>
> (In branches/merge-tracking)
>
> * subversion/libsvn_fs_fs/tree.c:
> (parse_mergeinfo_from_db): Set lastmergedfrom before before looping
> again.
> ]]]
>
> Regards,
> Madan.
>
>
> ------------------------------------------------------------------------
>
> Index: subversion/libsvn_fs_fs/tree.c
> ===================================================================
> --- subversion/libsvn_fs_fs/tree.c (revision 20698)
> +++ subversion/libsvn_fs_fs/tree.c (working copy)
> @@ -1167,6 +1167,7 @@
> temprange->end = endrev;
> APR_ARRAY_PUSH(pathranges, svn_merge_range_t *) = temprange;
> sqlite_result = sqlite3_step(stmt);
> + lastmergedfrom = mergedfrom;
> }
> apr_hash_set(*result, mergedfrom, APR_HASH_KEY_STRING, pathranges);
>
>
>
> ------------------------------------------------------------------------
>
> Fix loop-critical variable handling in parse_mergeinfo_from_db().
> Currently, this variable is never set, but is tested against in an 'if'
> condition.
>
> (In branches/merge-tracking)
>
> * subversion/libsvn_fs_fs/tree.c:
> (parse_mergeinfo_from_db): Set lastmergedfrom before before looping
> again.
This patch is fine, please commit it.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org