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

Re: maintaining file modified dates during svn import?

From: Lorenz <lorenznl_at_yahoo.com>
Date: 2007-09-21 09:07:35 CEST

Reuben Avery wrote:
>i need to be able to maintain the modified dates on files during an svn
>import. [...]
>as i am trying to mirror a clientıs website into the subversion repository
>but need to maintain those dates for reporting and site mirroring purposes.

if you only need the information, you could use a custom property.

I've written a batch script (i'm on windows here) that sets a "mtime"
property on all files in a given directory (which must be a working
copy already). No recursion into subdirectories yet, but should be
easy to add.

For using this method to "import", you need to create an empty target
directory in the repository first, "svn co" over the directory to
import and then "svn add" everything.
After that you can use the batch file and commit.

Here's the batch script

>@echo off
>if %1! == !%1 goto noDir
>
>dir /A-D %1 | gawk "/^[0-9]/ {i++; system(\"svn propset mtime \\\"\"$1\" \"$2\"\\\" \"$(NF))} END {print i}"
>goto end
>
>:noDir
>echo "
>echo " use setDateProp to set the mtime property of files
>echo " in a svn working copy to the 'modification' date of the
>echo " original file
>echo "
>echo " usage: cd <path-to-workingCopy>
>echo " setDateProp <path-to-sourceFolder>
>echo "
>echo " to be run from the working copy folder!
>echo "
>echo " specify <path-to-source-folder> as parameter (may
>echo " be '.\' to point to the working copy folder).
>echo "
>
>:end

I'm using a gnuwin32 port of gawk, because I use it a lot and could
not think of an pur dos way quickly.

HTH

     Lorenz

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Fri Sep 21 09:04:40 2007

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

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