Where can download this library?

Asked by Petr Arsent'ev on 2010-10-11

Hi All. I need interact my Java application with Bazaar.
The first I found other plugins bzr-xmloutput, but I don't understand how to use her.
However. You have got already ready-made libraries.
Where can download his?

Question information

English Edit question
Java library for Bazaar Edit question
No assignee Edit question
Last query:
Last reply:
Guillermo Gonzalez (verterok) said : #1


You can get the latest trunk doing: 'bzr branch lp:bzr-java-lib' and build it using maven.

If you want, it's also available via a maven repository, http://verterok.com.ar/maven-repo/

and add this dependency to your pom.xml:



Petr Arsent'ev (parsentev) said : #2

Thanks. I downloaded the library and was wrote following code
package action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.vcs.bazaar.client.*;
import org.vcs.bazaar.client.commandline.CommandLineClientFactory;
import org.vcs.bazaar.client.commandline.commands.options.Option;
import org.vcs.bazaar.client.core.BazaarClientException;
import org.vcs.bazaar.client.core.BranchLocation;

import java.net.URI;
import java.util.List;

public class BazaarUsage {
    private final static Log LOG = LogFactory.getLog(BazaarUsage.class);

    public static void main(String[] args) {
        BazaarClientPreferences.getInstance().set(BazaarPreference.EXECUTABLE, "/usr/bin/bzr");
        try {
            IBazaarClient client = BazaarClientFactory.createClient(BazaarClientFactory.getPreferredClientType());
            client.addNotifyListener(new StandardOutputListener());
            BranchLocation branchLocation = new BranchLocation(URI.create("bzr+ssh://localhost/home/pitbull/bazaar"));
            List<IBazaarLogMessage> logMessages = client.log(branchLocation, new Option("-v"), new Option("-r2..3"));
            for (IBazaarLogMessage log : logMessages) {
                for (IBazaarStatus file : log.getAffectedFiles()) {
                System.out.println("\n\t"+log.getCommiter() + " " +log.getDate());
        } catch (BazaarClientException e) {
            LOG.fatal(e.getMessage(), e);

When I run this code, me must enter - login/password. I want to set login/password in my code.
How I can set login/password in above code?

Guillermo Gonzalez (verterok) said : #3


Yes, this is a known problem/limitation, you can use authentication.conf or an ssh-agent (if the remote branch is accessed via ssh) in order to workaround the password issue.

Take a look to Bug #121936 and Bug #269335.


Petr Arsent'ev (parsentev) said : #4

Ok. Thanks.
I have last question. How get diff file for two revision?
I make so:
 String diffSt = client.diff(null, null, new Option("-r1..2"), new Option(path_branch), new Option(path_branch + "/src/test/SearchNeo.java"));
But I think that is don't best decide.

Guillermo Gonzalez (verterok) said : #5


In order to execute the diff command you need to pass it the File you want to diff and/or the revision spec, e.g:

IBazaarRevisionSpec revSpec = BazaarRevisionRange.getRange(BazaarRevision.getRevision(1), BazaarRevision.getRevision(1));
File file = new File(path_branch + "/src/test/SearchNeo.java");
String diffSt = client.diff(file, revSpec);


Can you help with this problem?

Provide an answer of your own, or ask Petr Arsent'ev for more information if necessary.

To post a message you must log in.