Chris AtLee wrote:
>I thought I'd take a crack at finishing up issue 571 - outputting "R"
>instead of "D" + "A" when a file is replaced. Attached are my changes
>Basically what it does is when it receives an update_delete
>notification, it saves the path that was deleted and doesn't print
>anything out. If the next notification is an addition of the same path
>then it prints out "R", otherwise it prints out the "D" as usual plus
>whatever other output the next notification generates.
>The only problem that I could see with this is that if the update_delete
>notification were to be the last action, then the delete notification
>wouldn't be printed out. But it looks like update_completed is sent at
>the end up every update, so this shouldn't be a problem.
>Comments / questions / feedback appreciated.
Are you certain that when a path is being replaced, the "D" will always
immediately follow the "A"? If it doesn't, your solution won't work.
Look at r1378 that's mentioned in that issue; Garrett used a hash table
to avoid this very problem.
>--- subversion/clients/cmdline/notify.c (revision 11937)
>+++ subversion/clients/cmdline/notify.c (working copy)
>@@ -47,6 +47,7 @@
> when we've already had one print error. */
> apr_pool_t *pool; /* this pool is cleared after every notification,
> so don't keep anything here! */
>+ svn_string_t* deleted_path; /* What was the path that was deleted? */
You don't need an svn_string_t* here. A const char* (copied into the
temporary pool) will do nicely, since you're not concatenating to the
string or anything.
>@@ -69,6 +70,20 @@
> path_local = svn_path_local_style (path, nb->pool);
>+ /* If the last action was a delete (deleted_path is set)
>+ * and this action is not an add or if the paths don't match, then
>+ * this isn't a replacement and print out the delete notification */
>+ if (nb->deleted_path != NULL && (action != svn_wc_notify_update_add ||
>+ ! svn_string_compare(nb->deleted_path,
>+ svn_string_create(path_local, nb->pool))))
>+ /* If the last action was a deletion of the path that we're
>+ * adding right now, then print out "R" instead to indicate that
>+ * we're replacing the file. */
>+ if (nb->deleted_path != NULL && svn_string_compare(nb->deleted_path,
>+ svn_string_create(path_local, nb->pool)))
>@@ -358,7 +392,10 @@
>- svn_pool_clear (nb->pool);
>+ /* If we're not keeping track of the deleted_path, then we can
>+ * clear the pool. */
>+ if (nb->deleted_path == NULL)
>+ svn_pool_clear (nb->pool);
What else is in that pool? How large can it grow?
To unsubscribe, e-mail: email@example.com
For additional commands, e-mail: firstname.lastname@example.org
Received on Sun Nov 21 19:45:40 2004