annotate src/com/tmate/hgkit/console/Bundle.java @ 42:92c3d0920d58

Real integrity check, with exception. DigestHelper refactored to accomodate new needs
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 14 Jan 2011 04:29:03 +0100
parents e45e75e22523
children
rev   line source
32
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2011 Artem Tikhomirov
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 */
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 package com.tmate.hgkit.console;
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 import java.io.File;
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 import com.tmate.hgkit.fs.DataAccessProvider;
37
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
9 import com.tmate.hgkit.fs.RepositoryLookup;
36
205f9b59b400 Strip parsing logic out from console frontend
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 35
diff changeset
10 import com.tmate.hgkit.ll.HgBundle;
37
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
11 import com.tmate.hgkit.ll.HgRepository;
32
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 /**
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 *
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * @author artem
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 public class Bundle {
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 public static void main(String[] args) throws Exception {
37
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
20 RepositoryLookup repoLookup = new RepositoryLookup();
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
21 RepositoryLookup.Options cmdLineOpts = RepositoryLookup.Options.parse(args);
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
22 HgRepository hgRepo = repoLookup.detect(cmdLineOpts);
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
23 if (hgRepo.isInvalid()) {
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
24 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation());
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
25 return;
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
26 }
32
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 File bundleFile = new File("/temp/hg/hg-bundle-a78c980749e3.tmp");
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
28 DataAccessProvider dap = new DataAccessProvider();
36
205f9b59b400 Strip parsing logic out from console frontend
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 35
diff changeset
29 HgBundle hgBundle = new HgBundle(dap, bundleFile);
37
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
30 // hgBundle.dump();
e45e75e22523 Parse changesets from bundle's changelog group. Refactor Revlog to provide access to revision's raw content
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 36
diff changeset
31 hgBundle.changes(hgRepo);
35
6061aa826a9e Complete parsing of the bundle format
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 34
diff changeset
32 }
32
42585c7cd641 Initial dump of a bundle
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 }