Note that there are some explanatory texts on larger screens.

plurals
  1. POBazaar: bzrlib equivalent of "bzr info"
    text
    copied!<p>I'm trying to write a simple script that trawls through a list of directories, checks if they are bzr version-controlled, and then tells me what their status is - ie, how many files have been modified, added etc.</p> <p>I've done this with the bzrlib Python API, and it's working great.</p> <p>My final stumbling block has been trying to figure out how to get at the trunk the branch originated from.</p> <p>To do this at the command line is a simple:</p> <pre><code> bzr info </code></pre> <p>However, what is the equivalent in bzrlib?</p> <p>At the moment, I'm opening the locations as working trees:</p> <pre><code>d = 'some directory' wt = workingtree.WorkingTree.open(d) </code></pre> <p>I tend to use "checkout" in my work, so I would be looking for something to tell me the location of the branch the current instance is checked out from, eg from the command-line:</p> <pre><code>&gt;bzr info dev Checkout (format: unnamed) Location: checkout dev: dev checkout of branch: bzr+ssh://bazaar.launchpad.net/.... </code></pre> <p>I basically want the last line as some string that I can plug into my script.</p> <p>Many thanks in advance for your time</p> <p>Cheers,</p> <p>Dave</p> <p>For future reference, for those interested. Following the hint in the accepted answer below, here is how to get at the bzr info for using location 'd':</p> <pre><code>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) </code></pre> <p>There is perhaps a more elegant way to do this, in which case feel free to add comments here!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload