Is there a bzrlib function that will (given a repository to look in) output a revision's parents?

34 Views Asked by At

I am new to Python and Linux and I have been tasked with a project that will utilize the bzrlib toolbox written in python.

The task is as follows. "Create a Python function which accepts the file system path to a local Bazaar (bzr) project and returns the revision and branch of the project's baseline. Use a driver to demonstrate function objectives"

So basically if I wanted to know the last known merged revision off of the project's baseline I would call the function on the linux command line and then enter the Directory where the repository is located and Revision number from the baseline that I want to check.

Here are some examples of what the input and output may look like:

INPUT: /home/example-directory INPUT: 134

OUTPUT: 133

INPUT: /home/example-directory INPUT: 176

OUTPUT: 170.4.5

I have been reading through the bzrlib API to try and find what I am looking for but so far no luck. If anybody has an idea of how I might do this I would appreciate it!

1

There are 1 best solutions below

4
jelmer On BEST ANSWER

You can use the Branch.open method to open a branch from a path.

The .repository attribute of the branch can be used to access its repository.

There are three relevant functions that you'd want to use: