Mercurial > jhg
comparison cmdline/org/tmatesoft/hg/console/Bundle.java @ 357:dfb8405d996f
Clean debug stacktraces
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Tue, 06 Dec 2011 19:47:01 +0100 |
| parents | 5f9073eabf06 |
| children | 9c9c442b5f2e |
comparison
equal
deleted
inserted
replaced
| 356:91d75e1bac9f | 357:dfb8405d996f |
|---|---|
| 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 import java.util.Collections; | 20 import java.util.Collections; |
| 21 import java.util.LinkedList; | |
| 21 | 22 |
| 22 import org.tmatesoft.hg.core.HgCallbackTargetException; | 23 import org.tmatesoft.hg.core.HgCallbackTargetException; |
| 23 import org.tmatesoft.hg.core.HgException; | 24 import org.tmatesoft.hg.core.HgException; |
| 24 import org.tmatesoft.hg.core.Nodeid; | 25 import org.tmatesoft.hg.core.Nodeid; |
| 25 import org.tmatesoft.hg.repo.HgBundle; | 26 import org.tmatesoft.hg.repo.HgBundle; |
| 26 import org.tmatesoft.hg.repo.HgChangelog; | 27 import org.tmatesoft.hg.repo.HgChangelog; |
| 27 import org.tmatesoft.hg.repo.HgLookup; | 28 import org.tmatesoft.hg.repo.HgLookup; |
| 28 import org.tmatesoft.hg.repo.HgRepository; | 29 import org.tmatesoft.hg.repo.HgRepository; |
| 30 import org.tmatesoft.hg.repo.HgBundle.GroupElement; | |
| 31 import org.tmatesoft.hg.repo.HgBundle.Inspector; | |
| 29 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; | 32 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
| 30 | 33 |
| 31 | 34 |
| 32 /** | 35 /** |
| 33 * WORK IN PROGRESS, DO NOT USE | 36 * WORK IN PROGRESS, DO NOT USE |
| 43 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); | 46 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); |
| 44 return; | 47 return; |
| 45 } | 48 } |
| 46 File bundleFile = new File("/temp/hg/hg-bundle-cpython.tmp"); | 49 File bundleFile = new File("/temp/hg/hg-bundle-cpython.tmp"); |
| 47 HgBundle hgBundle = new HgLookup().loadBundle(bundleFile); | 50 HgBundle hgBundle = new HgLookup().loadBundle(bundleFile); |
| 48 hgBundle.inspectFiles(new HgBundle.Dump()); | 51 hgBundle.inspectFiles(new Dump()); |
| 49 if (Boolean.parseBoolean("true")) { | 52 if (Boolean.parseBoolean("true")) { |
| 50 return; | 53 return; |
| 51 } | 54 } |
| 52 /* 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 | 55 /* 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 |
| 53 +Changeset {User: ..., Comment: Integer ....} | 56 +Changeset {User: ..., Comment: Integer ....} |
| 98 157: 30850 0 478 1422 155 157 156 53 d5268ca7715b8d96204fc62abc632e8f55761547 | 101 157: 30850 0 478 1422 155 157 156 53 d5268ca7715b8d96204fc62abc632e8f55761547 |
| 99 158: 31328 0 247 665 155 158 157 -1 b413b16d10a50cc027f4c38e4df5a9fedd618a79 | 102 158: 31328 0 247 665 155 158 157 -1 b413b16d10a50cc027f4c38e4df5a9fedd618a79 |
| 100 | 103 |
| 101 | 104 |
| 102 */ | 105 */ |
| 106 | |
| 107 public static void dump(HgBundle hgBundle) throws HgException { | |
| 108 Dump dump = new Dump(); | |
| 109 hgBundle.inspectAll(dump); | |
| 110 System.out.println("Total files:" + dump.names.size()); | |
| 111 for (String s : dump.names) { | |
| 112 System.out.println(s); | |
| 113 } | |
| 114 } | |
| 115 | |
| 116 public static class Dump implements Inspector { | |
| 117 public final LinkedList<String> names = new LinkedList<String>(); | |
| 118 | |
| 119 public void changelogStart() { | |
| 120 System.out.println("Changelog group"); | |
| 121 } | |
| 122 | |
| 123 public void changelogEnd() { | |
| 124 } | |
| 125 | |
| 126 public void manifestStart() { | |
| 127 System.out.println("Manifest group"); | |
| 128 } | |
| 129 | |
| 130 public void manifestEnd() { | |
| 131 } | |
| 132 | |
| 133 public void fileStart(String name) { | |
| 134 names.add(name); | |
| 135 System.out.println(name); | |
| 136 } | |
| 137 | |
| 138 public void fileEnd(String name) { | |
| 139 } | |
| 140 | |
| 141 public boolean element(GroupElement ge) { | |
| 142 System.out.printf(" %s\n", ge.toString()); | |
| 143 return true; | |
| 144 } | |
| 145 } | |
| 103 } | 146 } |
