Get revisions affecting a file?

Michael Gliwinski Michael.Gliwinski at henderson-group.com
Wed Dec 2 12:35:23 GMT 2009


On Tuesday 01 December 2009 15:56:45 John Arbash Meinel wrote:
> > 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).

Thanks for the tip John, that seems easier indeed.  I'll have to ask some 
followup questions as I'm only starting to dig into bzrlib and some things 
aren't clear to me yet.

So basically texts.get_parent_map returns a map of specified file_keys to a 
tuple of tuples, each of which represents what exactly? And how are they 
ordered?

Specifically I'll want to use that to obtain the most recent revision where 
that file was modified and it's date.  Would that be the first tuple?  Or are 
they unordered?

Also, maybe I'm getting confused here, but how are revisions represented in 
the code, are they tuples?  Some places also refer to Revision objects, how 
can these be obtained?

Feel free to give me a pointer to somewhere in the code where this is used, 
I'll read through it and figure out as much as I can :)  Also, I may be 
missing something fundamental, I admit I didn't have time to read through all 
developer docs just yet, so I apologise, I'm getting there though.


-- 
Michael Gliwinski
Henderson Group Information Services
9-11 Hightown Avenue, Newtownabby, BT36 4RT
Phone: 028 9034 3319

**********************************************************************************************
The information in this email is confidential and may be legally privileged.  It is intended solely for the addressee and access to the email by anyone else is unauthorised.
If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.
When addressed to our clients, any opinions or advice contained in this e-mail are subject to the terms and conditions expressed  in the governing client engagement leter or contract.
If you have received this email in error please notify support at henderson-group.com

John Henderson (Holdings) Ltd
Registered office: 9 Hightown Avenue, Mallusk, County Antrim, Northern Ireland, BT36 4RT.
Registered in Northern Ireland
Registration Number NI010588
Vat No.: 814 6399 12
*********************************************************************************




More information about the bazaar mailing list