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/02/02 20:13:02 UTC
svn commit: r905750 - in /subversion/trunk/subversion: include/svn_wc.h
libsvn_client/patch.c svn/notify.c tests/cmdline/patch_tests.py
Author: stsp
Date: Tue Feb 2 19:12:45 2010
New Revision: 905750
URL: http://svn.apache.org/viewvc?rev=905750&view=rev
Log:
Add notifications for hunks applied with fuzz.
* subversion/tests/cmdline/patch_tests.py
(patch_with_fuzz): Add a line to the target to cause one hunk to apply
with offset and fuzz. With that we have all kinds of currently known
patch notifications tested.
* subversion/svn/notify.c
(notify): Print a message for three different cases; fuzz, offset and
both.
* subversion/include/svn_wc.h
(svn_wc_notify_t): Add a new field hunk_fuzz.
* subversion/libsvn_client/patch.c
(maybe_send_patch_notifications): Set the value of hunk_fuzz.
Patch by: Daniel Näslund <daniel{_AT_}longitudo.com>
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=905750&r1=905749&r2=905750&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Tue Feb 2 19:12:45 2010
@@ -1248,6 +1248,10 @@
* @since New in 1.7. */
svn_linenum_t hunk_matched_line;
+ /* The fuzz factor the hunk is applied with.
+ * @since New in 1.7 */
+ svn_linenum_t hunk_fuzz;
+
/* NOTE: Add new fields at the end to preserve binary compatibility.
Also, if you add fields here, you have to update svn_wc_create_notify
and svn_wc_dup_notify. */
Modified: subversion/trunk/subversion/libsvn_client/patch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/patch.c?rev=905750&r1=905749&r2=905750&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/patch.c (original)
+++ subversion/trunk/subversion/libsvn_client/patch.c Tue Feb 2 19:12:45 2010
@@ -1018,6 +1018,7 @@
notify->hunk_modified_start = hi->hunk->modified_start;
notify->hunk_modified_length = hi->hunk->modified_length;
notify->hunk_matched_line = hi->matched_line;
+ notify->hunk_fuzz = hi->fuzz;
(*ctx->notify_func2)(ctx->notify_baton2, notify, pool);
}
Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=905750&r1=905749&r2=905750&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Tue Feb 2 19:12:45 2010
@@ -327,18 +327,50 @@
}
/* ### APR_INT64_T_FMT isn't translator-friendly */
- s = _("> applied hunk @@ -%lu,%lu +%lu,%lu @@ "
- "with offset %s");
- if ((err = svn_cmdline_printf(pool,
- apr_pstrcat(pool, s,
- "%"APR_UINT64_T_FMT"\n",
- NULL),
+ if (n->hunk_fuzz)
+ {
+ s = _("> applied hunk @@ -%lu,%lu +%lu,%lu @@ "
+ "with offset %s");
+ if ((err = svn_cmdline_printf(pool,
+ apr_pstrcat(pool, s,
+ "%"APR_UINT64_T_FMT
+ " and fuzz %lu\n",
+ NULL),
+ n->hunk_original_start,
+ n->hunk_original_length,
+ n->hunk_modified_start,
+ n->hunk_modified_length,
+ minus, off, n->hunk_fuzz)))
+ goto print_error;
+ }
+ else
+ {
+ s = _("> applied hunk @@ -%lu,%lu +%lu,%lu @@ "
+ "with offset %s");
+ if ((err = svn_cmdline_printf(pool,
+ apr_pstrcat(pool, s,
+ "%"APR_UINT64_T_FMT"\n",
+ NULL),
+ n->hunk_original_start,
+ n->hunk_original_length,
+ n->hunk_modified_start,
+ n->hunk_modified_length,
+ minus, off)))
+ goto print_error;
+ }
+ }
+ else if (n->hunk_fuzz)
+ {
+ if ((err = svn_cmdline_printf(pool,
+ _("> applied hunk @@ -%lu,%lu +%lu,%lu @@ "
+ "with fuzz %lu\n"),
n->hunk_original_start,
n->hunk_original_length,
n->hunk_modified_start,
n->hunk_modified_length,
- minus, off)))
+ n->hunk_fuzz)))
goto print_error;
+
}
break;
Modified: subversion/trunk/subversion/tests/cmdline/patch_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/patch_tests.py?rev=905750&r1=905749&r2=905750&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/patch_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/patch_tests.py Tue Feb 2 19:12:45 2010
@@ -1059,6 +1059,7 @@
" SERIAL NUMBER: 45327\n",
"and PROMOTION DATE: 13th June. 2009\n",
"\n",
+ "This line is inserted to cause an offset of +1\n",
"To claim your winning prize, you are to contact the appointed\n",
"agent below as soon as possible for the immediate release of your\n",
"winnings with the below details.\n",
@@ -1131,6 +1132,7 @@
" SERIAL NUMBER: 45327\n",
"and PROMOTION DATE: 13th June. 2009\n",
"\n",
+ "This line is inserted to cause an offset of +1\n",
"To claim your winning prize, you are to contact the appointed\n",
"agent below as soon as possible for the immediate release of your\n",
"winnings with the below details.\n",
@@ -1142,6 +1144,9 @@
expected_output = [
'U %s\n' % os.path.join(wc_dir, 'A', 'mu'),
+ '> applied hunk @@ -1,6 +1,7 @@ with fuzz 1\n',
+ '> applied hunk @@ -7,6 +8,7 @@ with fuzz 2\n',
+ '> applied hunk @@ -19,6 +20,7 @@ with offset 1 and fuzz 2\n',
]
expected_disk = svntest.main.greek_state.copy()
expected_disk.tweak('A/mu', contents=''.join(mu_contents))