I try to write a simple script that sneaks through a list of directories, checks to see if they are managed versions of bzr, and then tells me that their status - that is, how many files have been changed, added, etc.
I did this using the bzrlib Python API and it works great.
My last stumbling block was trying to figure out how to get to the trunk from which the branch originated.
To do this, the command line simply:
bzr info
However, what is equivalent in bzrlib?
I am currently opening locations as work trees:
d = 'some directory' wt = workingtree.WorkingTree.open(d)
I try to use "checkout" in my work, so I will look for something to tell me the location of the branch from which the current instance is issued, for example, from the command line:
>bzr info dev Checkout (format: unnamed) Location: checkout dev: dev checkout of branch: bzr+ssh:
Basically I want the last line to be some line that I can connect to the script.
Thanks so much in advance for your time.
Greetings
Dave
In the future, for those who wish. Following a hint of the accepted answer below, here's how to get bzr information to use location 'd':
from bzrlib import repository, branch, workingtree, info r = repository.Repository.open(d) b = branch.Branch.open(d) w = workingtree.WorkingTree.open(d) bzr_info = info.gather_location_info(r,branch=b,working=w)
There may be a more elegant way to do this, in which case feel free to add comments here!