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

[PATCH] svnsync 1.6 works even when source has eol-style impurities

From: B Smith-Mannschott <bsmith.occs_at_gmail.com>
Date: Wed, 1 Apr 2009 19:39:16 +0200

Here's my attempt at a patch for the svnsync issues raised by this
thread. Please let me know what I can do to improve it.

[[[
Make is possible to use svnsync 1.6 even when source has eol-style impurities.

* subversion/include/svn_string.h
  (svn_string_with_normalized_eol_style): new function.
    This provides eol normalization for us.

* subversion/libsvn_subr/svn_string.c
  (svn_string_with_normalized_eol_style): new
  (svn_stringbuf_normalize_eol_style): new
    This does the actual work of the eol normalization by mutating
    a stringbuf provided by the caller.

* a/subversion/svnsync/main.c
  (edit_baton_t): added field normalize_prop_eol_style
  (change_file_prop, change_dir_prop): normalize eol-style for svn:*
    properties, conditional on normalize_prop_eol_style.
  (get_sync_editor): initialize normalize_prop_eol_style from
    the environment variable SVNSYNC_UNSUPPORTED_NORMALIZE_PROP_EOL_STYLE.
    If this is defined, we will do normalization, otherwise not.
  (replay_rev_started): normalize eol-style of svn:log comments
    before they are written through to the destination repository.
]]]

Notes
=====

1. I've placed svn_string_with_normalized_eol_style() into libsvn_subr
   because it seems like generally useful functionality. If this is not
   the case, it can be moved to subversion/svnsync/main.c

2. I'm not very confident that the logic in replay_rev_started is in
   the correct place. I tried a number of approaches before finding
   this one, which seems to work. My difficulty in following the
   control flow (delgation through function poniters ahoy!) means I
   couldn't make a convincing argument as to why this is the right
   place for this logic.

3. I've not tackled the question of automated testing at all. I'll
   attach a dump file which contains a directory property and an
   svn:log with containing \r (i.e. ^M) so that an interested party
   can at least play with the code on an example.

   I'll invest the time necessary to provide a decent automated test
   should there be interest in actually incorporating this patch. (I
   wouldn't want it included without such tests.)

// Ben

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1509262

  • application/octet-stream attachment: repo.dump
Received on 2009-04-01 19:39:36 CEST

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.