0

I have a x.hg bundle file that I would like to inspect with JavaHg. I could of course unbundle it onto my repository, but I would like to open it and see the changesets inside instead. Is this possible?

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
  • (This question was asked to me in private — I'm re-posting it here with an answer in case others have the same question.) – Martin Geisler Feb 26 '12 at 13:42

1 Answers1

0

You should use the Bundle class to open the bundle. It constructs a bundle repository where the bundle has been overlaid on top of a base repository.

In normal Mercurial you do this with the --repository flag:

$ cd your-base-repository
$ hg log --repository x.hg

In JavaHg you first open the base repository and then construct a Bundle using that:

Repository repo = Repository.open(new File("your-base-repository"));
Bundle bundle = new Bundle(repo, new File("x.hg"));

You can then get the changesets from the bundle:

List<Changeset> changesets = bundle.getChangesets();
Martin Geisler
  • 72,968
  • 25
  • 171
  • 229