Mercurial > hg4j
annotate cmdline/org/tmatesoft/hg/console/Main.java @ 426:063b0663495a
HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 28 Mar 2012 19:34:37 +0200 |
parents | 48f993aa2f41 |
children | 31a89587eb04 |
rev | line source |
---|---|
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
2 * Copyright (c) 2011-2012 TMate Software Ltd |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.console; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
19 import static org.tmatesoft.hg.repo.HgRepository.TIP; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
20 |
254
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
21 import java.io.File; |
350
33eaed1ad130
Allow FileIterator report any errors from the underlaying file system up to the client
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
22 import java.io.IOException; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 import java.util.ArrayList; |
305
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
24 import java.util.Collection; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 import java.util.Collections; |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
317
diff
changeset
|
26 import java.util.HashSet; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 import java.util.List; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
28 import java.util.Map; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
29 |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
30 import org.junit.Assert; |
354
5f9073eabf06
Propagate errors with exceptions up to a end client
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
350
diff
changeset
|
31 import org.tmatesoft.hg.core.HgCallbackTargetException; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
32 import org.tmatesoft.hg.core.HgCatCommand; |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
317
diff
changeset
|
33 import org.tmatesoft.hg.core.HgChangeset; |
417
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
416
diff
changeset
|
34 import org.tmatesoft.hg.core.HgChangesetFileSneaker; |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
317
diff
changeset
|
35 import org.tmatesoft.hg.core.HgChangesetTreeHandler; |
354
5f9073eabf06
Propagate errors with exceptions up to a end client
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
350
diff
changeset
|
36 import org.tmatesoft.hg.core.HgException; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
37 import org.tmatesoft.hg.core.HgFileRevision; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
38 import org.tmatesoft.hg.core.HgLogCommand; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 import org.tmatesoft.hg.core.HgManifestCommand; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 import org.tmatesoft.hg.core.Nodeid; |
425
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
41 import org.tmatesoft.hg.internal.BasicSessionContext; |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
42 import org.tmatesoft.hg.internal.ByteArrayChannel; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
43 import org.tmatesoft.hg.internal.DigestHelper; |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
226
diff
changeset
|
44 import org.tmatesoft.hg.internal.PathGlobMatcher; |
254
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
45 import org.tmatesoft.hg.internal.RelativePathRewrite; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
46 import org.tmatesoft.hg.internal.StreamLogFacility; |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
197
diff
changeset
|
47 import org.tmatesoft.hg.repo.HgBranches; |
233
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
48 import org.tmatesoft.hg.repo.HgChangelog; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
49 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
50 import org.tmatesoft.hg.repo.HgDataFile; |
290
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
51 import org.tmatesoft.hg.repo.HgDirstate; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
52 import org.tmatesoft.hg.repo.HgDirstate.EntryKind; |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
53 import org.tmatesoft.hg.repo.HgDirstate.Record; |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
328
diff
changeset
|
54 import org.tmatesoft.hg.repo.HgIgnore; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
55 import org.tmatesoft.hg.repo.HgInternals; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 import org.tmatesoft.hg.repo.HgManifest; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
57 import org.tmatesoft.hg.repo.HgManifest.Flags; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
58 import org.tmatesoft.hg.repo.HgMergeState; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
59 import org.tmatesoft.hg.repo.HgRepository; |
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:
417
diff
changeset
|
60 import org.tmatesoft.hg.repo.HgRuntimeException; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
61 import org.tmatesoft.hg.repo.HgStatusCollector; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
62 import org.tmatesoft.hg.repo.HgStatusInspector; |
239
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
63 import org.tmatesoft.hg.repo.HgSubrepoLocation; |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
64 import org.tmatesoft.hg.repo.HgSubrepoLocation.Kind; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
65 import org.tmatesoft.hg.repo.HgWorkingCopyStatusCollector; |
254
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
66 import org.tmatesoft.hg.util.FileWalker; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
67 import org.tmatesoft.hg.util.LogFacility; |
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
68 import org.tmatesoft.hg.util.Pair; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
69 import org.tmatesoft.hg.util.Path; |
254
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
70 import org.tmatesoft.hg.util.PathRewrite; |
425
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
71 import org.tmatesoft.hg.util.ProgressSupport; |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
72 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
73 /** |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
74 * Various debug dumps. |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
75 * |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
76 * @author Artem Tikhomirov |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
77 * @author TMate Software Ltd. |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
78 */ |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
79 @SuppressWarnings("unused") |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
80 public class Main { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
81 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
82 private Options cmdLineOpts; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
83 private HgRepository hgRepo; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
84 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
85 public 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:
295
diff
changeset
|
86 cmdLineOpts = Options.parse(args, Collections.<String>emptySet()); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
87 hgRepo = cmdLineOpts.findRepository(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
88 if (hgRepo.isInvalid()) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
89 System.err.printf("Can't find repository in: %s\n", hgRepo.getLocation()); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
90 return; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
91 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
92 System.out.println("REPO:" + hgRepo.getLocation()); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
93 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
94 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
95 public static void main(String[] args) throws Exception { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
96 Main m = new Main(args); |
426
063b0663495a
HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
97 m.checkWalkFileRevisions(); |
063b0663495a
HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
98 // m.checkSubProgress(); |
425
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
99 // m.checkFileFlags(); |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
328
diff
changeset
|
100 // m.buildFileLog(); |
305
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
101 // m.testConsoleLog(); |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
254
diff
changeset
|
102 // m.testTreeTraversal(); |
244
4b661efb9374
Use updated location of cache files (cache/ folder instead of .cache filename extension). Provide means to update (write down) cache for subsequent uses
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
243
diff
changeset
|
103 // m.testRevisionMap(); |
242
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
104 // m.testSubrepos(); |
239
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
105 // m.testReadWorkingCopy(); |
254
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
106 // m.testParents(); |
243
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
107 // m.testEffectiveFileLog(); |
252
a6d19adc2636
HgRepository.getWorkingCopyBranchName() to retrieve branch associated with working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
108 // m.testCatAtCsetRevision(); |
345
58725dd511b3
Provide access to revision's origins
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
341
diff
changeset
|
109 // m.testMergeState(); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
110 // m.testFileStatus(); |
341
75c452fdd76a
Merging state not detected when there's no conflicts to resolve (no merge/state file)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
340
diff
changeset
|
111 // m.dumpBranches(); |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
197
diff
changeset
|
112 // m.inflaterLengthException(); |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
113 // m.dumpIgnored(); |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
114 // m.dumpDirstate(); |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
115 // m.testStatusInternals(); |
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
116 // m.catCompleteHistory(); |
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
117 // m.dumpCompleteManifestLow(); |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
118 // m.dumpCompleteManifestHigh(); |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
119 // m.bunchOfTests(); |
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
120 } |
425
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
121 |
426
063b0663495a
HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
122 // hg4j repo |
063b0663495a
HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
123 public void checkWalkFileRevisions() throws Exception { |
063b0663495a
HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
124 // hg --debug manifest --rev 150 | grep cmdline/org/tmatesoft/hg/console/Main.java |
063b0663495a
HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
125 hgRepo.getManifest().walkFileRevisions(Path.create("cmdline/org/tmatesoft/hg/console/Main.java"), new ManifestDump(), 100, 150, 200, 210, 300); |
063b0663495a
HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
126 } |
063b0663495a
HgManifest#getFileRevisions refactored into #walkFileRevisions to match pattern throught rest of the library
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
127 |
425
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
128 // no repo |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
129 private void checkSubProgress() { |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
130 ProgressSupport ps = new ProgressSupport() { |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
131 private int units; |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
132 |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
133 public void start(int totalUnits) { |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
134 units = totalUnits; |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
135 System.out.printf("%d:", totalUnits); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
136 |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
137 } |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
138 public void worked(int wu) { |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
139 for (int i = 0; i < wu; i++) { |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
140 System.out.print(units-- == 0 ? '!' : '.'); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
141 } |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
142 } |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
143 public void done() { |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
144 System.out.println("DONE"); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
145 } |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
146 }; |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
147 ps.start(10); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
148 ProgressSupport.Sub s1 = new ProgressSupport.Sub(ps, 3); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
149 ProgressSupport.Sub s2 = new ProgressSupport.Sub(ps, 7); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
150 s1.start(10); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
151 s1.worked(1); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
152 s1.worked(2); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
153 s1.worked(3); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
154 s1.worked(4); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
155 s1.done(); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
156 // |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
157 s2.start(5); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
158 s2.worked(3); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
159 s2.worked(2); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
160 s2.done(); |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
161 } |
305
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
162 |
415
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
163 private void checkFileFlags() throws Exception { |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
164 // ~/hg/test-flags repo |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
165 // TODO transform to a test once I keep test-flags in test-repos.jar |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
166 HgDataFile link = hgRepo.getFileNode("file-link"); |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
167 HgDataFile exec = hgRepo.getFileNode("file-exec"); |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
168 HgDataFile file = hgRepo.getFileNode("regular-file"); |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
169 System.out.println("Link: " + link.getFlags(TIP)); |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
170 System.out.println("Exec: " + exec.getFlags(TIP)); |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
171 System.out.println("File: " + file.getFlags(TIP)); |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
172 } |
ee8264d80747
Explicit constant for regular file flags, access to flags for a given file revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
173 |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
317
diff
changeset
|
174 private void buildFileLog() throws Exception { |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
317
diff
changeset
|
175 HgLogCommand cmd = new HgLogCommand(hgRepo); |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
317
diff
changeset
|
176 cmd.file("file1", false); |
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
317
diff
changeset
|
177 cmd.execute(new HgChangesetTreeHandler() { |
354
5f9073eabf06
Propagate errors with exceptions up to a end client
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
350
diff
changeset
|
178 public void next(HgChangesetTreeHandler.TreeElement entry) { |
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:
417
diff
changeset
|
179 StringBuilder sb = new StringBuilder(); |
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:
417
diff
changeset
|
180 HashSet<Nodeid> test = new HashSet<Nodeid>(entry.childRevisions()); |
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:
417
diff
changeset
|
181 for (HgChangeset cc : entry.children()) { |
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:
417
diff
changeset
|
182 sb.append(cc.getRevisionIndex()); |
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:
417
diff
changeset
|
183 sb.append(':'); |
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:
417
diff
changeset
|
184 sb.append(cc.getNodeid().shortNotation()); |
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:
417
diff
changeset
|
185 sb.append(", "); |
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:
417
diff
changeset
|
186 } |
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:
417
diff
changeset
|
187 final Pair<Nodeid, Nodeid> parents = entry.parentRevisions(); |
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:
417
diff
changeset
|
188 final boolean isJoin = !parents.first().isNull() && !parents.second().isNull(); |
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:
417
diff
changeset
|
189 final boolean isFork = entry.children().size() > 1; |
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:
417
diff
changeset
|
190 final HgChangeset cset = entry.changeset(); |
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:
417
diff
changeset
|
191 System.out.printf("%d:%s - %s\n", cset.getRevisionIndex(), cset.getNodeid().shortNotation(), cset.getComment()); |
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:
417
diff
changeset
|
192 if (!isJoin && !isFork && !entry.children().isEmpty()) { |
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:
417
diff
changeset
|
193 System.out.printf("\t=> %s\n", sb); |
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:
417
diff
changeset
|
194 } |
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:
417
diff
changeset
|
195 if (isJoin) { |
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:
417
diff
changeset
|
196 HgChangeset p1 = entry.parents().first(); |
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:
417
diff
changeset
|
197 HgChangeset p2 = entry.parents().second(); |
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:
417
diff
changeset
|
198 System.out.printf("\tjoin <= (%d:%s, %d:%s)", p1.getRevisionIndex(), p1.getNodeid().shortNotation(), p2.getRevisionIndex(), p2.getNodeid().shortNotation()); |
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:
417
diff
changeset
|
199 if (isFork) { |
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:
417
diff
changeset
|
200 System.out.print(", "); |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
201 } |
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:
417
diff
changeset
|
202 } |
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:
417
diff
changeset
|
203 if (isFork) { |
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:
417
diff
changeset
|
204 if (!isJoin) { |
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:
417
diff
changeset
|
205 System.out.print('\t'); |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
206 } |
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:
417
diff
changeset
|
207 System.out.printf("fork => [%s]", sb); |
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:
417
diff
changeset
|
208 } |
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:
417
diff
changeset
|
209 if (isJoin || isFork) { |
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:
417
diff
changeset
|
210 System.out.println(); |
317
09628675bcee
Rework file history build approach to match rest of the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
308
diff
changeset
|
211 } |
305
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
212 } |
328
a674b8590362
Move file tree history to upper API level
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
317
diff
changeset
|
213 }); |
305
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
214 } |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
215 |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
216 private void buildFileLogOld() throws Exception { |
305
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
217 final HgDataFile fn = hgRepo.getFileNode("file1"); |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
218 final int[] fileChangesetRevisions = new int[fn.getRevisionCount()]; |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
219 fn.history(new HgChangelog.Inspector() { |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
220 private int fileLocalRevisions = 0; |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
221 private int[] parentRevisions = new int[2]; |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
222 |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
223 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
224 try { |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
225 fileChangesetRevisions[fileLocalRevisions] = revisionNumber; |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
226 fn.parents(fileLocalRevisions, parentRevisions, null, null); |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
227 boolean join = parentRevisions[0] != -1 && parentRevisions[1] != -1; |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
228 if (join) { |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
229 System.out.print("join["); |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
230 } |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
231 if (parentRevisions[0] != -1) { |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
232 System.out.printf("%2d->%2d, ", fileChangesetRevisions[parentRevisions[0]], revisionNumber); |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
233 } |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
234 if (parentRevisions[1] != -1) { |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
235 System.out.printf("%2d->%2d, ", fileChangesetRevisions[parentRevisions[1]], revisionNumber); |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
236 } |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
237 if (join) { |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
238 System.out.print("]"); |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
239 } |
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
240 fileLocalRevisions++; |
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:
417
diff
changeset
|
241 } catch (HgRuntimeException ex) { |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
242 ex.printStackTrace(); |
305
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
243 } |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
244 } |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
245 }); |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
246 System.out.println(); |
ae8d116f4ee2
Experimental code to build file history
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
299
diff
changeset
|
247 } |
243
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
248 |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
249 private void testConsoleLog() { |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
250 LogFacility fc = new StreamLogFacility(true, true, true, System.out); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
251 System.out.printf("isDebug: %s, isInfo:%s\n", fc.isDebug(), fc.isInfo()); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
252 fc.debug(getClass(), "%d", 1); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
253 fc.info(getClass(), "%d\n", 2); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
254 fc.warn(getClass(), "%d\n", 3); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
255 fc.error(getClass(), "%d", 4); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
256 Exception ex = new Exception(); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
257 fc.debug(getClass(), ex, "message"); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
258 fc.info(getClass(), ex, null); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
259 fc.warn(getClass(), ex, null); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
260 fc.error(getClass(), ex, "message"); |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
261 } |
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
290
diff
changeset
|
262 |
254
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
263 private void testTreeTraversal() throws Exception { |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
264 File repoRoot = hgRepo.getWorkingDir(); |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
265 Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), hgRepo.getToRepoPathHelper())); |
425
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
424
diff
changeset
|
266 FileWalker w = new FileWalker(new BasicSessionContext(null, null), repoRoot, pathSrc); |
254
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
267 int count = 0; |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
268 final long start = System.currentTimeMillis(); |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
269 while (w.hasNext()) { |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
270 count++; |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
271 w.next(); |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
272 } |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
273 System.out.printf("Traversal of %d files took %d ms", count, System.currentTimeMillis() - start); |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
274 } |
a620f0663a37
Collect tags for a file - improve performance of 'sparse' manifest reads
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
253
diff
changeset
|
275 |
243
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
276 /* |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
277 * cpython repo with 70715 revisions. |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
278 3 revisions - 80 ms vs 250 ms (250ms init) |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
279 4 revisions - 110 ms vs 265 ms (265 ms init) |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
280 5 revisions - 94 vs 266. |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
366
diff
changeset
|
281 complete iteration in changelog.getRevisionIndex(tipNodeid) takes 47 ms |
243
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
282 compared to complete iteration inside RevisionMap.init() of 171 ms. |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
283 The only difference is latter instantiates Nodeids, while former compares binary content as is. |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
284 Hence, with 20-30 ms per regular getLocalRevision, it pays off to use RevisionMap with at least 15-20 |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
285 queries |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
286 */ |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
287 private void testRevisionMap() throws Exception { |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
288 HgChangelog changelog = hgRepo.getChangelog(); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
289 HgChangelog.RevisionMap rmap = changelog.new RevisionMap().init(); // warm-up, ensure complete file read |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
290 int tip = changelog.getLastRevision(); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
291 // take 5 arbitrary revisions at 0, 1/4, 2/4, 3/4 and 4/4 |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
292 final Nodeid[] revs = new Nodeid[5]; |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
293 revs[4] = changelog.getRevision(0); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
294 revs[3] = changelog.getRevision(tip / 4); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
295 revs[2] = changelog.getRevision(tip / 2); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
296 revs[1] = changelog.getRevision(tip / 4 + tip / 2); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
297 revs[0] = changelog.getRevision(tip); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
298 long start = System.currentTimeMillis(); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
299 for (int i = 0; i < revs.length; i++) { |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
366
diff
changeset
|
300 final int localRev = changelog.getRevisionIndex(revs[i]); |
243
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
301 System.out.printf("%d:%s\n", localRev, revs[i]); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
302 } |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
303 System.out.println(System.currentTimeMillis() - start); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
304 System.out.println(); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
305 // |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
306 start = System.currentTimeMillis(); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
307 rmap = changelog.new RevisionMap().init(); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
308 long s2 = System.currentTimeMillis(); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
309 for (int i = 0; i < revs.length; i++) { |
367
2fadf8695f8a
Use 'revision index' instead of the vague 'local revision number' concept in the API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
366
diff
changeset
|
310 final int localRev = rmap.revisionIndex(revs[i]); |
243
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
311 System.out.printf("%d:%s\n", localRev, revs[i]); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
312 } |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
313 System.out.println(System.currentTimeMillis() - start); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
314 System.out.printf("\t from that, init took %d ms\n", s2 - start); |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
315 |
0e01f9182e16
External cache Nodeid<->int added, Revlog.RevisionMap
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
242
diff
changeset
|
316 } |
239
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
317 |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
318 private void testSubrepos() throws Exception { |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
319 for (HgSubrepoLocation l : hgRepo.getSubrepositories()) { |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
320 System.out.println(l.getLocation()); |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
321 System.out.println(l.getSource()); |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
322 System.out.println(l.getType()); |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
323 System.out.println(l.isCommitted() ? l.getRevision() : "not yet committed"); |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
324 if (l.getType() == Kind.Hg) { |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
325 HgRepository r = l.getRepo(); |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
326 System.out.printf("%s has %d revisions\n", l.getLocation(), r.getChangelog().getLastRevision() + 1); |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
327 if (r.getChangelog().getLastRevision() >= 0) { |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
328 final RawChangeset c = r.getChangelog().range(TIP, TIP).get(0); |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
329 System.out.printf("TIP: %s %s %s\n", c.user(), c.dateString(), c.comment()); |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
330 } |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
331 } |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
332 } |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
333 } |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
334 |
237
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
236
diff
changeset
|
335 private void testReadWorkingCopy() throws Exception { |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
236
diff
changeset
|
336 for (String fname : cmdLineOpts.getList("")) { |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
236
diff
changeset
|
337 HgDataFile fn = hgRepo.getFileNode(fname); |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
236
diff
changeset
|
338 ByteArrayChannel sink = new ByteArrayChannel(); |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
236
diff
changeset
|
339 fn.workingCopy(sink); |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
236
diff
changeset
|
340 System.out.printf("%s: read %d bytes of working copy", fname, sink.toArray().length); |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
236
diff
changeset
|
341 } |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
236
diff
changeset
|
342 } |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
236
diff
changeset
|
343 |
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
344 private void testParents() throws Exception { |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
345 // hg parents cmd |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
346 final Pair<Nodeid, Nodeid> wcParents = hgRepo.getWorkingCopyParents(); |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
347 ChangesetDumpHandler dump = new ChangesetDumpHandler(hgRepo); |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
348 HgLogCommand cmd = new HgLogCommand(hgRepo); |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
349 if (wcParents.hasFirst()) { |
253
1874d11054e5
HgLogCommand.changeset(Nodeid) to ease command configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
252
diff
changeset
|
350 cmd.changeset(wcParents.first()).execute(dump); |
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
351 } |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
352 if (wcParents.hasSecond()) { |
253
1874d11054e5
HgLogCommand.changeset(Nodeid) to ease command configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
252
diff
changeset
|
353 cmd.changeset(wcParents.second()).execute(dump); |
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
354 } |
252
a6d19adc2636
HgRepository.getWorkingCopyBranchName() to retrieve branch associated with working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
249
diff
changeset
|
355 System.out.println("Branch:" + hgRepo.getWorkingCopyBranchName()); |
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
356 } |
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
233
diff
changeset
|
357 |
242
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
358 /* |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
359 * -R \temp\hg\hg4j-50 src/org/tmatesoft/hg/internal/RevlogStream.java |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
360 * |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
361 * -R \temp\hg\cpython Lib/doctest.py, range 15907..68588, total 251 revision |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
362 * no improvement (collect linkRev, hgchangelog.range([])) 10890 ms |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
363 * improved history logic in HgDataFile (minimize reads of close revisions): |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
364 * with no sort (defect for tool-created repos) took 10500 ms |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
365 * with sort (to order revisions from linkRev before use) 610 ms |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
366 * HgChangelog.range() - 92 calls |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
367 * RevlogStream with separate iterate(int[] sortedRevisions,...) |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
368 * RevlogStream.ReaderN1.range(): 185 380 ms |
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
369 */ |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
370 private void testEffectiveFileLog() throws Exception { |
233
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
371 for (String fname : cmdLineOpts.getList("")) { |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
372 System.out.println(fname); |
242
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
373 final long start = System.currentTimeMillis(); |
233
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
374 HgDataFile fn = hgRepo.getFileNode(fname); |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
375 if (fn.exists()) { |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
376 fn.history(new HgChangelog.Inspector() { |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
377 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
378 System.out.printf("%d:%s\n", revisionNumber, nodeid); |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
379 } |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
380 }); |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
381 } |
242
ad6a046943be
Improved reading of sparse revisions from a revlog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
382 System.out.printf("Done: %d\n", System.currentTimeMillis() - start); |
233
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
383 } |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
384 } |
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
385 |
232
b7347daa50e3
Allow to cat a file with changeset revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
386 // TODO as test in TestCat |
b7347daa50e3
Allow to cat a file with changeset revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
387 private void testCatAtCsetRevision() throws Exception { |
b7347daa50e3
Allow to cat a file with changeset revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
388 HgCatCommand cmd = new HgCatCommand(hgRepo); |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
389 final Path file = Path.create("src/org/tmatesoft/hg/internal/RevlogStream.java"); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
390 cmd.file(file); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
391 final Nodeid cset = Nodeid.fromAscii("08db726a0fb7914ac9d27ba26dc8bbf6385a0554"); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
392 cmd.changeset(cset); |
232
b7347daa50e3
Allow to cat a file with changeset revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
393 final ByteArrayChannel sink = new ByteArrayChannel(); |
b7347daa50e3
Allow to cat a file with changeset revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
394 cmd.execute(sink); |
b7347daa50e3
Allow to cat a file with changeset revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
395 System.out.println(sink.toArray().length); |
417
ccd7d25e5aea
New and better name for HgFileInformer - HgChangesetFileSneaker. Explain (comments) ties between HgManifest, HgDataFile, HgChangesetFileSneaker and reasons for method placement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
416
diff
changeset
|
396 HgChangesetFileSneaker i = new HgChangesetFileSneaker(hgRepo); |
362
4937e35b805b
Report dirstate access error with Exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
397 boolean result = i.changeset(cset).checkExists(file); |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
398 Assert.assertFalse(result); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
399 Assert.assertFalse(i.exists()); |
362
4937e35b805b
Report dirstate access error with Exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
360
diff
changeset
|
400 result = i.followRenames(true).checkExists(file); |
248
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
401 Assert.assertTrue(result); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
402 Assert.assertTrue(i.exists()); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
403 HgCatCommand cmd2 = new HgCatCommand(hgRepo).revision(i.getFileRevision()); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
404 final ByteArrayChannel sink2 = new ByteArrayChannel(); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
405 cmd2.execute(sink2); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
406 System.out.println(sink2.toArray().length); |
3fbfce107f94
Issue 8: Means to find out information about given file at specific changeset. Inner ManifestRevisionInspector got promoted to ManifestRevision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
244
diff
changeset
|
407 Assert.assertEquals(sink.toArray().length, sink2.toArray().length); |
232
b7347daa50e3
Allow to cat a file with changeset revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
408 } |
b7347daa50e3
Allow to cat a file with changeset revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
409 |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
410 private void testMergeState() throws Exception { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
411 final HgMergeState mergeState = hgRepo.getMergeState(); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
412 mergeState.refresh(); |
270
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
254
diff
changeset
|
413 System.out.printf("isMerging: %s, isStale: %s.\n", mergeState.isMerging(), mergeState.isStale()); |
c6450b0b1fd5
Avoid IAE:nullid when looking into stale merge/state file
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
254
diff
changeset
|
414 System.out.printf("P1:%s\nP2:%s\nState parent:%s\n",mergeState.getFirstParent().shortNotation(), mergeState.getSecondParent().shortNotation(), mergeState.getStateParent().shortNotation()); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
415 for (HgMergeState.Entry e : mergeState.getConflicts()) { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
416 System.out.println(e.getState() + " " + e.getActualFile()); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
417 System.out.println("p1: " + formatFileRevision(e.getFirstParent())); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
418 System.out.println("p2: " + formatFileRevision(e.getSecondParent())); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
419 System.out.println("ancestor: " + formatFileRevision(e.getCommonAncestor())); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
420 System.out.println(); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
421 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
422 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
423 |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
424 private static String formatFileRevision(HgFileRevision r) throws Exception { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
425 final ByteArrayChannel sink = new ByteArrayChannel(); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
426 r.putContentTo(sink); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
427 return String.format("%s %s (%d bytes)", r.getPath(), r.getRevision(), sink.toArray().length); |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
428 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
429 |
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:
417
diff
changeset
|
430 private void testFileStatus() throws Exception { |
226
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
222
diff
changeset
|
431 // final Path path = Path.create("src/org/tmatesoft/hg/util/"); |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
226
diff
changeset
|
432 // final Path path = Path.create("src/org/tmatesoft/hg/internal/Experimental.java"); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
433 // final Path path = Path.create("missing-dir/"); |
229
1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
226
diff
changeset
|
434 // HgWorkingCopyStatusCollector wcsc = HgWorkingCopyStatusCollector.create(hgRepo, path); |
233
1d389c0cb0a5
Optimize file history walk not to iterat over whole changelog for sparse and distant revisions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
232
diff
changeset
|
435 HgWorkingCopyStatusCollector wcsc = HgWorkingCopyStatusCollector.create(hgRepo, new PathGlobMatcher("mi**")); |
226
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
222
diff
changeset
|
436 wcsc.walk(TIP, new StatusDump()); |
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
222
diff
changeset
|
437 } |
26ad7827a62d
Support status query for a single file or a subdirectory of a repository
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
222
diff
changeset
|
438 |
236
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
439 /* |
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
440 * Straightforward approach to collect branches, no use of branchheads.cache |
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
441 * First, single run - 18 563 |
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
442 * 10 runs (after 1 warm up) of HgBranches.collect took 167391 ms, ~17 seconds per run. |
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
443 */ |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
444 private void dumpBranches() throws Exception { |
236
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
445 final long start0 = System.currentTimeMillis(); |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
197
diff
changeset
|
446 HgBranches b = hgRepo.getBranches(); |
236
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
447 System.out.println("1:" + (System.currentTimeMillis() - start0)); |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
197
diff
changeset
|
448 for (HgBranches.BranchInfo bi : b.getAllBranches()) { |
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
197
diff
changeset
|
449 System.out.print(bi.getName()); |
236
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
450 // System.out.print(" "); |
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
451 // System.out.print(bi.getStart()); |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
197
diff
changeset
|
452 System.out.print(" "); |
308
3f40262153a4
Recognize closed branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
305
diff
changeset
|
453 System.out.print(bi.getHeads()); |
3f40262153a4
Recognize closed branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
305
diff
changeset
|
454 if (bi.isClosed()) { |
3f40262153a4
Recognize closed branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
305
diff
changeset
|
455 System.out.print(" x "); |
3f40262153a4
Recognize closed branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
305
diff
changeset
|
456 } |
3f40262153a4
Recognize closed branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
305
diff
changeset
|
457 System.out.println(); |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
197
diff
changeset
|
458 } |
308
3f40262153a4
Recognize closed branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
305
diff
changeset
|
459 // b.writeCache(); |
236
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
460 // final long start = System.currentTimeMillis(); |
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
461 // for (int i = 0; i < 10; i++) { |
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
462 // b.collect(ProgressSupport.Factory.get(null)); |
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
463 // } |
883300108179
Speed up branches calculation when cached branch information is available
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
464 // System.out.println("10:" + (System.currentTimeMillis() - start)); |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
197
diff
changeset
|
465 } |
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
197
diff
changeset
|
466 |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
467 private void inflaterLengthException() throws Exception { |
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
468 HgDataFile f1 = hgRepo.getFileNode("src/com/tmate/hgkit/console/Bundle.java"); |
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
469 HgDataFile f2 = hgRepo.getFileNode("test-repos.jar"); |
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
470 System.out.println(f1.isCopy()); |
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
471 System.out.println(f2.isCopy()); |
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
472 ByteArrayChannel bac = new ByteArrayChannel(); |
158
b413b16d10a5
Integer offsets and file length explictly, rather than casts throughout code. Inflater may benefit from total length hint, but shall calculate it by its own if needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
157
diff
changeset
|
473 f1.content(1, bac); // 0: 1151, 1: 1139 |
b413b16d10a5
Integer offsets and file length explictly, rather than casts throughout code. Inflater may benefit from total length hint, but shall calculate it by its own if needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
157
diff
changeset
|
474 System.out.println(bac.toArray().length); |
b413b16d10a5
Integer offsets and file length explictly, rather than casts throughout code. Inflater may benefit from total length hint, but shall calculate it by its own if needed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
157
diff
changeset
|
475 f2.content(0, bac = new ByteArrayChannel()); // 0: 14269 |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
476 System.out.println(bac.toArray().length); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
477 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
478 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
479 private void dumpIgnored() { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
480 String[] toCheck = new String[] {"design.txt", "src/com/tmate/hgkit/ll/Changelog.java", "src/Extras.java", "bin/com/tmate/hgkit/ll/Changelog.class"}; |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
328
diff
changeset
|
481 HgIgnore ignore = hgRepo.getIgnore(); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
482 for (int i = 0; i < toCheck.length; i++) { |
339
863356c2847e
Issue 16: respect glob patterns in HgIgnore for sub-directories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
328
diff
changeset
|
483 System.out.println("Ignored " + toCheck[i] + ": " + ignore.isIgnored(Path.create(toCheck[i]))); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
484 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
485 } |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
486 |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
487 static class DirstateDump implements HgDirstate.Inspector { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
488 private final char[] x = new char[] {'n', 'a', 'r', 'm' }; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
489 |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
490 public boolean next(EntryKind kind, Record entry) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
491 System.out.printf("%c %3o%6d %30tc\t\t%s", x[kind.ordinal()], entry.mode(), entry.size(), (long) entry.modificationTime() * 1000, entry.name()); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
492 if (entry.copySource() != null) { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
493 System.out.printf(" --> %s", entry.copySource()); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
494 } |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
495 System.out.println(); |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
496 return true; |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
497 } |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
498 } |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
499 |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
500 private void dumpDirstate() throws Exception { |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
345
diff
changeset
|
501 new HgInternals(hgRepo).getDirstate().walk(new DirstateDump()); |
290
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
502 HgWorkingCopyStatusCollector wcc = HgWorkingCopyStatusCollector.create(hgRepo, new Path.Matcher.Any()); |
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
503 wcc.getDirstate().walk(new HgDirstate.Inspector() { |
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
504 |
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
505 public boolean next(EntryKind kind, Record entry) { |
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
506 System.out.printf("%s %s\n", kind, entry.name()); |
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
507 return true; |
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
508 } |
8faad08c709b
Expose dirstate to allow pre-configuration of FileIterators for status collection in particular
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
285
diff
changeset
|
509 }); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
510 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
511 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
512 |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
513 private void catCompleteHistory() throws Exception { |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
514 DigestHelper dh = new DigestHelper(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
515 for (String fname : cmdLineOpts.getList("")) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
516 System.out.println(fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
517 HgDataFile fn = hgRepo.getFileNode(fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
518 if (fn.exists()) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
519 int total = fn.getRevisionCount(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
520 System.out.printf("Total revisions: %d\n", total); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
521 for (int i = 0; i < total; i++) { |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
522 ByteArrayChannel sink = new ByteArrayChannel(); |
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
523 fn.content(i, sink); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
524 System.out.println("==========>"); |
157
d5268ca7715b
Merged branch wrap-data-access into default for resource-friendly data access. Updated API to promote that friendliness to clients (channels, not byte[]). More exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
143
diff
changeset
|
525 byte[] content = sink.toArray(); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
526 System.out.println(new String(content)); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
527 int[] parentRevisions = new int[2]; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
528 byte[] parent1 = new byte[20]; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
529 byte[] parent2 = new byte[20]; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
530 fn.parents(i, parentRevisions, parent1, parent2); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
531 System.out.println(dh.sha1(parent1, parent2, content).asHexString()); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
532 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
533 } else { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
534 System.out.println(">>>Not found!"); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
535 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
536 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
537 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
538 |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
539 private void dumpCompleteManifestLow() throws Exception { |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
540 hgRepo.getManifest().walk(0, TIP, new ManifestDump()); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
541 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
542 |
424
6437d261048a
Deprecated code removed
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
543 public static final class ManifestDump implements HgManifest.Inspector { |
222
373e07cd3991
Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
220
diff
changeset
|
544 public boolean begin(int manifestRevision, Nodeid nid, int changelogRevision) { |
373e07cd3991
Due to discrepancy in manifest and changelor indexes, wrong manifest revisions got cached and compared
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
220
diff
changeset
|
545 System.out.printf("%d : %s\n", manifestRevision, nid); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
546 return true; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
547 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
548 |
285
6dbbc53fc46d
Use Path instead of plain String for manifest file names
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
281
diff
changeset
|
549 public boolean next(Nodeid nid, Path fname, Flags flags) { |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
550 System.out.println(nid + "\t" + fname + "\t\t" + flags); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
551 return true; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
552 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
553 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
554 public boolean end(int revision) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
555 System.out.println(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
556 return true; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
557 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
558 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
559 |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
362
diff
changeset
|
560 private void dumpCompleteManifestHigh() throws Exception { |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
561 new HgManifestCommand(hgRepo).dirs(true).execute(new HgManifestCommand.Handler() { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
562 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
563 public void begin(Nodeid manifestRevision) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
564 System.out.println(">> " + manifestRevision); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
565 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
566 public void dir(Path p) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
567 System.out.println(p); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
568 } |
249
4c3b9f679412
Deprecated HgLogCommand.FileRevision gone, top-level HgFileRevision is bright and shiny replacement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
248
diff
changeset
|
569 public void file(HgFileRevision fileRevision) { |
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:
417
diff
changeset
|
570 System.out.print(fileRevision.getRevision());; |
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:
417
diff
changeset
|
571 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:
417
diff
changeset
|
572 System.out.printf("%s %s", fileRevision.getParents().first().shortNotation(), fileRevision.getParents().second().shortNotation()); |
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:
417
diff
changeset
|
573 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:
417
diff
changeset
|
574 System.out.println(fileRevision.getPath()); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
575 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
576 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
577 public void end(Nodeid manifestRevision) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
578 System.out.println(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
579 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
580 }); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
581 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
582 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
583 private void bunchOfTests() throws Exception { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
584 final StatusDump dump = new StatusDump(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
585 dump.showIgnored = false; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
586 dump.showClean = false; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
587 HgStatusCollector sc = new HgStatusCollector(hgRepo); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
588 final int r1 = 0, r2 = 3; |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
589 System.out.printf("Status for changes between revision %d and %d:\n", r1, r2); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
590 sc.walk(r1, r2, dump); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
591 // |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
592 System.out.println("\n\nSame, but sorted in the way hg status does:"); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
593 HgStatusCollector.Record r = sc.status(r1, r2); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
594 sortAndPrint('M', r.getModified(), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
595 sortAndPrint('A', r.getAdded(), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
596 sortAndPrint('R', r.getRemoved(), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
597 // |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
598 System.out.println("\n\nTry hg status --change <rev>:"); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
599 sc.change(0, dump); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
600 System.out.println("\nStatus against working dir:"); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
601 HgWorkingCopyStatusCollector wcc = new HgWorkingCopyStatusCollector(hgRepo); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
602 wcc.walk(TIP, dump); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
603 System.out.println(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
604 System.out.printf("Manifest of the revision %d:\n", r2); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
605 hgRepo.getManifest().walk(r2, r2, new ManifestDump()); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
606 System.out.println(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
607 System.out.printf("\nStatus of working dir against %d:\n", r2); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
608 r = wcc.status(r2); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
609 sortAndPrint('M', r.getModified(), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
610 sortAndPrint('A', r.getAdded(), r.getCopied()); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
611 sortAndPrint('R', r.getRemoved(), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
612 sortAndPrint('?', r.getUnknown(), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
613 sortAndPrint('I', r.getIgnored(), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
614 sortAndPrint('C', r.getClean(), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
615 sortAndPrint('!', r.getMissing(), null); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
616 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
617 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
618 private void sortAndPrint(char prefix, List<Path> ul, Map<Path, Path> copies) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
619 ArrayList<Path> sortList = new ArrayList<Path>(ul); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
620 Collections.sort(sortList); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
621 for (Path s : sortList) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
622 System.out.print(prefix); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
623 System.out.print(' '); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
624 System.out.println(s); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
625 if (copies != null && copies.containsKey(s)) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
626 System.out.println(" " + copies.get(s)); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
627 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
628 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
629 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
630 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
631 |
354
5f9073eabf06
Propagate errors with exceptions up to a end client
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
350
diff
changeset
|
632 private void testStatusInternals() throws HgException { |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
633 HgDataFile n = hgRepo.getFileNode(Path.create("design.txt")); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
634 for (String s : new String[] {"011dfd44417c72bd9e54cf89b82828f661b700ed", "e5529faa06d53e06a816e56d218115b42782f1ba", "c18e7111f1fc89a80a00f6a39d51288289a382fc"}) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
635 // expected: 359, 2123, 3079 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
636 byte[] b = s.getBytes(); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
637 final Nodeid nid = Nodeid.fromAscii(b, 0, b.length); |
416
d30083c80d52
Better names - non-confusing and aligned with the rest of API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
415
diff
changeset
|
638 System.out.println(s + " : " + n.getLength(nid)); |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
639 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
640 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
641 |
197
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
158
diff
changeset
|
642 static void force_gc() { |
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
158
diff
changeset
|
643 Runtime.getRuntime().runFinalization(); |
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
158
diff
changeset
|
644 Runtime.getRuntime().gc(); |
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
158
diff
changeset
|
645 Thread.yield(); |
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
158
diff
changeset
|
646 Runtime.getRuntime().runFinalization(); |
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
158
diff
changeset
|
647 Runtime.getRuntime().gc(); |
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
158
diff
changeset
|
648 Thread.yield(); |
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
158
diff
changeset
|
649 } |
3a7696fb457c
Investigate optimization options to allow fast processing of huge repositories. Fix defect in StatusCollector that lead to wrong result comparing first revision to empty repo (-1 to 0), due to same TIP constant value
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
158
diff
changeset
|
650 |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
651 private static class StatusDump implements HgStatusInspector { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
652 public boolean hideStatusPrefix = false; // hg status -n option |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
653 public boolean showCopied = true; // -C |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
654 public boolean showIgnored = true; // -i |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
655 public boolean showClean = true; // -c |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
656 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
657 public void modified(Path fname) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
658 print('M', fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
659 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
660 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
661 public void added(Path fname) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
662 print('A', fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
663 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
664 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
665 public void copied(Path fnameOrigin, Path fnameAdded) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
666 added(fnameAdded); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
667 if (showCopied) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
668 print(' ', fnameOrigin); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
669 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
670 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
671 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
672 public void removed(Path fname) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
673 print('R', fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
674 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
675 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
676 public void clean(Path fname) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
677 if (showClean) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
678 print('C', fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
679 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
680 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
681 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
682 public void missing(Path fname) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
683 print('!', fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
684 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
685 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
686 public void unknown(Path fname) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
687 print('?', fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
688 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
689 |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
690 public void ignored(Path fname) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
691 if (showIgnored) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
692 print('I', fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
693 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
694 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
695 |
360
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
696 public void invalid(Path fname, Exception ex) { |
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
697 System.out.printf("FAILURE: %s\n", fname); |
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
698 ex.printStackTrace(System.out); |
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
699 } |
150500515714
Report non-critical errors during status operation to handler/inspector
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
354
diff
changeset
|
700 |
143
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
701 private void print(char status, Path fname) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
702 if (!hideStatusPrefix) { |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
703 System.out.print(status); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
704 System.out.print(' '); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
705 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
706 System.out.println(fname); |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
707 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
708 } |
b9700740553a
Command line tools parse and respect most of command-line arguments
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
709 } |