Controlling bazaar from python

James Westby jw+debian at jameswestby.net
Mon Aug 6 22:04:45 BST 2007


On (06/08/07 21:53), Jeremy Wilkins wrote:
> Hi All,
> 
> Is there a simple example of controlling bazaar from python, I'm
> mainly interested in being able to perform a commit from within a
> script, though an example for reading the status would also be useful.
> 
> I've had a look through code in Command.py and Commit.py but I'm not
> really sure how to go about using it.
> 

The best place to look is builtins.py which shows how the commands are
implemented.

Other possibilities are plugins, and bzrlib/tests/blackbox/, though the
latter would be quite strange to use from a script.

It is possible to get a command object (say cmd_commit) and invoke it's
run() method, but this can give slightly strange results in some cases I
believe (I seem to remember something about the terminal encoding being
set up).

To do a pure commit something like os.system("bzr commit") might be the
easiest way, but if you want to do something slightly interesting then
copying and adapting cmd_commit would be best.

Thanks,

James

-- 
  James Westby   --    GPG Key ID: B577FE13    --     http://jameswestby.net/
  seccure key - (3+)k7|M*edCX/.A:n*N!>|&7U.L#9E)Tu)T0>AM - secp256r1/nistp256



More information about the bazaar mailing list