Checkout Tools
  • last updated 7 hours ago
Constraints: committers
Constraints: files
Constraints: dates

Changeset 1503009 is being indexed.

Short-circuit the UTF-8 conversion when the source encoding is UTF-8.

Do this by recognizing "UTF-8" as a magic number; that magic number (well,

magic string) is already used once in svnsync's normalize_string(). The

reason for the short-circuit is that the conversion would be a no-op; see


This fixes 5 when apr_xlate_open() returns something

other than APR_SUCCESS in utf.c:xlate_alloc_handle().

* subversion/libsvn_subr/subst.c

(svn_subst_translate_string2): As above.

Fix expansion of custom keywords with values that contain '='.

* subversion/libsvn_subr/subst.c

(build_keywords): Don't use svn_cstring_split() to find the '=' separator.

It is not a suitable API for this purpose. Instead, scan for the first

occurrence of '=' and split keyword name from custom format there.

* subversion/tests/libsvn_subr/subst_translate-test.c

(test_svn_subst_build_keywords3): Expand to cover a custom keyword with '='.

Also assert that a non-NULL expanded keyword value is returned to avoid

crashing this test with a NULL-deref.

Reported by: Lorenz (lorenznl -@T-

  1. … 1 more file in changeset.
Re-apply r1485848 with an extra fix that prevents the buffer overflow

plus is easier to understand.

* subversion/libsvn_subr/subst.c

(translate_chunk): quickly scan for EOL if there is keyword substitution

Revert r1485848 because it caused segfaults in 'svn diff' on a working

copy of Subversion's own trunk. The working copy is corrupted after

the crash, some working files contain binary garbage.

Also reported to dev@.

*** This revision was reverted in r1486044 ***

*** and re-applied with bugfix in r1486058. ***

Double the speed translate_chunk in case that keyword substitution has

not been enabled.

* subversion/libsvn_subr/subst.c

(translate_chunk): use a fast scanner if we only care about newlines

* subversion/libsvn_subr/subst.c

(create_special_file_from_stream): Provide more diagnostics.

(svn_subst_copy_and_translate4): Close temporary stream before returning.

Found by: Mark Irving <irving{_AT_}>

Fix issue 4350, long keyword expansion.

* subversion/libsvn_subr/subst.c

(translate_keyword_subst): Don't expand overlong keywords.

* subversion/tests/libsvn_subr/subst_translate-test.c

(test_funcs): Mark test_svn_subst_long_keywords PASS.

  1. … 1 more file in changeset.
Followup to r1467230.

* subversion/libsvn_subr/subst.c

(translate_keyword_subst): Adjust test as well as assignment.

Found by: rhuijben

Fix issue 4349, truncated keyword re-expansion.

* subversion/libsvn_subr/subst.c

(translate_keyword_subst): Take account of keyword length.

* subversion/tests/libsvn_subr/subst_translate-test.c

(test_funcs): Mark test_svn_subst_truncated_keywords PASS.

  1. … 1 more file in changeset.
* **/**

Run tools/dev/ to remove all trailing whitespace

before we branch 1.8, like we did before creating previous branches.

No functional changes.

  1. … 199 more files in changeset.
* subversion/libsvn_subr/subst.c

(svn_subst_build_keywords): Move deprecated function ...

* subversion/libsvn_subr/deprecated.c

(svn_subst_build_keywords): ... here.

  1. … 1 more file in changeset.
Add two additional custom keyword format codes which are used by FreeBSD.

%H - Equivalent to %P%_%r%_%d%_%a.

%I - Equivalent to %b%_%r%_%d%_%a.

With this, keyword expansion works as expected with using

a stock Subversion client, rather than requiring a patched client.

These two codes are already in use at and were part of the

originally submitted patch. I'd rather add support for these format codes

to Subversion than require FreeBSD to change its svn:keywords properties

throughout their repository history.

But I'm not sure whether adding additional alias format codes is a good

idea in general, so please don't regard this as a carte blanche for

everyone else to get their favorite format code aliases into the

Subversion code base.

* subversion/include/svn_subst.h

(svn_subst_build_keywords3): Document support for %H and %I format codes.

* subversion/libsvn_subr/subst.c

(keyword_printf): Implement support for %H and %I format codes.

* subversion/svn/svn.c

(svn_cl__cmd_table): Document support for %H and %I in 'svn help propset'.

* subversion/tests/libsvn_subr/subst_translate-test.c

(test_svn_subst_build_keywords3): Expand test to cover %H and %I.

  1. … 3 more files in changeset.
Following up on r1466570, avoid doing unneeded work in a few common code paths.

* subversion/libsvn_client/cat.c

(svn_client__get_normalized_stream): Use svn_wc__node_get_repos_info to

obtain the url and the repository root.

* subversion/libsvn_subr/subst.c

(keyword_printf): Just check against the empty string (=normalized form)

instead of complete url check.

* subversion/libsvn_wc/translate.c

(svn_wc__expand_keywords): Don't fetch the repository root url when just

normalizing to the repository normal form.

  1. … 2 more files in changeset.
Add support for custom keyword definitions, fixing issue #890.

Custom keywords can be defined using a format string which controls

the way keyword information is expanded. For instance, a keyword set

the command 'svn propset svn:keywords MyKeyword=%a%_%b%_%d myfile'

can be referenced in 'myfile' as $MyKeyword$, and expands to the author,

a space, the file's name ('myfile'), another space, and the short

representation of the date of the last-changed revision.

The following format codes are currently available:

%a - The author.

%b - The basename of the URL.

%d - Short format of the date.

%D - Long format of the date.

%P - The file's path, relative to the repository root URL.

%r - The revision.

%R - The URL to the root of the repository.

%u - The URL of the file.

%_ - A space (keyword definitions cannot contain a literal space).

%% - A literal '%'.

Most of these were already defined internally in libsvn_subr.

This patch adds the %P, %R, and %_ format codes.

More format codes could be added in the future but might require API changes.

Based on a patch submitted several times by various FreeBSD developers

who have added this feature to their port of Subversion.

I'm crediting those who I know were involved in this patch in one way

or another. But I don't know for sure who wrote the initial implementation.

Patch by: Peter Wemm <peter{_AT_}>

David O'Brien <obrien{_AT_}>

Lev A. Serebryakov <lev{_AT_}>

Alfred Perlstein <alfred{_AT_}>


* subversion/include/svn_subst.h

(svn_subst_build_keywords3): Declare.

(svn_subst_build_keywords2): Deprecate.

* subversion/libsvn_client/cat.c

(svn_client__get_normalized_stream): Call svn_subst_build_keywords3().

* subversion/libsvn_client/export.c

(export_node, close_file): Call svn_subst_build_keywords3().

* subversion/libsvn_client/import.c

(send_file_contents): Call svn_subst_build_keywords3().

* subversion/libsvn_subr/subst.c

(keyword_printf): Add support for %P, %R, and %_. Add repos_root_url

parameter which is required to implement these new format codes.

(build_keywords): New helper function which implements the guts of

svn_subst_build_keywords2() and svn_subst_build_keywords3().

(svn_subst_build_keywords2): Reimplement as wrapper around build_keywords().

Turn off support for custom keywords to ensure backwards compatibility.

(svn_subst_build_keywords3): New, implemented as wrapper around the

build_keywords() helper. Enable support for custom keywords.

* subversion/libsvn_wc/translate.c

(svn_wc__expand_keywords): Call svn_subst_build_keywords3().

* subversion/svn/svn.c

(svn_cl__cmd_table): Document the custom keywords feature, including the

support format codes, in the output of 'svn help propset'.

* subversion/tests/libsvn_subr/subst_translate-test.c

(test_svn_subst_build_keywords3): New test.

(test_funcs): Add new test.

  1. … 7 more files in changeset.
Use svn_hash_gets and svn_hash_sets.

* subversion/libsvn_subr/auth.c

* subversion/libsvn_subr/cmdline.c

* subversion/libsvn_subr/compat.c

* subversion/libsvn_subr/config.c

* subversion/libsvn_subr/config_auth.c

* subversion/libsvn_subr/deprecated.c

* subversion/libsvn_subr/dso.c

* subversion/libsvn_subr/hash.c

* subversion/libsvn_subr/io.c

* subversion/libsvn_subr/mergeinfo.c

* subversion/libsvn_subr/opt.c

* subversion/libsvn_subr/properties.c

* subversion/libsvn_subr/simple_providers.c

* subversion/libsvn_subr/ssl_client_cert_providers.c

* subversion/libsvn_subr/ssl_client_cert_pw_providers.c

* subversion/libsvn_subr/ssl_server_trust_providers.c

* subversion/libsvn_subr/subst.c

* subversion/libsvn_subr/types.c

* subversion/libsvn_subr/username_providers.c

* subversion/libsvn_subr/utf.c

* subversion/libsvn_subr/win32_crypto.c

* subversion/libsvn_subr/xml.c

  1. … 21 more files in changeset.
Address issue #4331, "working copy permissions change on commit for files

with keywords" by preventing the accidental removal of existing permission

bits set on files which undergo translation.

This is not a perfect answer to the proposition given in the issue that

"Committing a file should not change its permissions in the WC."

Committed files may still get a new owner/group/other write bit set if

the umask allows this and the file's properties indicate that the file must

be set read-write (see svn_wc__sync_flags_with_props() which might tweak

permission bits of the translated file). But I think this is acceptable.

I'm not sure if never changing the permission bits of committed files is

a realistic requirement. Changing this would require additional effort

and might break other scenarios.

* subversion/libsvn_subr/subst.c

(svn_subst_copy_and_translate4): Copy file permissions from the source file

to the temporary file which stores the translated result. The temporary

file might have stricter permissions than the source, due to the way

our APIs for creating temporary files work. Removing permission bits from

files during translation is an unwanted side effect and should be avoided.

Coding style patch: in logical expressions, instead of comparing

with arithmetic constants use boolean operations. I.e. replace

<expr> == TRUE with <expr> and

<expr> == FALSE with !<expr>

* subversion/libsvn_delta/svndiff.c


window_handler): change condition style

* subversion/libsvn_fs_base/fs.c

(svn_fs_base__clean_logs): ditto

* subversion/libsvn_fs_fs/fs_fs.c



build_rep_list): ditto

* subversion/libsvn_ra_serf/locks.c

(handle_lock): ditto

* subversion/libsvn_ra_serf/property.c

(create_propfind_body): same here,

* subversion/libsvn_ra_serf/update.c




finish_report): here,

* subversion/libsvn_ra_serf/util.c

(svn_ra_serf__handle_xml_parser): here,

* subversion/libsvn_ra_svn/client.c

(optbool_to_tristate): here,

* subversion/libsvn_repos/authz.c

(authz_parse_section): and here.

* subversion/libsvn_repos/fs-wrap.c

(svn_repos__validate_prop): here as well

* subversion/libsvn_subr/cmdline.c

(svn_cmdline_create_auth_baton): and here

* subversion/libsvn_subr/deprecated.c

(print_command_info): here

* subversion/libsvn_subr/opt.c

(print_command_info2): more of the same

* subversion/libsvn_subr/subst.c

(translate_chunk): ditto

* subversion/libsvn_subr/win32_crashrpt.c


svn__unhandled_exception_filter): ditto

* subversion/svn/svn.c

(sub_main): ditto

* subversion/svnsync/svnsync.c

(filter_props): and more of the

* subversion/tests/libsvn_subr/stream-test.c

(test_readonly): same thing

* subversion/tests/libsvn_subr/string-test.c

(test21): ditto

* subversion/tests/libsvn_subr/subst_translate-test.c

(test_svn_subst_translate_string2_null_encode): here

* subversion/tests/libsvn_wc/db-test.c


test_working_info): and here

* tools/client-side/svn-bench/svn-bench.c

(sub_main): and finally here

  1. … 21 more files in changeset.
Minor optimisation.

* subversion/libsvn_subr/subst.c


* subversion/libsvn_repos/fs-wrap.c



  1. … 1 more file in changeset.
Reintegrate integrate-string-improvements branch into /trunk.
  1. … 83 more files in changeset.
And resolve another open file handle problem: Translated streams are not closed

when an error occurs in the final translate. This makes us delete an open file

in svn_subst_copy_and_translate4.

* subversion/libsvn_subr/subst.c

(translated_stream_close): Close inner stream and destroy subpool on errors.

Followup to r1140505. Fix indentation.

* [everywhere]: Fix indentation fallout from the

svn_error_return() -> svn_error_trace() rename.

Patch by: Noorul Islam K M <noorul{_AT_}>

  1. … 37 more files in changeset.
Rename the 'svn_error_return' macro to 'svn_error_trace'.

See email thread "[RFC] Rename 'svn_error_return' to 'svn_error_trace'?" on

2011-06-23, <>.

* subversion/include/svn_error.h

(svn_error_return): Rename to svn_error_trace.

(SVN_ERR, svn_error_purge_tracing): Track the rename.

* [everywhere]: Track the rename.

  1. … 120 more files in changeset.
After some discussion on IRC, rename svn_string_from_stringbuf to

svn_stringbuf__morph_into_string and move it to a private header.

* include/private/svn_string_private.h

new header

(svn_stringbuf__morph_into_string): renamed from svn_string_from_stringbuf

* include/svn_string.h

(svn_string_from_stringbuf): remove from public header

* subversion/libsvn_subr/svn_string.c

(svn_stringbuf__morph_into_string): rename implementation

* subversion/libsvn_client/patch.c

(install_patched_prop_targets): use the renamed function

* subversion/libsvn_ra_svn/marshal.c

(read_string): dito

* subversion/libsvn_repos/hooks.c

(run_hook_cmd, lock_token_content): dito

* subversion/libsvn_subr/mergeinfo.c

(svn_rangelist_to_string, svn_mergeinfo_to_string,


svn_mergeinfo__to_formatted_string): dito

* subversion/libsvn_subr/subst.c

(keyword_printf): dito

* subversion/libsvn_subr/utf.c

(svn_utf_string_to_utf8, svn_utf_string_from_utf8): and here

* subversion/libsvn_wc/props.c

(maybe_generate_propconflict, svn_wc_canonicalize_svn_prop): here

* subversion/svn/util.c:

(svn_cl__edit_string_externally): and finally here

  1. … 10 more files in changeset.
Make svn_stream_is_buffered() and related symbols private, renaming to

svn_stream__* and moving to svn_io_private.h.

* subversion/include/svn_io.h

(svn_stream_is_buffered_fn_t, svn_stream_set_is_buffered,

svn_stream_is_buffered): Move and rename from here ...

* subversion/include/private/svn_io_private.h

(svn_stream__is_buffered_fn_t, svn_stream__set_is_buffered,

svn_stream__is_buffered): ... to here.

* subversion/libsvn_subr/stream.c

(svn_stream_set_is_buffered, svn_stream_is_buffered): Rename as above.

(svn_stream_t, stream_readline, svn_stream_empty,

is_buffered_handler_disown, svn_stream_disown, svn_stream_from_aprfile2,

svn_stream_from_stringbuf, svn_stream_from_string): Adjust accordingly.

* subversion/libsvn_subr/subst.c

(translated_stream_is_buffered, stream_translated): Adjust accordingly.

  1. … 3 more files in changeset.
Replace calls to svn_string_create_from_buf with the much cheaper

svn_string_from_stringbuf. This is possible in all places where

source and target objects are expected to reside in the same pool

and the source will not be used after the conversion call.

* subversion/libsvn_client/patch.c

(install_patched_prop_targets): replace here

* subversion/libsvn_repos/hooks.c

(run_hook_cmd, lock_token_content): dito

* subversion/libsvn_subr/mergeinfo.c

(svn_rangelist_to_string, svn_mergeinfo_to_string,


svn_mergeinfo__to_formatted_string): dito

* subversion/libsvn_subr/subst.c

(keyword_printf): dito

* subversion/libsvn_subr/utf.c

(svn_utf_string_to_utf8, svn_utf_string_from_utf8): and here

* subversion/libsvn_wc/props.c

(maybe_generate_propconflict, svn_wc_canonicalize_svn_prop): here

* subversion/svn/util.c:

(svn_cl__edit_string_externally): and finally here

  1. … 6 more files in changeset.
Rename all new public stream symbols to start with 'svn_stream_' so that all

of the stream symbols are in the same name space except for some old ones

such as 'svn_read_fn_t'. Some or all of these might soon be renamed again

to make them private, but that is a separate issue.

* subversion/include/svn_io.h,


(svn_skip_fn_t): Rename to svn_stream_skip_fn_t.

(svn_io_mark_fn_t): Rename to svn_stream_mark_fn_t.

(svn_io_seek_fn_t): Rename to svn_stream_seek_fn_t.

(svn_io_is_buffered_fn_t): Rename to svn_stream_is_buffered_fn_t.

(svn_stream_t, svn_stream_set_skip, svn_stream_set_mark,

svn_stream_set_seek, svn_stream_set_is_buffered): Adjust uses of the same.

* subversion/libsvn_subr/subst.c

(translated_stream_mark, translated_stream_seek,

translated_stream_is_buffered): Adjust doc strings.

  1. … 2 more files in changeset.
Let the 'translated stream' implementation use the default skip handler instead

of providing its own copy of that handler. A follow-up to r1130490.

* subversion/libsvn_subr/subst.c

(translated_stream_skip): Remove.

(stream_translated): Don't install a skip handler.

Rename svn_stream_buffered() and related symbols to ...is_buffered... for


* subversion/include/svn_io.h

(svn_io_buffered_fn_t): Rename to svn_io_is_buffered_fn_t.

(svn_stream_set_buffered): Rename to svn_stream_set_is_buffered.

(svn_stream_buffered): Rename to svn_stream_is_buffered.

* subversion/libsvn_subr/stream.c

(svn_stream_t): Rename 'buffered_fn' to 'is_buffered_fn'.

(svn_stream_set_buffered): Rename to svn_stream_set_is_buffered.

(svn_stream_buffered): Rename to svn_stream_is_buffered.

(svn_stream_create, stream_readline, svn_stream_empty,

buffered_handler_disown, svn_stream_disown, svn_stream_from_aprfile2,

svn_stream_from_stringbuf, svn_stream_from_string): Update calls.

* subversion/libsvn_subr/subst.c

(translated_stream_buffered): Rename to translated_stream_is_buffered.

(stream_translated): Update calls.

  1. … 2 more files in changeset.
This minor change to translate_chunk() reduces the checkout time of

^/subversion/trunk/subversion in my profiler by about 1% for me. If this

has the same result on production code then this patch will probably safe

quite a few trees.

This part of the code was imported from stefan2's performance branch. More

profiling results (especially from stefan2) welcome.

* subversion/libsvn_subr/subst.c

(translate_chunk): Lose temporary variable and use boolean operators

instead of bitwise.

Merge all changes (r1068695 - r1072516) from the


These patches add svn_stream_skip(), svn_stream_buffered()

and svn_stream_supports_mark().

  1. … 4 more files in changeset.