[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r26761 - in branches/svnpatch-diff/subversion: include libsvn_client libsvn_subr svn tests/cmdline

From: David Glasser <glasser_at_davidglasser.net>
Date: 2007-09-27 22:53:10 CEST

On 9/23/07, cacknin@tigris.org <cacknin@tigris.org> wrote:
> Author: cacknin
> Date: Sun Sep 23 11:51:32 2007
> New Revision: 26761
>
> Log:
> Provide 'svn patch' with support for Unidiff. This includes a new
> --patch-cmd option along with its analog run-time config entry to
> determine the program to call in charge of applying the unidiff.
>
> * subversion/svn/cl.h
> (svn_cl__longopt_t): add svn_cl__patch_cmd_opt to the enum.
> (svn_cl__opt_state_t): provide with a patch_cmd field.
>
> * subversion/include/svn_config.h
> (SVN_CONFIG_OPTION_PATCH_CMD): new macro for 'patch-cmd' user config
> keyword.
> (global): adjust macros padding (cosmetic change)
>
> * subversion/svn/patch-cmd.c
> (svn_cl__patch): initialize/open outfile and errfile pipes and pass
> those to svn_client_patch().
>
> * subversion/svn/main.c
> (svn_cl__options): provide options array with a patch-cmd entry.
> (svn_cl__cmd_table): add the patch_cmd option to 'svn patch'.
> (main): initialize opt_state.patch_cmd; override the user config when
> --patch-cmd was passed on the command line.
>
> * subversion/libsvn_subr/config_file.c:
> (svn_config_ensure): add 'patch-cmd' to the default user config file
> contents.
>
> * subversion/include/svn_client.h:
> (svn_client_patch): adjust docstring accordingly to this commit
> purpose; also add outfile and errfile arguments.
>
> * subversion/libsvn_client/patch.c
> (apply_unidiff): new function to call external patch program.
> (svn_client_patch): add the two outfile and errfile args; add the call
> to apply_unidiff().
>
> * subversion/tests/cmdline/diff_tests.py
> (diff_svnpatch): fix output as svn:mergeinfo shows up when a file is
> copied in the working copy; reverse the copyfrom-field once more, it
> seems like the server doesn't send this information anymore..
>
> * subversion/tests/cmdline/patch_tests.py
> (global): remove deprecated SVNAnyOutput
> (gnupatch_garbage_re): global regexp to catch patch(1) message when
> fed with unidiff-less data.
> (patch_basic): adjust accordingly with gnupatch_garbage_re.
>
>
> Modified:
> branches/svnpatch-diff/subversion/include/svn_client.h
> branches/svnpatch-diff/subversion/include/svn_config.h
> branches/svnpatch-diff/subversion/libsvn_client/patch.c
> branches/svnpatch-diff/subversion/libsvn_subr/config_file.c
> branches/svnpatch-diff/subversion/svn/cl.h
> branches/svnpatch-diff/subversion/svn/main.c
> branches/svnpatch-diff/subversion/svn/patch-cmd.c
> branches/svnpatch-diff/subversion/tests/cmdline/diff_tests.py
> branches/svnpatch-diff/subversion/tests/cmdline/patch_tests.py
>
> Modified: branches/svnpatch-diff/subversion/include/svn_client.h
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/include/svn_client.h?pathrev=26761&r1=26760&r2=26761
> ==============================================================================
> --- branches/svnpatch-diff/subversion/include/svn_client.h (original)
> +++ branches/svnpatch-diff/subversion/include/svn_client.h Sun Sep 23 11:51:32 2007
> @@ -4080,10 +4080,17 @@
> * pointed to by @a wc_path.
> *
> * The patch might carry Unified diffs, svnpatch diffs, or both.
> - * Although we're pretty much able to handle the svnpatch block, we're
> - * not yet able to handle the Unidiff section internally. See notes/svnpatch.
> + * However, 'svn patch' doesn't yet support Unidiff application
> + * internally: we rather delegate this task to an external program which
> + * the user can specify either via --patch-cmd or 'patch-cmd' user
> + * config option. If unspecified, as a last resort we try to call
> + * 'patch' and see if it works. The external program, whatever it is,
> + * is given the Unidiff bytes in a GNU-patch fashion, that is, we
> + * feed/link the external program's stdin pipe with the patch itself.
> + * Likewise, @a outfile and @a errfile are connected to the program's.
> + * See subversion/libsvn_client/patch.c(apply_unidiff) or notes/svnpatch.
> * Note: hopefuly this is temporary and we'll have our own implementation
> - * one day to cut off the dependency.
> + * one day to cut off the messy dependency.

Have you updated notes/svnpatch to be up-to-date yet? It doesn't look
that way to me. Also, I don't really understand from this
documentation what exactly the outfile and errfile parameters are for:
they collect the output of the patch(1) invocation? svn_client_patch
doesn't parse that itself? (Also, I'm not sure how appropriate it is
to refer to the '--patch-cmd' CLI argument in the API docs.

> *
> * If @a force is not set and the patch involves deleting locally modified or
> * unversioned items the operation will fail. If @a force is set such items
> @@ -4099,6 +4106,8 @@
> const char *wc_path,
> svn_boolean_t force,
> svn_boolean_t dry_run,
> + apr_file_t *outfile,
> + apr_file_t *errfile,
> svn_client_ctx_t *ctx,
> apr_pool_t *pool);
>
>
> Modified: branches/svnpatch-diff/subversion/include/svn_config.h
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/include/svn_config.h?pathrev=26761&r1=26760&r2=26761
> ==============================================================================
> --- branches/svnpatch-diff/subversion/include/svn_config.h (original)
> +++ branches/svnpatch-diff/subversion/include/svn_config.h Sun Sep 23 11:51:32 2007
> @@ -56,9 +56,9 @@
> * client configuration files.
> * @{
> */
> -#define SVN_CONFIG_CATEGORY_SERVERS "servers"
> -#define SVN_CONFIG_SECTION_GROUPS "groups"
> -#define SVN_CONFIG_SECTION_GLOBAL "global"
> +#define SVN_CONFIG_CATEGORY_SERVERS "servers"
> +#define SVN_CONFIG_SECTION_GROUPS "groups"
> +#define SVN_CONFIG_SECTION_GLOBAL "global"

Usually it's best to fix whitespace in a separate commit, and since
this change isn't related to your branch, as a patch to trunk.

However, I'm pretty sure that the odd spacing here was intentional:
there are three different hierarchical levels of config names here
(category, section, and option) and they are indented to different
degrees based on that. Please revert these changes before this gets
merged to trunk.

(I'd certainly approve a patch to trunk adding some sort of
non-doxygen comment saying "these things are hierarchically indented
on purpose" with better words.)

> #define SVN_CONFIG_OPTION_HTTP_PROXY_HOST "http-proxy-host"
> #define SVN_CONFIG_OPTION_HTTP_PROXY_PORT "http-proxy-port"
> #define SVN_CONFIG_OPTION_HTTP_PROXY_USERNAME "http-proxy-username"
> @@ -74,16 +74,16 @@
> #define SVN_CONFIG_OPTION_SSL_CLIENT_CERT_PASSWORD "ssl-client-cert-password"
> #define SVN_CONFIG_OPTION_HTTP_LIBRARY "http-library"
>
> -#define SVN_CONFIG_CATEGORY_CONFIG "config"
> -#define SVN_CONFIG_SECTION_AUTH "auth"
> +#define SVN_CONFIG_CATEGORY_CONFIG "config"
> +#define SVN_CONFIG_SECTION_AUTH "auth"
> #define SVN_CONFIG_OPTION_STORE_PASSWORDS "store-passwords"
> #define SVN_CONFIG_OPTION_STORE_AUTH_CREDS "store-auth-creds"
> -#define SVN_CONFIG_SECTION_HELPERS "helpers"
> +#define SVN_CONFIG_SECTION_HELPERS "helpers"
> #define SVN_CONFIG_OPTION_EDITOR_CMD "editor-cmd"
> #define SVN_CONFIG_OPTION_DIFF_CMD "diff-cmd"
> #define SVN_CONFIG_OPTION_DIFF3_CMD "diff3-cmd"
> #define SVN_CONFIG_OPTION_DIFF3_HAS_PROGRAM_ARG "diff3-has-program-arg"
> -#define SVN_CONFIG_SECTION_MISCELLANY "miscellany"
> +#define SVN_CONFIG_SECTION_MISCELLANY "miscellany"
> #define SVN_CONFIG_OPTION_GLOBAL_IGNORES "global-ignores"
> #define SVN_CONFIG_OPTION_LOG_ENCODING "log-encoding"
> #define SVN_CONFIG_OPTION_USE_COMMIT_TIMES "use-commit-times"
> @@ -93,8 +93,9 @@
> #define SVN_CONFIG_OPTION_MIMETYPES_FILE "mime-types-file"
> #define SVN_CONFIG_OPTION_PRESERVED_CF_EXTS "preserved-conflict-file-exts"
> #define SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS "interactive-conflicts"
> -#define SVN_CONFIG_SECTION_TUNNELS "tunnels"
> -#define SVN_CONFIG_SECTION_AUTO_PROPS "auto-props"
> +#define SVN_CONFIG_SECTION_TUNNELS "tunnels"
> +#define SVN_CONFIG_SECTION_AUTO_PROPS "auto-props"
> +#define SVN_CONFIG_OPTION_PATCH_CMD "patch-cmd"

 And this should be with the other helpers above (and indented to the
 option level).

> /** @} */
>
> /** @name Repository conf directory configuration files strings
> @@ -103,19 +104,19 @@
> * @{
> */
> /* For repository svnserve.conf files */
> -#define SVN_CONFIG_SECTION_GENERAL "general"
> +#define SVN_CONFIG_SECTION_GENERAL "general"
> #define SVN_CONFIG_OPTION_ANON_ACCESS "anon-access"
> #define SVN_CONFIG_OPTION_AUTH_ACCESS "auth-access"
> #define SVN_CONFIG_OPTION_PASSWORD_DB "password-db"
> #define SVN_CONFIG_OPTION_REALM "realm"
> #define SVN_CONFIG_OPTION_AUTHZ_DB "authz-db"
> -#define SVN_CONFIG_SECTION_SASL "sasl"
> +#define SVN_CONFIG_SECTION_SASL "sasl"
> #define SVN_CONFIG_OPTION_USE_SASL "use-sasl"
> #define SVN_CONFIG_OPTION_MIN_SSF "min-encryption"
> #define SVN_CONFIG_OPTION_MAX_SSF "max-encryption"
>
> /* For repository password database */
> -#define SVN_CONFIG_SECTION_USERS "users"
> +#define SVN_CONFIG_SECTION_USERS "users"
> /** @} */

... and these too.

> /*** Configuration Default Values ***/
>
> Modified: branches/svnpatch-diff/subversion/libsvn_client/patch.c
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/libsvn_client/patch.c?pathrev=26761&r1=26760&r2=26761
> ==============================================================================
> --- branches/svnpatch-diff/subversion/libsvn_client/patch.c (original)
> +++ branches/svnpatch-diff/subversion/libsvn_client/patch.c Sun Sep 23 11:51:32 2007
> @@ -1644,11 +1644,103 @@
> return SVN_NO_ERROR;
> }
>
> +/* Look for the patch external program we'll use to apply the unidiff
> + * part of a patch file, and run it against @a patch_path. Consider the
> + * following order of priority:
> + * 1. '--patch-cmd' command line argument value
> + * 2. 'patch-cmd' entry in the run-time user config file

... well, it's really "the SVN_CONFIG_OPTION_PATCH_CMD entry in the
given config hash; the --patch-cmd bit is CLI-specific.

> + * 3. try to execute 'patch' literally, which should work on most *NIX
> + * systems at least. This involves searching into $PATH.
> + */
> +svn_error_t *
> +apply_unidiff(const char *patch_path,
> + apr_file_t *outfile,
> + apr_file_t *errfile,
> + svn_client_ctx_t *ctx,
> + apr_pool_t *pool)
> +{
> + const char *patch_cmd = NULL;
> + const char *patch_cmd_args[2];
> + int exitcode = 0;
> + apr_exit_why_e exitwhy = 0;
> + svn_boolean_t patch_bin_guess = TRUE;
> + apr_file_t *patchfile;
> +
> + /* The client config should know about the first two options since its
> + * patch-cmd value was overriden in main(). */

Does "first two options" here refer to 1. and 2. above?

> + if (ctx->config)
> + {
> + const char *patch_cmd_tmp = NULL;
> + svn_config_t *cfg = apr_hash_get(ctx->config,
> + SVN_CONFIG_CATEGORY_CONFIG,
> + APR_HASH_KEY_STRING);
> + svn_config_get(cfg, &patch_cmd_tmp, SVN_CONFIG_SECTION_HELPERS,
> + SVN_CONFIG_OPTION_PATCH_CMD, NULL);
> +
> + if (patch_cmd_tmp)
> + {
> + patch_bin_guess = FALSE;
> + SVN_ERR(svn_path_cstring_to_utf8(&patch_cmd, patch_cmd_tmp,
> + pool));
> + }
> + else
> + patch_cmd = apr_psprintf(pool, "patch");
> + }
> +
> + /* Posix convention. */
> + patch_cmd_args[0] = patch_cmd;
> + patch_cmd_args[1] = NULL;

Huh, I expected that you would have needed some sort of -p argument to
patch.

> +
> + /* We want to feed the external program's stdin with the patch itself. */
> + SVN_ERR(svn_io_file_open(&patchfile, patch_path,
> + APR_READ, APR_OS_DEFAULT, pool));
> +
> + /* Now run the external program. The parent process should close
> + * opened pipes/files. */
> + SVN_ERR(svn_io_run_cmd(".", patch_cmd, patch_cmd_args,
> + &exitcode, &exitwhy, TRUE, patchfile, outfile,
> + errfile, pool));
> +
> + /* This is where we have to make the assumption that if the exitcode
> + * isn't 0 nor 1 then the external program got into trouble or wasn't
> + * even executed--command not found (see below). Basically we're
> + * trying to stick with patch(1) behaviour as stated in the man page:
> + * "patch's exit status is 0 if all hunks are applied successfully, 1
> + * if some hunks cannot be applied, and 2 if there is more serious
> + * trouble." */

Why is exitcode == 1 not any sort of error?

> + if (exitcode != 0 && exitcode != 1)
> + {
> + /* This is the case when we're trying to execute 'patch' and got
> + * some weird exitcode.
> + * XXX: I haven't figured out how to check against the 'command
> + * not found' error, which returns exitcode == 255. Is there a
> + * macro somewhere to compare with? Let's use > 2 for now. */
> + if (patch_bin_guess && exitcode > 2)
> + return svn_error_createf
> + (SVN_ERR_EXTERNAL_PROGRAM, NULL,
> + _("No 'patch' program was found in your system. Please try\n"
> + "to use --patch-cmd or 'patch-cmd' run-time configuration\n"
> + "option or manually use an external tool to apply Unidiffs."));

This heuristic seems not to be sound enough. (And again, referring to
--patch-cmd in libsvn_client is bad.) I would not try to guess if the
command existed or not (will the exec itself print an error if it
fails? it does for 'svn diff --diff-cmd asfdjkasfdjklafds'), and then
in the svn CLI wrap that error in a warning mentioning the ways to
configure.

> + else
> + /* patch(1) uses exitcode 2 along with the message "Only garbage
> + * was found in the patch input.". This falls here. */
> + return svn_error_createf
> + (SVN_ERR_EXTERNAL_PROGRAM, NULL,
> + _("'%s' returned error exitcode %d"),
> + svn_path_local_style(patch_cmd, pool),
> + exitcode);
> + }
> +
> + return SVN_NO_ERROR;
> +}
> +
> svn_error_t *
> svn_client_patch(const char *patch_path,
> const char *wc_path,
> svn_boolean_t force,
> svn_boolean_t dry_run,
> + apr_file_t *outfile,
> + apr_file_t *errfile,
> svn_client_ctx_t *ctx,
> apr_pool_t *pool)
> {
> @@ -1687,5 +1779,10 @@
>
> }
>
> + /* At this point the svnpatch block has been addressed by
> + * svn_wc_apply_patch() right above and we'll now proceed with the
> + * unidiff part. */
> + SVN_ERR(apply_unidiff(patch_path, outfile, errfile, ctx, pool));
> +
> return SVN_NO_ERROR;
> }

I find it interesting that this is going in libsvn_client whereas the
internal patch parsing is in libsvn_wc. Not necessary wrong, just
notable.

>
> Modified: branches/svnpatch-diff/subversion/libsvn_subr/config_file.c
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/libsvn_subr/config_file.c?pathrev=26761&r1=26760&r2=26761
> ==============================================================================
> --- branches/svnpatch-diff/subversion/libsvn_subr/config_file.c (original)
> +++ branches/svnpatch-diff/subversion/libsvn_subr/config_file.c Sun Sep 23 11:51:32 2007
> @@ -932,6 +932,8 @@
> "### Set diff3-has-program-arg to 'true' or 'yes' if your 'diff3'" NL
> "### program accepts the '--diff-program' option." NL
> "# diff3-has-program-arg = [true | false]" NL
> + "### Set patch-cmd to your favorite patching program." NL
> + "# patch-cmd = patch_program (patch, etc.)" NL

I think the interface for what the patch command needs to accept
(command line args, -p, etc, expected exit code) should be documented
*somewhere*. Maybe here. Maybe not.

> "" NL
> "### Section for configuring tunnel agents." NL
> "[tunnels]" NL
>
> Modified: branches/svnpatch-diff/subversion/svn/cl.h
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/svn/cl.h?pathrev=26761&r1=26760&r2=26761
> ==============================================================================
> --- branches/svnpatch-diff/subversion/svn/cl.h (original)
> +++ branches/svnpatch-diff/subversion/svn/cl.h Sun Sep 23 11:51:32 2007
> @@ -86,7 +86,8 @@
> svn_cl__with_revprop_opt,
> svn_cl__parents_opt,
> svn_cl__accept_opt,
> - svn_cl__svnpatch_format_opt
> + svn_cl__svnpatch_format_opt,
> + svn_cl__patch_cmd_opt
> } svn_cl__longopt_t;
>
>
> @@ -144,7 +145,8 @@
> svn_boolean_t revprop; /* operate on a revision property */
> const char *diff_cmd; /* the external diff command to use */
> const char *merge_cmd; /* the external merge command to use */
> - const char *editor_cmd; /* external editor command. */
> + const char *editor_cmd; /* the external editor command to use */
> + const char *patch_cmd; /* the external patch command to use */
> svn_boolean_t record_only; /* whether to record mergeinfo */
> const char *old_target; /* diff target */
> const char *new_target; /* diff target */
>
> Modified: branches/svnpatch-diff/subversion/svn/main.c
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/svn/main.c?pathrev=26761&r1=26760&r2=26761
> ==============================================================================
> --- branches/svnpatch-diff/subversion/svn/main.c (original)
> +++ branches/svnpatch-diff/subversion/svn/main.c Sun Sep 23 11:51:32 2007
> @@ -146,7 +146,7 @@
> N_("try operation but make no changes")},
> {"no-diff-deleted", svn_cl__no_diff_deleted_opt, 0,
> N_("do not print differences for deleted files")},
> - {"svnpatch", svn_cl__svnpatch_format_opt, 0,
> + {"svnpatch", svn_cl__svnpatch_format_opt, 0,
> N_("output in svnpatch format")},
> {"notice-ancestry", svn_cl__notice_ancestry_opt, 0,
> N_("notice ancestry when calculating differences")},
> @@ -161,6 +161,8 @@
> N_("use ARG as merge command")},
> {"editor-cmd", svn_cl__editor_cmd_opt, 1,
> N_("use ARG as external editor")},
> + {"patch-cmd", svn_cl__patch_cmd_opt, 1,
> + N_("use ARG as external patch command")},
> #endif
> {"record-only", svn_cl__record_only_opt, 0,
> N_("mark revisions as merged (use with -r)")},
> @@ -612,7 +614,8 @@
> " This command allows some amount of fuzzing as Unidiff is contextual\n"
> " and svnpatch revisionless. However, you might see failure warnings\n"
> " when pushing this feature too hard.\n"),

Hmm, I missed this before (haven't had a chance to follow your work as
much as I would have liked), but "when pushing this feature too hard"
seems rather vague and casual for 'svn help'.

> - {'q', svn_cl__force_opt, svn_cl__dry_run_opt, svn_cl__config_dir_opt} },
> + {'q', svn_cl__force_opt, svn_cl__dry_run_opt, svn_cl__patch_cmd_opt,
> + svn_cl__config_dir_opt} },
>
> { "propdel", svn_cl__propdel, {"pdel", "pd"}, N_
> ("Remove a property from files, dirs, or revisions.\n"
> @@ -1323,6 +1326,9 @@
> case svn_cl__editor_cmd_opt:
> opt_state.editor_cmd = apr_pstrdup(pool, opt_arg);
> break;
> + case svn_cl__patch_cmd_opt:
> + opt_state.patch_cmd = apr_pstrdup(pool, opt_arg);
> + break;
> case svn_cl__old_cmd_opt:
> if (used_change_arg)
> {
> @@ -1644,6 +1650,9 @@
> if (opt_state.merge_cmd)
> svn_config_set(cfg, SVN_CONFIG_SECTION_HELPERS,
> SVN_CONFIG_OPTION_DIFF3_CMD, opt_state.merge_cmd);
> + if (opt_state.patch_cmd)
> + svn_config_set(cfg, SVN_CONFIG_SECTION_HELPERS,
> + SVN_CONFIG_OPTION_PATCH_CMD, opt_state.patch_cmd);
>
> /* Check for mutually exclusive args --auto-props and --no-auto-props */
> if (opt_state.autoprops && opt_state.no_autoprops)
>
> Modified: branches/svnpatch-diff/subversion/svn/patch-cmd.c
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/svn/patch-cmd.c?pathrev=26761&r1=26760&r2=26761
> ==============================================================================
> --- branches/svnpatch-diff/subversion/svn/patch-cmd.c (original)
> +++ branches/svnpatch-diff/subversion/svn/patch-cmd.c Sun Sep 23 11:51:32 2007
> @@ -44,6 +44,8 @@
> svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
> apr_array_header_t *args, *targets;
> const char *patch_path = NULL, *target_path = NULL;
> + apr_file_t *outfile, *errfile;
> + apr_status_t status;
>
> /* Sanity checks */
>
> @@ -88,11 +90,21 @@
> svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2, FALSE,
> FALSE, FALSE, pool);
>
> +
> + /* stdout and stderr pipes we'll link upon call to the external program
> + * (e.g. GNU patch) used to apply the unidiff. */
> + if ((status = apr_file_open_stdout(&outfile, pool)))
> + return svn_error_wrap_apr(status, _("Can't open stdout"));
> + if ((status = apr_file_open_stderr(&errfile, pool)))
> + return svn_error_wrap_apr(status, _("Can't open stderr"));
> +
> /* OK we're good. */
> SVN_ERR(svn_client_patch(patch_path,
> target_path,
> opt_state->force,
> opt_state->dry_run,
> + outfile,
> + errfile,
> ctx,
> pool));
>
>
> Modified: branches/svnpatch-diff/subversion/tests/cmdline/diff_tests.py
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/tests/cmdline/diff_tests.py?pathrev=26761&r1=26760&r2=26761
> ==============================================================================
> --- branches/svnpatch-diff/subversion/tests/cmdline/diff_tests.py (original)
> +++ branches/svnpatch-diff/subversion/tests/cmdline/diff_tests.py Sun Sep 23 11:51:32 2007
> @@ -2711,6 +2711,7 @@
> '( close-dir ( 2:d6 ) ) ',
> '( add-dir ( 3:A/T 2:d1 2:d8 ( ) ) ) ',
> '( add-file ( 8:A/T/mumu 2:d8 2:c9 ( 2:mu ) ) ) ',
> + '( change-file-prop ( 2:c9 13:svn:mergeinfo ( 0: ) ) ) ',
> '( close-file ( 2:c9 ( ) ) ) ',
> '( close-dir ( 2:d8 ) ) ',
> '( close-dir ( 2:d1 ) ) ',
> @@ -2754,9 +2755,9 @@
> svnpatch_output_base_head.append(svnpatch[17])
> svnpatch_output_base_head += svnpatch[14:17] + svnpatch[18:]
>
> - # copy-path received from the server is in absolute fashion
> + # No copy-path is received from the server.
> svnpatch_output_base_head[20] =\
> - svnpatch_output_base_head[20].replace('2:mu ','5:/A/mu ')
> + svnpatch_output_base_head[20].replace('2:mu ','')
>
> expected_svnpatch_base_head = svnpatch_encode(svnpatch_output_base_head)
>
>
> Modified: branches/svnpatch-diff/subversion/tests/cmdline/patch_tests.py
> URL: http://svn.collab.net/viewvc/svn/branches/svnpatch-diff/subversion/tests/cmdline/patch_tests.py?pathrev=26761&r1=26760&r2=26761
> ==============================================================================
> --- branches/svnpatch-diff/subversion/tests/cmdline/patch_tests.py (original)
> +++ branches/svnpatch-diff/subversion/tests/cmdline/patch_tests.py Sun Sep 23 11:51:32 2007
> @@ -25,7 +25,7 @@
>
> # Our testing module
> import svntest
> -from svntest import wc, SVNAnyOutput
> +from svntest import wc
>
> # (abbreviation)
> Skip = svntest.testcase.Skip
> @@ -45,12 +45,14 @@
> "".join(l))),
> 76))
>
> +gnupatch_garbage_re =\
> + re.compile("^patch: \*\*\*\* Only garbage was found in the patch input.$")
>
> ########################################################################
> #Tests
>
> def patch_basic(sbox):
> - "test 'svn patch' basic functionality"
> + "'svn patch' basic functionality with no unidiff"
>
> sbox.build()
> wc_dir = sbox.wc_dir
> @@ -59,8 +61,6 @@
> # We might want to use The-Merge-Kludge trick here
> patch_file_path = os.tempnam(svntest.main.temp_dir, 'tmp')
>
> - expected_output, stde = svntest.main.run_svn(None, 'diff',
> - '--svnpatch')
> svnpatch = [
> '( open-root ( 2:d0 ) ) ',
> '( open-dir ( 1:A 2:d0 2:d1 ) ) ',
> @@ -142,7 +142,8 @@
> expected_disk,
> None,
> expected_skip,
> - None, None, None, None, None,
> + gnupatch_garbage_re, # expected err
> + None, None, None, None,
> 1, # check-props
> 0) # no dry-run, outputs differ
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
>
>

-- 
David Glasser | glasser_at_davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Sep 27 22:53:24 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.