Anyone pointing trac at a subversion repository built with svnsync might run into the same problem as me - trac shows commits but they show with author set to the username passed to the svnsync command and not the real author from the source repository. My best guess is that this happens because trac detects the checkin before synsync has copied over the revision properties (that includes changing the author). So to fix it, just add a post-revprop-change hook script (to the target repository) that tells trac to resync the revision concerned:
#!/bin/sh
REV="$2"
TRAC_ENV="/path/to/trac/environment"
/usr/bin/trac-admin "$TRAC_ENV" resync "$REV"
I also add the call to the contributed trac-post-commit-hook in there too (rather than putting it in post-commit):
/usr/bin/python /path/to/trac-post-commit-hook -p "$TRAC_ENV" -r "$REV"
Update: 19/02/08:
After receiving a lot of duplicate emails from trac I realised that the above approach isn't quite good enough. svnsync updates revision properties more than once per commit (once for each property I guess) so you end up resyncing redundantly and, in my case, calling trac-post-commit-hook several times (resulting in duplicate ticket updates). So I decided not to use the subversion hook scripts and to do what I needed to do to trac directly after running svnsync. Here's the script I run with cron:
#!/usr/bin/env ruby
# This is script is run every 5 minutes. It syncs the svn repository onto the
# trac server. It also manually tells trac to resync each revision and calls
# the trac-post-commit-hook for each revision.
SVN_USER = "rails"
FROM = "svn://www.example.org/project"
TO = "file:///path/to/repos-mirror/"
TRAC_ENV = "/path/to/trac/environment"
POST_COMMIT_HOOK_SCRIPT = "/path/to/trac-post-commit-hook"
sync_output = `svnsync sync --non-interactive --username "" "" ""`
unless sync_output.empty?
revisions = sync_output.scan(/Committed revision (\d+)/).flatten
puts sync_output
for rev in revisions
puts "Telling trac about revision ..."
puts `/usr/bin/trac-admin "" resync ""`
puts `/usr/bin/python "" -p "" -r ""`
end
end