Mercurial > jhg
annotate cmdline/org/tmatesoft/hg/console/Bundle.java @ 566:32453f30de07 v1.1m3
Annotate command with command-line example
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> | 
|---|---|
| date | Tue, 09 Apr 2013 19:25:34 +0200 | 
| parents | 9c9c442b5f2e | 
| children | 6526d8adbc0f | 
| rev | line source | 
|---|---|
| 32 
42585c7cd641
Initial dump of a bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 1 /* | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
357diff
changeset | 2 * Copyright (c) 2011-2012 TMate Software Ltd | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 3 * | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 4 * This program is free software; you can redistribute it and/or modify | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 5 * it under the terms of the GNU General Public License as published by | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 6 * the Free Software Foundation; version 2 of the License. | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 7 * | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 8 * This program is distributed in the hope that it will be useful, | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 11 * GNU General Public License for more details. | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 12 * | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 13 * For information on how to redistribute this software under | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 14 * the terms of a license other than GNU General Public License | 
| 102 
a3a2e5deb320
Updated contact address to support@hg4j.com
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
74diff
changeset | 15 * contact TMate Software at support@hg4j.com | 
| 32 
42585c7cd641
Initial dump of a bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 16 */ | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 17 package org.tmatesoft.hg.console; | 
| 32 
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 import java.io.File; | 
| 299 
45dc79e545f5
Recognize flag options (options with no arguments) in command line sample apps
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
190diff
changeset | 20 import java.util.Collections; | 
| 357 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 21 import java.util.LinkedList; | 
| 32 
42585c7cd641
Initial dump of a bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 22 | 
| 354 
5f9073eabf06
Propagate errors with exceptions up to a end client
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
299diff
changeset | 23 import org.tmatesoft.hg.core.HgException; | 
| 182 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 24 import org.tmatesoft.hg.core.Nodeid; | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 25 import org.tmatesoft.hg.repo.HgBundle; | 
| 182 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 26 import org.tmatesoft.hg.repo.HgChangelog; | 
| 169 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 27 import org.tmatesoft.hg.repo.HgLookup; | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 28 import org.tmatesoft.hg.repo.HgRepository; | 
| 357 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 29 import org.tmatesoft.hg.repo.HgBundle.GroupElement; | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 30 import org.tmatesoft.hg.repo.HgBundle.Inspector; | 
| 182 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 31 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 32 | 
| 32 
42585c7cd641
Initial dump of a bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 33 | 
| 
42585c7cd641
Initial dump of a bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 34 /** | 
| 74 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 35 * WORK IN PROGRESS, DO NOT USE | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 36 * | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 37 * @author Artem Tikhomirov | 
| 
6f1b88693d48
Complete refactoring to org.tmatesoft
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
37diff
changeset | 38 * @author TMate Software Ltd. | 
| 32 
42585c7cd641
Initial dump of a bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 39 */ | 
| 
42585c7cd641
Initial dump of a bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 40 public class Bundle { | 
| 
42585c7cd641
Initial dump of a bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 41 public static void main(String[] args) throws Exception { | 
| 299 
45dc79e545f5
Recognize flag options (options with no arguments) in command line sample apps
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
190diff
changeset | 42 Options cmdLineOpts = Options.parse(args, Collections.<String>emptySet()); | 
| 182 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 43 final HgRepository hgRepo = cmdLineOpts.findRepository(); | 
| 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: 
36diff
changeset | 44 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: 
36diff
changeset | 45 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: 
36diff
changeset | 46 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: 
36diff
changeset | 47 } | 
| 190 
9b99d27aeddc
More debug printouts
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
182diff
changeset | 48 File bundleFile = new File("/temp/hg/hg-bundle-cpython.tmp"); | 
| 169 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 49 HgBundle hgBundle = new HgLookup().loadBundle(bundleFile); | 
| 357 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 50 hgBundle.inspectFiles(new Dump()); | 
| 190 
9b99d27aeddc
More debug printouts
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
182diff
changeset | 51 if (Boolean.parseBoolean("true")) { | 
| 
9b99d27aeddc
More debug printouts
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
182diff
changeset | 52 return; | 
| 
9b99d27aeddc
More debug printouts
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
182diff
changeset | 53 } | 
| 169 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 54 /* pass -R <path-to-repo-with-less-revisions-than-bundle>, e.g. for bundle with tip=168 and -R \temp\hg4j-50 with tip:159 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 55 +Changeset {User: ..., Comment: Integer ....} | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 56 +Changeset {User: ..., Comment: Approach with ...} | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 57 -Changeset {User: ..., Comment: Correct project name...} | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 58 -Changeset {User: ..., Comment: Record possible...} | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 59 */ | 
| 182 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 60 hgBundle.changes(hgRepo, new HgChangelog.Inspector() { | 
| 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 61 private final HgChangelog changelog = hgRepo.getChangelog(); | 
| 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 62 | 
| 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 63 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
357diff
changeset | 64 if (changelog.isKnown(nodeid)) { | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
357diff
changeset | 65 System.out.print("+"); | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
357diff
changeset | 66 } else { | 
| 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
357diff
changeset | 67 System.out.print("-"); | 
| 182 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 68 } | 
| 423 
9c9c442b5f2e
Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
357diff
changeset | 69 System.out.printf("%d:%s\n%s\n", revisionNumber, nodeid.shortNotation(), cset.toString()); | 
| 182 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 70 } | 
| 
f26ffe04ced0
Refactor HgBundle to dispatch changes found through callback
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
169diff
changeset | 71 }); | 
| 35 
6061aa826a9e
Complete parsing of the bundle format
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
34diff
changeset | 72 } | 
| 169 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 73 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 74 /* | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 75 * TODO EXPLAIN why DataAccess.java on merge from branch has P2 set, and P1 is NULL | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 76 * | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 77 * excerpt from dump('hg-bundle-00') output (node, p1, p2, cs): | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 78 src/org/tmatesoft/hg/internal/DataAccess.java | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 79 186af94a2a7ddb34190e63ce556d0fa4dd24add2 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6f1b88693d48422e98c3eaaa8428ffd4d4d98ca7; patches:1 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 80 be8d0fdc4ff268bf5eb0a9120282ce6e63de1606 186af94a2a7ddb34190e63ce556d0fa4dd24add2 0000000000000000000000000000000000000000 a3a2e5deb320d7412ccbb59bdc44668d445bc4c4; patches:2 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 81 333d7bbd4a80a5d6fb4b44e54e39e290f50dc7f8 be8d0fdc4ff268bf5eb0a9120282ce6e63de1606 0000000000000000000000000000000000000000 e93101b97e4ab0a3f3402ec0e80b6e559237c7c8; patches:1 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 82 56e4523cb8b42630daf70511d73d29e0b375dfa5 0000000000000000000000000000000000000000 333d7bbd4a80a5d6fb4b44e54e39e290f50dc7f8 d5268ca7715b8d96204fc62abc632e8f55761547; patches:6 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 83 f85b6d7ed3cc4b7c6f99444eb0a41b58793cc900 56e4523cb8b42630daf70511d73d29e0b375dfa5 0000000000000000000000000000000000000000 b413b16d10a50cc027f4c38e4df5a9fedd618a79; patches:4 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 84 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 85 RevlogDump for the file says: | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 86 Index Offset Flags Packed Actual Base Rev Link Rev Parent1 Parent2 nodeid | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 87 0: 4295032832 0 1109 2465 0 74 -1 -1 186af94a2a7ddb34190e63ce556d0fa4dd24add2 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 88 1: 1109 0 70 2364 0 102 0 -1 be8d0fdc4ff268bf5eb0a9120282ce6e63de1606 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 89 2: 1179 0 63 2365 0 122 1 -1 333d7bbd4a80a5d6fb4b44e54e39e290f50dc7f8 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 90 3: 1242 0 801 3765 0 157 -1 2 56e4523cb8b42630daf70511d73d29e0b375dfa5 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 91 4: 2043 0 130 3658 0 158 3 -1 f85b6d7ed3cc4b7c6f99444eb0a41b58793cc900 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 92 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 93 Excerpt from changelog dump: | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 94 155: 30541 0 155 195 155 155 154 -1 a4ec5e08701771b96057522188b16ed289e9e8fe | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 95 156: 30696 0 154 186 155 156 155 -1 643ddec3be36246fc052cf22ece503fa60cafe22 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 96 157: 30850 0 478 1422 155 157 156 53 d5268ca7715b8d96204fc62abc632e8f55761547 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 97 158: 31328 0 247 665 155 158 157 -1 b413b16d10a50cc027f4c38e4df5a9fedd618a79 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 98 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 99 | 
| 
8c8e3f372fa1
Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
102diff
changeset | 100 */ | 
| 357 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 101 | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 102 public static void dump(HgBundle hgBundle) throws HgException { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 103 Dump dump = new Dump(); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 104 hgBundle.inspectAll(dump); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 105 System.out.println("Total files:" + dump.names.size()); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 106 for (String s : dump.names) { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 107 System.out.println(s); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 108 } | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 109 } | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 110 | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 111 public static class Dump implements Inspector { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 112 public final LinkedList<String> names = new LinkedList<String>(); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 113 | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 114 public void changelogStart() { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 115 System.out.println("Changelog group"); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 116 } | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 117 | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 118 public void changelogEnd() { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 119 } | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 120 | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 121 public void manifestStart() { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 122 System.out.println("Manifest group"); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 123 } | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 124 | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 125 public void manifestEnd() { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 126 } | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 127 | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 128 public void fileStart(String name) { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 129 names.add(name); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 130 System.out.println(name); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 131 } | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 132 | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 133 public void fileEnd(String name) { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 134 } | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 135 | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 136 public boolean element(GroupElement ge) { | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 137 System.out.printf(" %s\n", ge.toString()); | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 138 return true; | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 139 } | 
| 
dfb8405d996f
Clean debug stacktraces
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: 
354diff
changeset | 140 } | 
| 32 
42585c7cd641
Initial dump of a bundle
 Artem Tikhomirov <tikhomirov.artem@gmail.com> parents: diff
changeset | 141 } | 
