Get revisions affecting a file?

John Arbash Meinel john at arbash-meinel.com
Tue Dec 1 15:56:45 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Michael Gliwinski wrote:
> Hello All,
> 
> I've tried a couple of approaches and searched around for some info but didn't 
> find anything relevant.
> 
> Basically what I'm trying to do is to get dates of most recent revision where 
> a specific file/set of files were changed (added/modified).  Is there an easy 
> way to do this using bzrlib?
> 
> My most recent attempt was to use the bzrlib.log.Logger, sth like:
> 
> from bzrlib.workingtree import WorkingTree
> from bzrlib.log import Logger, make_log_request_dict
> from bzrlib.tests.test_log import LogCatcher
> 
> wt = WorkingTree.open_containing('.')[0]

wt.lock_read()
basis = wt.basis_tree()
basis.lock_read()
file_id = wt.path2id(filename)
basis_ie = basis.inventory[file_id]
file_key = (file_id, basis_ie.revision)
texts = wt.branch.repository.texts

# loop over this
texts.get_parent_map([file_key])

This will give you the revisions that actually modified the file, but
not revisions that merged those changes (which log includes).

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksVPL0ACgkQJdeBCYSNAAOJ7ACg07lMRCLMLVWLkOY7jQNAy4SI
DHwAn3eeCRkYhb0mjBwyUrOt2FpxJkrq
=4ST0
-----END PGP SIGNATURE-----



More information about the bazaar mailing list