Lev Serebryakov <lev@FreeBSD.org>

Found Patch
r1496007 r1466570

r1496007 | stsp | 2013-06-24 07:51:31 -0500 (Mon, 24 Jun 2013)

Fix issue #4383, "Subversion 1.8.0 crash when WC path is symlink (regression)".

In 1.7, if a working copy root was found through a symlink, WCROOT->abspath
was set to the symlink itself, rather than the target of the symlink.
In 1.8.0, WCROOT->abspath is set to the symlink target instead.

It turns out that at least one caller relies on the 1.7 behaviour.
It computes relative paths within the working copy like this:
  local_relpath = svn_dirent_skip_ancestor(wcroot->abspath, local_abspath);
and blindly uses the returned value as a path. If local_abspath is not a
child of wcroot->abspath, the skip_ancestor() function returns NULL.
So 1.8.0 ended up crashing with a NULL deref when updating working copies
through symlinks.

* subversion/libsvn_wc/wc_db_wcroot.c
  (svn_wc__db_wcroot_parse_local_abspath): Restore 1.7 behaviour from the
    caller's point of view. When a working copy root is found through a
    symlink, ensure that WCROOT->ABSPATH is set to the symlink itself,
    rather than its target.

* subversion/tests/cmdline/wc_tests.py
  (update_through_unversioned_symlink): New test. Without the above fix,
   this test fails with a crash when exclusive WC locking is disabled, and
   fails with an SQLITE_BUSY error when exclusive WC locking is enabled.

Reported by: Lev Serebryakov <lev@FreeBSD.org>

r1466570 | stsp | 2013-04-10 12:08:31 -0500 (Wed, 10 Apr 2013)

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_}FreeBSD.org>
          David O'Brien <obrien{_AT_}FreeBSD.org>
          Lev A. Serebryakov <lev{_AT_}FreeBSD.org>
          Alfred Perlstein <alfred{_AT_}FreeBSD.org>

* 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.