comparison cmdline/org/tmatesoft/hg/console/Bundle.java @ 169:8c8e3f372fa1

Towards initial clone: refactor HgBundle to provide slightly higher-level structure of the bundle
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 23 Mar 2011 14:13:11 +0100
parents a3a2e5deb320
children f26ffe04ced0
comparison
equal deleted inserted replaced
168:dd525ca65de8 169:8c8e3f372fa1
16 */ 16 */
17 package org.tmatesoft.hg.console; 17 package org.tmatesoft.hg.console;
18 18
19 import java.io.File; 19 import java.io.File;
20 20
21 import org.tmatesoft.hg.internal.DataAccessProvider;
22 import org.tmatesoft.hg.repo.HgBundle; 21 import org.tmatesoft.hg.repo.HgBundle;
22 import org.tmatesoft.hg.repo.HgLookup;
23 import org.tmatesoft.hg.repo.HgRepository; 23 import org.tmatesoft.hg.repo.HgRepository;
24 24
25 25
26 /** 26 /**
27 * WORK IN PROGRESS, DO NOT USE 27 * WORK IN PROGRESS, DO NOT USE
28 * 28 *
29 * @author Artem Tikhomirov 29 * @author Artem Tikhomirov
30 * @author TMate Software Ltd. 30 * @author TMate Software Ltd.
31 */ 31 */
32 public class Bundle { 32 public class Bundle {
33
34 public static void main(String[] args) throws Exception { 33 public static void main(String[] args) throws Exception {
35 Options cmdLineOpts = Options.parse(args); 34 Options cmdLineOpts = Options.parse(args);
36 HgRepository hgRepo = cmdLineOpts.findRepository(); 35 HgRepository hgRepo = cmdLineOpts.findRepository();
37 if (hgRepo.isInvalid()) { 36 if (hgRepo.isInvalid()) {
38 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); 37 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation());
39 return; 38 return;
40 } 39 }
41 File bundleFile = new File("/temp/hg/hg-bundle-a78c980749e3.tmp"); 40 File bundleFile = new File("/temp/hg/hg-bundle-000000000000-gz.tmp");
42 DataAccessProvider dap = new DataAccessProvider(); 41 HgBundle hgBundle = new HgLookup().loadBundle(bundleFile);
43 HgBundle hgBundle = new HgBundle(dap, bundleFile);
44 // hgBundle.dump(); 42 // hgBundle.dump();
43 /* 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
44 +Changeset {User: ..., Comment: Integer ....}
45 +Changeset {User: ..., Comment: Approach with ...}
46 -Changeset {User: ..., Comment: Correct project name...}
47 -Changeset {User: ..., Comment: Record possible...}
48 */
45 hgBundle.changes(hgRepo); 49 hgBundle.changes(hgRepo);
46 } 50 }
51
52 /*
53 * TODO EXPLAIN why DataAccess.java on merge from branch has P2 set, and P1 is NULL
54 *
55 * excerpt from dump('hg-bundle-00') output (node, p1, p2, cs):
56 src/org/tmatesoft/hg/internal/DataAccess.java
57 186af94a2a7ddb34190e63ce556d0fa4dd24add2 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000 6f1b88693d48422e98c3eaaa8428ffd4d4d98ca7; patches:1
58 be8d0fdc4ff268bf5eb0a9120282ce6e63de1606 186af94a2a7ddb34190e63ce556d0fa4dd24add2 0000000000000000000000000000000000000000 a3a2e5deb320d7412ccbb59bdc44668d445bc4c4; patches:2
59 333d7bbd4a80a5d6fb4b44e54e39e290f50dc7f8 be8d0fdc4ff268bf5eb0a9120282ce6e63de1606 0000000000000000000000000000000000000000 e93101b97e4ab0a3f3402ec0e80b6e559237c7c8; patches:1
60 56e4523cb8b42630daf70511d73d29e0b375dfa5 0000000000000000000000000000000000000000 333d7bbd4a80a5d6fb4b44e54e39e290f50dc7f8 d5268ca7715b8d96204fc62abc632e8f55761547; patches:6
61 f85b6d7ed3cc4b7c6f99444eb0a41b58793cc900 56e4523cb8b42630daf70511d73d29e0b375dfa5 0000000000000000000000000000000000000000 b413b16d10a50cc027f4c38e4df5a9fedd618a79; patches:4
62
63 RevlogDump for the file says:
64 Index Offset Flags Packed Actual Base Rev Link Rev Parent1 Parent2 nodeid
65 0: 4295032832 0 1109 2465 0 74 -1 -1 186af94a2a7ddb34190e63ce556d0fa4dd24add2
66 1: 1109 0 70 2364 0 102 0 -1 be8d0fdc4ff268bf5eb0a9120282ce6e63de1606
67 2: 1179 0 63 2365 0 122 1 -1 333d7bbd4a80a5d6fb4b44e54e39e290f50dc7f8
68 3: 1242 0 801 3765 0 157 -1 2 56e4523cb8b42630daf70511d73d29e0b375dfa5
69 4: 2043 0 130 3658 0 158 3 -1 f85b6d7ed3cc4b7c6f99444eb0a41b58793cc900
70
71 Excerpt from changelog dump:
72 155: 30541 0 155 195 155 155 154 -1 a4ec5e08701771b96057522188b16ed289e9e8fe
73 156: 30696 0 154 186 155 156 155 -1 643ddec3be36246fc052cf22ece503fa60cafe22
74 157: 30850 0 478 1422 155 157 156 53 d5268ca7715b8d96204fc62abc632e8f55761547
75 158: 31328 0 247 665 155 158 157 -1 b413b16d10a50cc027f4c38e4df5a9fedd618a79
76
77
78 */
47 } 79 }