You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/01/26 14:06:59 UTC
svn commit: r903209 - in /subversion/trunk/subversion: include/svn_wc.h
libsvn_client/patch.c svn/notify.c tests/cmdline/patch_tests.py
Author: stsp
Date: Tue Jan 26 13:06:59 2010
New Revision: 903209
URL: http://svn.apache.org/viewvc?rev=903209&view=rev
Log:
Provide notifications for directories created by svn patch.
The action svn_wc_notify_add is used when notifying added directories,
and the patch code has no control over this (and should not).
The svn CLI client however prints paths notified with svn_wc_notify_add
at a different level of indentation than paths notified with
svn_wc_notify_update_* notifications, which svn patch was using.
To avoid ugly output, switch svn patch over to using non-update
notification actions. We need one additional notification action
to notify about patched files (there was no suitable equivalent
for svn_wc_notify_update_update).
This isn't too bad since we're expecting more notification
actions specific to svn patch in the future (e.g. to notify
about the fuzz factor used while applying a hunk).
* subversion/include/svn_wc.h
(svn_wc_notify_action_t): New notification action svn_wc_notify_patch.
* subversion/libsvn_client/patch.c
(maybe_send_patch_notification): Switch to non-update notification
actions, and also use svn_wc_notify_patch.
(apply_one_patch): Notify about created directories during normal
and dry runs.
* subversion/svn/notify.c
(notify): Handle svn_wc_notify_patch.
* subversion/tests/cmdline/patch_tests.py
(patch_unidiff, patch_unidiff_absolute_paths,
patch_chopped_leading_spaces, patch_unidiff_strip1,
patch_add_new_dir): Adjust expected output.
Modified:
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/patch.c
subversion/trunk/subversion/svn/notify.c
subversion/trunk/subversion/tests/cmdline/patch_tests.py
Modified: subversion/trunk/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=903209&r1=903208&r2=903209&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Jan 26 13:06:59 2010
@@ -1061,6 +1061,9 @@
* @since New in 1.7. */
svn_wc_notify_merge_elide_info,
+ /** A file in the working copy was patched.
+ * @since New in 1.7. */
+ svn_wc_notify_patch,
} svn_wc_notify_action_t;
Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=903209&r1=903208&r2=903209&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Jan 26 13:06:59 2010
@@ -847,11 +847,11 @@
if (target->skipped)
action = svn_wc_notify_skip;
else if (target->deleted)
- action = svn_wc_notify_update_delete;
+ action = svn_wc_notify_delete;
else if (target->added)
- action = svn_wc_notify_update_add;
+ action = svn_wc_notify_add;
else
- action = svn_wc_notify_update_update;
+ action = svn_wc_notify_patch;
notify = svn_wc_create_notify(target->abs_path ? target->abs_path
: target->rel_path,
@@ -1041,9 +1041,11 @@
* if we wanted to. */
const char *abs_path;
apr_array_header_t *components;
+ int missing_components;
abs_path = apr_pstrdup(pool, abs_wc_path);
components = svn_path_decompose(target->rel_path, pool);
+ missing_components = 0;
iterpool = svn_pool_create(pool);
for (i = 0; i < components->nelts - 1; i++)
{
@@ -1085,27 +1087,46 @@
break;
}
}
+
+ missing_components++;
}
+
+ /* Do notification for missing parent directories. */
+ if (! target->skipped && ctx->notify_func2)
+ {
+ abs_path = abs_wc_path;
+ for (i = 0; i < missing_components; i++)
+ {
+ svn_wc_notify_t *notify;
+ const char *component;
+
+ svn_pool_clear(iterpool);
+
+ component = APR_ARRAY_IDX(components, i,
+ const char *);
+ abs_path = svn_dirent_join(abs_path, component,
+ pool);
+ notify = svn_wc_create_notify(abs_path,
+ svn_wc_notify_add,
+ iterpool);
+ notify->kind = svn_node_dir;
+ ctx->notify_func2(ctx->notify_baton2, notify,
+ iterpool);
+ }
+ }
+
svn_pool_destroy(iterpool);
}
else
{
const char *dir_abspath;
- svn_wc_notify_func2_t notify_func;
svn_error_t *err;
dir_abspath = svn_dirent_dirname(target->abs_path, pool);
- /* Hacky. We don't want any notifications when adding
- * the dirs. Just one at the end when we add the file.
- * This way, we will get the same notifications as
- * when running with --dry-run. */
- notify_func = ctx->notify_func2;
- ctx->notify_func2 = NULL;
err = svn_client__make_local_parents(dir_abspath,
TRUE, ctx,
pool);
- ctx->notify_func2 = notify_func;
/* ### wc-ng should eventually be able to replace
* directories in-place, so the schedule conflict
* will go away. */
Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=903209&r1=903208&r2=903209&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Tue Jan 26 13:06:59 2010
@@ -281,6 +281,13 @@
goto print_error;
break;
+ case svn_wc_notify_patch:
+ nb->received_some_change = TRUE;
+ if ((err = svn_cmdline_printf(pool, "U %s\n",
+ path_local)))
+ goto print_error;
+ break;
+
case svn_wc_notify_update_update:
case svn_wc_notify_merge_record_info:
{
Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=903209&r1=903208&r2=903209&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Jan 26 13:06:59 2010
@@ -186,11 +186,11 @@
]
expected_output = [
- 'U %s\n' % os.path.join(wc_dir, 'A', 'D', 'gamma'),
- 'U %s\n' % os.path.join(wc_dir, 'iota'),
- 'A %s\n' % os.path.join(wc_dir, 'new'),
- 'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
- 'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
+ 'U %s\n' % os.path.join(wc_dir, 'A', 'D', 'gamma'),
+ 'U %s\n' % os.path.join(wc_dir, 'iota'),
+ 'A %s\n' % os.path.join(wc_dir, 'new'),
+ 'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
+ 'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
]
expected_disk = svntest.main.greek_state.copy()
@@ -256,7 +256,7 @@
lambda_path = os.path.join(os.path.sep, 'A', 'B', 'lambda')
expected_output = [
- 'U %s\n' % os.path.join('A', 'B', 'E', 'alpha'),
+ 'U %s\n' % os.path.join('A', 'B', 'E', 'alpha'),
'Skipped \'%s\'\n' % lambda_path,
'Summary of conflicts:\n',
' Skipped paths: 1\n'
@@ -470,8 +470,8 @@
os.chdir(wc_dir)
expected_output = [
- 'U %s\n' % os.path.join('A', 'mu'),
- 'U iota\n'
+ 'U %s\n' % os.path.join('A', 'mu'),
+ 'U iota\n'
]
expected_disk = svntest.main.greek_state.copy()
@@ -630,11 +630,11 @@
]
expected_output = [
- 'U %s\n' % os.path.join(wc_dir, 'A', 'D', 'gamma'),
- 'U %s\n' % os.path.join(wc_dir, 'iota'),
- 'A %s\n' % os.path.join(wc_dir, 'new'),
- 'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
- 'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
+ 'U %s\n' % os.path.join(wc_dir, 'A', 'D', 'gamma'),
+ 'U %s\n' % os.path.join(wc_dir, 'iota'),
+ 'A %s\n' % os.path.join(wc_dir, 'new'),
+ 'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
+ 'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
]
expected_disk = svntest.main.greek_state.copy()
@@ -800,11 +800,11 @@
]
expected_output = [
- 'U %s\n' % os.path.join(wc_dir, 'A', 'D', 'gamma'),
- 'U %s\n' % os.path.join(wc_dir, 'iota'),
- 'A %s\n' % os.path.join(wc_dir, 'new'),
- 'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
- 'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
+ 'U %s\n' % os.path.join(wc_dir, 'A', 'D', 'gamma'),
+ 'U %s\n' % os.path.join(wc_dir, 'iota'),
+ 'A %s\n' % os.path.join(wc_dir, 'new'),
+ 'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
+ 'D %s\n' % os.path.join(wc_dir, 'A', 'B', 'E', 'beta'),
]
expected_disk = svntest.main.greek_state.copy()
@@ -866,7 +866,9 @@
A_C_Y_new_path = os.path.join(wc_dir, 'A', 'C', 'Y', 'new')
expected_output = [
- 'A %s\n' % os.path.join(wc_dir, 'X', 'Y', 'new'),
+ 'A %s\n' % os.path.join(wc_dir, 'X'),
+ 'A %s\n' % os.path.join(wc_dir, 'X', 'Y'),
+ 'A %s\n' % os.path.join(wc_dir, 'X', 'Y', 'new'),
'Skipped missing target: \'%s\'\n' % A_C_Y_new_path,
'Summary of conflicts:\n',
' Skipped paths: 1\n',