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

help determining file creation time

From: G. Clark Haynes <gch_at_cs.cmu.edu>
Date: 2006-03-05 02:39:14 CET

Hi everyone,

I've got a hopefully quick question. I am using Subversion 1.3.0 with
the Python bindings (using Python version 2.4.2)

I'm trying to recurse back through the history of a file to figure out
creation dates and modification times.

Calling 'svn log' on the same file shows me modifications prior to times
I called 'svn move', whereas my simple script is unable to track these
changes, and only shows modifications after a file was last moved.

Can anyone give me a pointer on how you also track file moves?

Sample Python code follows.

Another, question, is that I'm unable to use fs.node_proplist, and only
get empty results. Any ideas?

>>> fs.node_proplist(root,'gear/helmets.txt')
{}

Thanks!
Clark

===============================================

from datetime import datetime
from svn import fs, repos, core

SVN_ROOT = '/var/www/subversion/personal/wiki'
filename = 'gear/helmets.txt'

repository = repos.open(SVN_ROOT)
fs_ptr = repos.fs(repository)
rev = fs.youngest_rev(fs_ptr)
root = fs.revision_root(fs_ptr,rev)

# jump back once from current to get last modified time
h = fs.history_prev(fs.node_history(root,filename),0)
[loco,last_rev] = fs.history_location(h)

# convert that to a datetime object
tmpdate = fs.revision_prop(fs_ptr,last_rev,
                           core.SVN_PROP_REVISION_DATE)
modified_at = datetime.fromtimestamp(int(core.svn_time_from_cstring(tmpdate)
              /1000000.0))

### FIXME - this is not tracking file moves, how to fix?
while h:
    [loco, last_rev] = fs.history_location(h)
    tmpdate = fs.revision_prop(fs_ptr,last_rev,
                               core.SVN_PROP_REVISION_DATE)
    created_at = datetime.fromtimestamp(int(core.svn_time_from_cstring(tmpdate)
                 /1000000.0))
    author = fs.revision_prop(fs_ptr,last_rev,
                              core.SVN_PROP_REVISION_AUTHOR)
    h = fs.history_prev(h,0)

    print '%s' % (created_at)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Mar 8 16:28:06 2006

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.