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?
Thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
Java library for Bazaar Edit question
Assignee:
No assignee Edit question
Last query:
2010-10-21
Last reply:
2010-11-03
Guillermo Gonzalez (verterok) said : #1

Hi,

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:

  <dependency>
  <groupId>org.vcs.bazaar.client</groupId>
     <artifactId>bzr-java-lib</artifactId>
  <version>0.5.2-SNAPSHOT</version>
     <scope>compile</scope>
 </dependency>

Regards,

Petr Arsent'ev (parsentev) said : #2

Thanks. I downloaded the library and was wrote following code
{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 {
            CommandLineClientFactory.setup(false);
            BazaarClientFactory.setPreferredClientType(CommandLineClientFactory.CLIENT_TYPE);
            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) {
                System.out.println(log.getRevision());
                for (IBazaarStatus file : log.getAffectedFiles()) {
                    System.out.println("\t"+file.getShortStatus()+"\t"+file.getFile().getPath());
                }
                System.out.println("\n\t"+log.getCommiter() + " " +log.getDate());
                System.out.println("\t"+log.getMessage());
            }
        } catch (BazaarClientException e) {
            LOG.fatal(e.getMessage(), e);
        }

    }
}
{code}
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?
Thanks.

Guillermo Gonzalez (verterok) said : #3

Hi,

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.

Regards,

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

Hi,

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);

Regards,

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.