You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Dave Pawson <da...@gmail.com> on 2007/08/27 19:07:50 UTC

Initial load of data into an svn repository. How to keep the date?

I'm (mis) using subversion as a backup for local data.
When I import, then checkout, the date on all the files
is changed from its original to the current date/time.

Is there any way I can retain the date/time stamp as and when
I imported the file into subversion please?


TIA, Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Dave Pawson <da...@gmail.com>.
Hi Ryan.
  Querying a couple of your points please.

On 30/08/2007, Ryan Schmidt <su...@ryandesign.com> wrote:

> >> I totally agree with you that the mtime feature is needed in
> >> Subversion.
> >> Hopefully the issue doesn't get sidetracked yet again.  I've got
> >> my fingers
> >> crossed that issue 1256 gets attention.
> >
> > Any url please?
>The URL was:
>
> http://subversion.tigris.org/issues/show_bug.cgi?id=1256

Thanks. Karl makes a good point about the other operations
which would need the date time retaining.

Karl states:
   1) Preserving file timestamps on import and add, so when
       the file is checked out again, the working file gets the
       same timestamp as when it was imported/added.

   2) Setting working file timestamps according to last commit
       time.

I support this as a part of the feature request.



I said,

>
> > I've not used any hooks.
> > I guess the mess is that the mtime of the file is now n days prior
> > to the time of revision 1?
> > Starts to get a bit messy now :-)
>
> I don't think there's any particular problem with that, since the
> mtimes of the files are just stored in custom file properties about
> which Subversion knows nothing.

So it wouldn't mess with subversion to find mtimes which were earlier?
So perhaps a simple solution would be:

Obtain a full list of mtimes for the directory going into the repo.
import into repo
checkout data back into directory.
using data obtained, touch the newly loaded directory.

Thereafter, after the next commit, would the mtimes be correct?
I guess the only real case is that of losing the data,
then updating from the repo? Would the mtimes be correct in this case?



> No, a post-commit hook (and all other hooks) would run on the server;
> this looks like a script that you would run on your working copy
> after checking it out or updating it, so that the mtimes get set
> correctly as recorded in the properties.
>
> If you'd like to know more about hooks you can read up on them in the
> book
>
> http://svnbook.red-bean.com/en/1.4/
> svn.reposadmin.create.html#svn.reposadmin.create.hooks

Thanks for the pointers.


regards



-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Aug 29, 2007, at 09:44, Dave Pawson wrote:

> On 29/08/2007, Greg Rundlett wrote:
>
>>>>> There was  a set of patches (not part of the official project)  
>>>>> that
>>>>> adds what you're asking for, but I don't know if it's kept pace  
>>>>> with
>>>>> Subversion itself.
>
>> I totally agree with you that the mtime feature is needed in  
>> Subversion.
>> Hopefully the issue doesn't get sidetracked yet again.  I've got  
>> my fingers
>> crossed that issue 1256 gets attention.
>
> Any url please?

The URL to the issue was posted between those two quoted sections  
above, and must've gotten snipped somewhere. The URL was:

http://subversion.tigris.org/issues/show_bug.cgi?id=1256


>> The hack we've implemented as a work-around is to set a file  
>> property called
>> mtime on each of the imported files.  (At the time when you do an  
>> initial
>> import, you presumably have a copy of the original files with their
>> historical modification times, outside of subversion.)
[snip]
>> run a script that 'touches' the local working copy to use 'mtime'.
[snip]
>> Now you
>> have a local working copy of files that are version-controlled and  
>> reside on
>> the local file system displaying timestamps that reflect their  
>> 'mtime'
>> property.  You could combine this with a post_commit hook so that  
>> mtime (the
>> property) gets updated on any subsequent file modification.

I don't see any way that you could accomplish this using a post- 
commit hook (or any other hook). The hooks run on the server, but the  
files with their original mtimes are on the client. By the time the  
files get to the server, they've already lost their original mtimes.  
So, just like you have to run a script on the client after checking  
out or updating (the script that's below) to fix the mtimes so they  
match the properties, you'd have to do the same for committing: you'd  
have to run a different script before each commit which would set the  
custom mtime property of each file. Then you could commit.


> I've not used any hooks.
> I guess the mess is that the mtime of the file is now n days prior
> to the time of revision 1?
> Starts to get a bit messy now :-)

I don't think there's any particular problem with that, since the  
mtimes of the files are just stored in custom file properties about  
which Subversion knows nothing.


>> #!/bin/bash
>> pushd /home/user/work/project-working-directory
>>         for FILE in `find . -mindepth 1|grep -v '.svn'`
>>         do
>>                 echo Setting custom mtime on $FILE
>>                 svn proplist "$FILE"|grep 'svn:mtime' >/dev/null
>>                 if [ "$?" -eq 0 ]
>>                 then
>>                         MTIME=`svn propget svn:mtime "$FILE"`
>>                         touch -d "$MTIME" "$FILE"
>>                 fi
>>         done
>> popd >/dev/null
>
> Sorry to sound so ignorant Greg, is this post commit hook?

No, a post-commit hook (and all other hooks) would run on the server;  
this looks like a script that you would run on your working copy  
after checking it out or updating it, so that the mtimes get set  
correctly as recorded in the properties.

If you'd like to know more about hooks you can read up on them in the  
book

http://svnbook.red-bean.com/en/1.4/ 
svn.reposadmin.create.html#svn.reposadmin.create.hooks



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Dave Pawson <da...@gmail.com>.
Hi Greg.
(Glad I'm not alone in this view of svn!)

On 29/08/2007, Greg Rundlett <gr...@oasis-open.org> wrote:

> > > > There was  a set of patches (not part of the official project) that
> > > > adds what you're asking for, but I don't know if it's kept pace with
> > > > Subversion itself.

> Dave,
>
> I totally agree with you that the mtime feature is needed in Subversion.
> Hopefully the issue doesn't get sidetracked yet again.  I've got my fingers
> crossed that issue 1256 gets attention.

Any url please?

>
> The hack we've implemented as a work-around is to set a file property called
> mtime on each of the imported files.  (At the time when you do an initial
> import, you presumably have a copy of the original files with their
> historical modification times, outside of subversion.)
Just checking.
  I have a full directory, lots of files, each with its own date and time.
(Or did you mean as a separate file? Directory, filename, atime?
If so I can do that easily, I have some Python that will generate
an xml file of this info)



 Then, after checkout,
> run a script that 'touches' the local working copy to use 'mtime'.

Oh you sneaky person!!!!
  I can do it on my Linux box...
  I guess its doable on Windows using cygwin...
Now I see where you're going.
Yes, I do keep a backup copy of the full directory, but an xml
file with the relevant data could be just as easy.
This is promising!



 Now you
> have a local working copy of files that are version-controlled and reside on
> the local file system displaying timestamps that reflect their 'mtime'
> property.  You could combine this with a post_commit hook so that mtime (the
> property) gets updated on any subsequent file modification.

I've not used any hooks.
I guess the mess is that the mtime of the file is now n days prior
to the time of revision 1?
Starts to get a bit messy now :-)


>
> #!/bin/bash
> pushd /home/user/work/project-working-directory
>         for FILE in `find . -mindepth 1|grep -v '.svn'`
>         do
>                 echo Setting custom mtime on $FILE
>                 svn proplist "$FILE"|grep 'svn:mtime' >/dev/null
>                 if [ "$?" -eq 0 ]
>                 then
>                         MTIME=`svn propget svn:mtime "$FILE"`
>                         touch -d "$MTIME" "$FILE"
>                 fi
>         done
> popd >/dev/null

Sorry to sound so ignorant Greg, is this post commit hook?


regards


-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Greg Rundlett <gr...@oasis-open.org>.
On Wednesday 29 August 2007 08:27:01 am Andy Levy wrote:
> On 8/29/07, Dave Pawson <da...@gmail.com> wrote:
> > On 29/08/2007, Andy Levy <an...@gmail.com> wrote:
> > > > I doubt I'm the only one using svn for backups. Perhaps I could put
> > > > it in as a feature request (option perhaps?)
> > >
> > > But Subversion isn't a backup tool.
> >
> > It is for me?
> > I use it for software development (Sourceforge project)
> > and backup at home.
> > Except for this date feature it operates exceptionally well.
> >
> > With Tortoise svn my non geek wife uses it quite happily
> > to back up here client data. Great tool.
>
> No, you're using Subversion to make additional copies of things -
> xcopy.exe and the like are also "backup tools" in this regard. A
> backup tool has different features & requirements.
>
> > > There was  a set of patches (not part of the official project) that
> > > adds what you're asking for, but I don't know if it's kept pace with
> > > Subversion itself.
> >
> > Unless its really going to mess with the core code, perhaps
> > this feature could be added as an optional use?
>
> That's up to the SVN devs. If you really want the feature, fund its
> development. Also, keep an eye on
> http://subversion.tigris.org/issues/show_bug.cgi?id=1256
>
Dave,

I totally agree with you that the mtime feature is needed in Subversion.  
Hopefully the issue doesn't get sidetracked yet again.  I've got my fingers 
crossed that issue 1256 gets attention.

The hack we've implemented as a work-around is to set a file property called 
mtime on each of the imported files.  (At the time when you do an initial 
import, you presumably have a copy of the original files with their 
historical modification times, outside of subversion.) Then, after checkout, 
run a script that 'touches' the local working copy to use 'mtime'.  Now you 
have a local working copy of files that are version-controlled and reside on 
the local file system displaying timestamps that reflect their 'mtime' 
property.  You could combine this with a post_commit hook so that mtime (the 
property) gets updated on any subsequent file modification.

#!/bin/bash
pushd /home/user/work/project-working-directory
        for FILE in `find . -mindepth 1|grep -v '.svn'`
        do
                echo Setting custom mtime on $FILE
                svn proplist "$FILE"|grep 'svn:mtime' >/dev/null
                if [ "$?" -eq 0 ]
                then
                        MTIME=`svn propget svn:mtime "$FILE"`
                        touch -d "$MTIME" "$FILE"
                fi
        done
popd >/dev/null





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Dave Pawson <da...@gmail.com>.
> No, you're using Subversion to make additional copies of things -
> xcopy.exe and the like are also "backup tools" in this regard. A
> backup tool has different features & requirements.

For me, svn has all the features I need, but it seems
you don't don't agree with that.


>
> > >
> > > There was  a set of patches (not part of the official project) that
> > > adds what you're asking for, but I don't know if it's kept pace with
> > > Subversion itself.
> >
> > Unless its really going to mess with the core code, perhaps
> > this feature could be added as an optional use?
>
> That's up to the SVN devs.

Then that's where I'll ask.

Thanks for your ..

regards


-- 
Dave Pawson
XSLT XSL-FO FAQ.
http://www.dpawson.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Andy Levy <an...@gmail.com>.
On 8/29/07, Dave Pawson <da...@gmail.com> wrote:
> On 29/08/2007, Andy Levy <an...@gmail.com> wrote:
>
> > > I doubt I'm the only one using svn for backups. Perhaps I could put it
> > > in as a feature request (option perhaps?)
> >
> > But Subversion isn't a backup tool.
>
> It is for me?
> I use it for software development (Sourceforge project)
> and backup at home.
> Except for this date feature it operates exceptionally well.
>
> With Tortoise svn my non geek wife uses it quite happily
> to back up here client data. Great tool.

No, you're using Subversion to make additional copies of things -
xcopy.exe and the like are also "backup tools" in this regard. A
backup tool has different features & requirements.

> >
> > There was  a set of patches (not part of the official project) that
> > adds what you're asking for, but I don't know if it's kept pace with
> > Subversion itself.
>
> Unless its really going to mess with the core code, perhaps
> this feature could be added as an optional use?

That's up to the SVN devs. If you really want the feature, fund its
development. Also, keep an eye on
http://subversion.tigris.org/issues/show_bug.cgi?id=1256

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Dave Pawson <da...@gmail.com>.
On 29/08/2007, Andy Levy <an...@gmail.com> wrote:

> > I doubt I'm the only one using svn for backups. Perhaps I could put it
> > in as a feature request (option perhaps?)
>
> But Subversion isn't a backup tool.

It is for me?
I use it for software development (Sourceforge project)
and backup at home.
Except for this date feature it operates exceptionally well.

With Tortoise svn my non geek wife uses it quite happily
to back up here client data. Great tool.

>
> There was  a set of patches (not part of the official project) that
> adds what you're asking for, but I don't know if it's kept pace with
> Subversion itself.

Unless its really going to mess with the core code, perhaps
this feature could be added as an optional use?

Just thought it might spread the use of subversion a little more.


Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Andy Levy <an...@gmail.com>.
On 8/29/07, Dave Pawson <da...@gmail.com> wrote:
> > I see what your issue is, you don't want the date you committed them,
> > you want your commit to look at the time stamp of the file you are
> > checking in and use THAT value in the repository.  It seems like there
> > may be one of the off-shoots that covers this but I am not familiar
> > with it so someone else will have to point you to it.
>
> I doubt I'm the only one using svn for backups. Perhaps I could put it
> in as a feature request (option perhaps?)

But Subversion isn't a backup tool.

There was  a set of patches (not part of the official project) that
adds what you're asking for, but I don't know if it's kept pace with
Subversion itself.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Dave Pawson <da...@gmail.com>.
Hi Troy


> > > On 8/27/07, Dave Pawson <da...@gmail.com> wrote:
> > > > I'm (mis) using subversion as a backup for local data.
> > > > When I import, then checkout, the date on all the files
> > > > is changed from its original to the current date/time.
> > > >
> > > > Is there any way I can retain the date/time stamp as and when
> > > > I imported the file into subversion please?
> >
> > > http://subversion.tigris.org/servlets/ReadMsg?listName=users&msgNo=36306
> >
> > Which doesn't retain the original file dates?
> >
> > > Using TortoiseSVN you can have a checkout use the initial commit
> > > date as the  creation date and the last commit date as the modification date of
> > > the files  affected in a checkout.
> >
> > I have files that are years old, and I'd like to retain those dates?
> > It's customer records for which it is helpful to know the original
> > creation  date

> First, remember to 'Reply All' so that your responses go to the list
> instead of just me.

Yes, sorry.

>
> I see what your issue is, you don't want the date you committed them,
> you want your commit to look at the time stamp of the file you are
> checking in and use THAT value in the repository.  It seems like there
> may be one of the off-shoots that covers this but I am not familiar
> with it so someone else will have to point you to it.

I doubt I'm the only one using svn for backups. Perhaps I could put it
in as a feature request (option perhaps?)

Dave

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Troy Curtis Jr <tr...@gmail.com>.
On 8/28/07, Dave Pawson <da...@gmail.com> wrote:
> Thanks Troy.
>
> On 28/08/07, Troy Curtis Jr <tr...@gmail.com> wrote:
> > On 8/27/07, Dave Pawson <da...@gmail.com> wrote:
> > > I'm (mis) using subversion as a backup for local data.
> > > When I import, then checkout, the date on all the files
> > > is changed from its original to the current date/time.
> > >
> > > Is there any way I can retain the date/time stamp as and when
> > > I imported the file into subversion please?
>
> > http://subversion.tigris.org/servlets/ReadMsg?listName=users&msgNo=36306
>
> Which doesn't retain the original file dates?
>
> > Using TortoiseSVN you can have a checkout use the initial commit
> > date as the  creation date and the last commit date as the modification date of
> > the files  affected in a checkout.
>
> I have files that are years old, and I'd like to retain those dates?
> It's customer records for which it is helpful to know the original
> creation  date
>
> Dave
>

First, remember to 'Reply All' so that your responses go to the list
instead of just me.  It's kinda hard to remember, I'm constantly
having to resend emails that didn't make it to the list.

I see what your issue is, you don't want the date you committed them,
you want your commit to look at the time stamp of the file you are
checking in and use THAT value in the repository.  It seems like there
may be one of the off-shoots that covers this but I am not familiar
with it so someone else will have to point you to it.

Troy

-- 
"Beware of spyware. If you can, use the Firefox browser." - USA Today
Download now at http://getfirefox.com
Registered Linux User #354814 ( http://counter.li.org/)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Troy Curtis Jr <tr...@gmail.com>.
On 8/27/07, Dave Pawson <da...@gmail.com> wrote:
> I'm (mis) using subversion as a backup for local data.
> When I import, then checkout, the date on all the files
> is changed from its original to the current date/time.
>
> Is there any way I can retain the date/time stamp as and when
> I imported the file into subversion please?
>
>
> TIA, Dave
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: users-help@subversion.tigris.org
>
>

http://subversion.tigris.org/servlets/ReadMsg?listName=users&msgNo=36306
-- 
"Beware of spyware. If you can, use the Firefox browser." - USA Today
Download now at http://getfirefox.com
Registered Linux User #354814 ( http://counter.li.org/)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Initial load of data into an svn repository. How to keep the date?

Posted by Robert Wenner <ro...@port25.com>.
Dave Pawson wrote:
> Is there any way I can retain the date/time stamp as and when
> I imported the file into subversion please?

Check the use-commit-times option in the SVN book (page 167 in
my version of the book).

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org