You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "G. Clark Haynes" <gc...@cs.cmu.edu> on 2006/03/05 01:39:14 UTC
help determining file creation time
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