Mercurial > jhg
annotate src/org/tmatesoft/hg/repo/HgRepository.java @ 503:0bd2d0441d8f
Add lookup of remote paths from repository's .hg/hgrc, respect default (origin)
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 31 Oct 2012 15:17:21 +0100 |
parents | d2f6ab541330 |
children | bf352ce2b97f |
rev | line source |
---|---|
10
382cfe9463db
Dirstate parsing. DataAccess refactored to allow reuse and control over constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
9
diff
changeset
|
1 /* |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
2 * Copyright (c) 2010-2012 TMate Software Ltd |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
3 * |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
7 * |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
11 * GNU General Public License for more details. |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
12 * |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
13 * For information on how to redistribute this software under |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
102
a3a2e5deb320
Updated contact address to support@hg4j.com
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
97
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
17 package org.tmatesoft.hg.repo; |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
18 |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
19 import static org.tmatesoft.hg.repo.HgRepositoryFiles.*; |
456
909306e412e2
Refactor LogFacility and SessionContext, better API for both
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
20 import static org.tmatesoft.hg.util.LogFacility.Severity.*; |
909306e412e2
Refactor LogFacility and SessionContext, better API for both
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
431
diff
changeset
|
21 |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
22 import java.io.File; |
481
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
23 import java.io.FileReader; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
24 import java.io.IOException; |
234
b2cfbe46f9b6
HgTags got TagInfo to access tags. Tags are read from all branches/revisions now, not only working copy
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
25 import java.io.StringReader; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
26 import java.lang.ref.SoftReference; |
481
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
27 import java.nio.CharBuffer; |
114
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
28 import java.util.ArrayList; |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
29 import java.util.Collections; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
30 import java.util.HashMap; |
114
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
31 import java.util.List; |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
32 |
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
234
diff
changeset
|
33 import org.tmatesoft.hg.core.Nodeid; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
292
diff
changeset
|
34 import org.tmatesoft.hg.core.SessionContext; |
234
b2cfbe46f9b6
HgTags got TagInfo to access tags. Tags are read from all branches/revisions now, not only working copy
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
35 import org.tmatesoft.hg.internal.ByteArrayChannel; |
114
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
36 import org.tmatesoft.hg.internal.ConfigFile; |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
37 import org.tmatesoft.hg.internal.Experimental; |
114
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
38 import org.tmatesoft.hg.internal.Filter; |
407
30922c728341
Better multiline log printout; options to tune default log output
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
388
diff
changeset
|
39 import org.tmatesoft.hg.internal.Internals; |
77
c677e1593919
Moved RevlogStream implementation into .internal
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
74
diff
changeset
|
40 import org.tmatesoft.hg.internal.RevlogStream; |
239
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
41 import org.tmatesoft.hg.internal.SubrepoManager; |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
42 import org.tmatesoft.hg.repo.ext.HgExtensionsManager; |
234
b2cfbe46f9b6
HgTags got TagInfo to access tags. Tags are read from all branches/revisions now, not only working copy
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
43 import org.tmatesoft.hg.util.CancelledException; |
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
234
diff
changeset
|
44 import org.tmatesoft.hg.util.Pair; |
133
4a948ec83980
core.Path to util.Path as it's not Hg repo dependant
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
115
diff
changeset
|
45 import org.tmatesoft.hg.util.Path; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
55
diff
changeset
|
46 import org.tmatesoft.hg.util.PathRewrite; |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
47 import org.tmatesoft.hg.util.ProgressSupport; |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
55
diff
changeset
|
48 |
1
a3576694a4d1
Repository detection from local/specified directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
49 |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
50 |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
51 /** |
64
19e9e220bf68
Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
55
diff
changeset
|
52 * Shall be as state-less as possible, all the caching happens outside the repo, in commands/walkers |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
53 * |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
54 * @author Artem Tikhomirov |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
55 * @author TMate Software Ltd. |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
56 */ |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
57 public final class HgRepository implements SessionContext.Source { |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
58 |
405
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
59 // IMPORTANT: if new constants added, consider fixing HgInternals#wrongRevisionIndex and HgInvalidRevisionException#getMessage |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
60 |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
61 /** |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
62 * Revision index constant to indicate most recent revision |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
63 */ |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
64 public static final int TIP = -3; // XXX TIP_REVISION? |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
65 |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
66 /** |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
67 * Revision index constant to indicate invalid revision index value. |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
68 * Primary use is default/uninitialized values where user input is expected and as return value where |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
69 * an exception (e.g. {@link HgInvalidRevisionException}) is not desired |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
70 */ |
403
2747b0723867
FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
396
diff
changeset
|
71 public static final int BAD_REVISION = Integer.MIN_VALUE; // XXX INVALID_REVISION? |
405
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
72 |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
73 /** |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
74 * Revision index constant to indicate working copy |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
75 */ |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
76 public static final int WORKING_COPY = -2; // XXX WORKING_COPY_REVISION? |
252
a6d19adc2636
HgRepository.getWorkingCopyBranchName() to retrieve branch associated with working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
77 |
405
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
78 /** |
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:
421
diff
changeset
|
79 * Constant ({@value #NO_REVISION}) to indicate revision absence or a fictitious revision of an empty repository. |
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:
421
diff
changeset
|
80 * |
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:
421
diff
changeset
|
81 * <p>Revision absence is vital e.g. for missing parent from {@link HgChangelog#parents(int, int[], byte[], byte[])} call and |
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:
421
diff
changeset
|
82 * to report cases when changeset records no corresponding manifest |
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:
421
diff
changeset
|
83 * revision {@link HgManifest#walk(int, int, org.tmatesoft.hg.repo.HgManifest.Inspector)}. |
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:
421
diff
changeset
|
84 * |
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:
421
diff
changeset
|
85 * <p> Use as imaginary revision/empty repository is handy as an argument (contrary to {@link #BAD_REVISION}) |
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:
421
diff
changeset
|
86 * e.g in a status operation to visit changes from the very beginning of a repository. |
405
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
87 */ |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
88 public static final int NO_REVISION = -1; |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
89 |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
90 /** |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
91 * Name of the primary branch, "default". |
866fc3b597a0
Add an explicit constant instead of -1 to indicate 'no revision' case
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
403
diff
changeset
|
92 */ |
252
a6d19adc2636
HgRepository.getWorkingCopyBranchName() to retrieve branch associated with working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
93 public static final String DEFAULT_BRANCH_NAME = "default"; |
5
fc265ddeab26
File content and non-effective, although working, patch application
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
3
diff
changeset
|
94 |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
95 // temp aux marker method |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
96 public static IllegalStateException notImplemented() { |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
97 return new IllegalStateException("Not implemented"); |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
98 } |
148
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
145
diff
changeset
|
99 |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
100 private final File repoDir; // .hg folder |
237
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
101 private final File workingDir; // .hg/../ |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
102 private final String repoLocation; |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
103 /* |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
104 * normalized slashes but otherwise regular file names |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
105 * the only front-end path rewrite, kept here as rest of the library shall |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
106 * not bother with names normalization. |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
107 */ |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
108 private final PathRewrite normalizePath; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
292
diff
changeset
|
109 private final SessionContext sessionContext; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
110 |
97
ee2c750b036d
Changelog to HgChangelog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
91
diff
changeset
|
111 private HgChangelog changelog; |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
112 private HgManifest manifest; |
50
f1db8610da62
Log to consult (placeholder, for now) class to find out associated tags
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
45
diff
changeset
|
113 private HgTags tags; |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
114 private HgBranches branches; |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
115 private HgMergeState mergeState; |
239
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
116 private SubrepoManager subRepos; |
484
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
117 private HgBookmarks bookmarks; |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
118 private HgExtensionsManager extManager; |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
119 |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
120 // XXX perhaps, shall enable caching explicitly |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
121 private final HashMap<Path, SoftReference<RevlogStream>> streamsCache = new HashMap<Path, SoftReference<RevlogStream>>(); |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
122 |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
123 private final org.tmatesoft.hg.internal.Internals impl; |
91
c2ce1cfaeb9e
ignore file with regex and 'honest' glob support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
77
diff
changeset
|
124 private HgIgnore ignore; |
331
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
125 private HgRepoConfig repoConfig; |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
126 |
430
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
127 /* |
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
128 * TODO [post-1.0] move to a better place, e.g. WorkingCopy container that tracks both dirstate and branches |
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
129 * (and, perhaps, undo, lastcommit and other similar information), and is change listener so that we don't need to |
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
130 * worry about this cached value become stale |
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
131 */ |
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
132 private String wcBranch; |
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
133 |
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
134 |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
135 HgRepository(String repositoryPath) { |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
136 repoDir = null; |
237
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
137 workingDir = null; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
138 repoLocation = repositoryPath; |
142
37a34044e6bd
More reasonable use of path normalizer and path.source
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
141
diff
changeset
|
139 normalizePath = null; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
292
diff
changeset
|
140 sessionContext = null; |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
141 impl = null; |
1
a3576694a4d1
Repository detection from local/specified directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
142 } |
a3576694a4d1
Repository detection from local/specified directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
143 |
425
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
144 /** |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
145 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
146 */ |
48f993aa2f41
FIXMEs: exceptions, javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
423
diff
changeset
|
147 HgRepository(SessionContext ctx, String repositoryPath, File repositoryRoot) throws HgRuntimeException { |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
148 assert ".hg".equals(repositoryRoot.getName()) && repositoryRoot.isDirectory(); |
148
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
145
diff
changeset
|
149 assert repositoryPath != null; |
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
145
diff
changeset
|
150 assert repositoryRoot != null; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
292
diff
changeset
|
151 assert ctx != null; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
152 repoDir = repositoryRoot; |
237
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
153 workingDir = repoDir.getParentFile(); |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
154 if (workingDir == null) { |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
155 throw new IllegalArgumentException(repoDir.toString()); |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
156 } |
148
1a7a9a20e1f9
Exceptions, javadoc. Initial cancel and progress support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
145
diff
changeset
|
157 repoLocation = repositoryPath; |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
292
diff
changeset
|
158 sessionContext = ctx; |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
159 impl = new org.tmatesoft.hg.internal.Internals(this, repositoryRoot); |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
160 normalizePath = impl.buildNormalizePathRewrite(); |
1
a3576694a4d1
Repository detection from local/specified directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
161 } |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
162 |
145
acc6151b1b7a
toString for friendly debug
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
142
diff
changeset
|
163 @Override |
acc6151b1b7a
toString for friendly debug
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
142
diff
changeset
|
164 public String toString() { |
acc6151b1b7a
toString for friendly debug
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
142
diff
changeset
|
165 return getClass().getSimpleName() + "[" + getLocation() + (isInvalid() ? "(BAD)" : "") + "]"; |
acc6151b1b7a
toString for friendly debug
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
142
diff
changeset
|
166 } |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
167 |
491
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
168 /** |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
169 * Path to repository which has been used to initialize this instance. The value is always present, even |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
170 * if no repository has been found at that location ({@link #isInvalid()} is <code>true</code>) and serves |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
171 * as an extra description of the failure. |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
172 * |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
173 * <p> It's important to understand this is purely descriptive attribute, it's kept as close as possible to |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
174 * original value users supply to {@link HgLookup}. To get actual repository location, use methods that |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
175 * provide {@link File}, e.g. {@link #getWorkingDir()} |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
176 * |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
177 * @return repository location information, never <code>null</code> |
4a670f76e7d1
Javadoc for HgRepository#getLocation()
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
490
diff
changeset
|
178 */ |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
179 public String getLocation() { |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
180 return repoLocation; |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
181 } |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
182 |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
183 public boolean isInvalid() { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
184 return impl == null || impl.isInvalid(); |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
185 } |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
186 |
97
ee2c750b036d
Changelog to HgChangelog
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
91
diff
changeset
|
187 public HgChangelog getChangelog() { |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
188 if (changelog == null) { |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
189 File chlogFile = impl.getFileFromStoreDir("00changelog.i"); |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
190 if (!chlogFile.exists()) { |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
191 // fake its existence |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
192 chlogFile = fakeNonExistentFile(chlogFile); |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
193 } |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
194 RevlogStream content = new RevlogStream(impl.getDataAccess(), chlogFile); |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
195 changelog = new HgChangelog(this, content); |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
196 } |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
197 return changelog; |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
198 } |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
199 |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
200 public HgManifest getManifest() { |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
201 if (manifest == null) { |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
202 File manifestFile = impl.getFileFromStoreDir("00manifest.i"); |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
203 if (!manifestFile.exists()) { |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
204 manifestFile = fakeNonExistentFile(manifestFile); |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
205 } |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
206 RevlogStream content = new RevlogStream(impl.getDataAccess(), manifestFile); |
412
63c5a9d7ca3f
Follow-up for Issue 29: unify path translation for manifest and dirstate
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
207 manifest = new HgManifest(this, content, impl.buildFileNameEncodingHelper()); |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
208 } |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
209 return manifest; |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
210 } |
50
f1db8610da62
Log to consult (placeholder, for now) class to find out associated tags
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
45
diff
changeset
|
211 |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
212 /** |
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
213 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
214 */ |
318
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
215 public HgTags getTags() throws HgInvalidControlFileException { |
50
f1db8610da62
Log to consult (placeholder, for now) class to find out associated tags
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
45
diff
changeset
|
216 if (tags == null) { |
234
b2cfbe46f9b6
HgTags got TagInfo to access tags. Tags are read from all branches/revisions now, not only working copy
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
217 tags = new HgTags(this); |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
218 HgDataFile hgTags = getFileNode(HgTags.getPath()); |
318
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
219 if (hgTags.exists()) { |
418
528b6780a8bd
A bit of FIXME cleanup (mostly degraded to TODO post 1.0), comments and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
414
diff
changeset
|
220 for (int i = 0; i <= hgTags.getLastRevision(); i++) { // TODO post-1.0 in fact, would be handy to have walk(start,end) |
318
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
221 // method for data files as well, though it looks odd. |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
222 try { |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
223 ByteArrayChannel sink = new ByteArrayChannel(); |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
224 hgTags.content(i, sink); |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
225 final String content = new String(sink.toArray(), "UTF8"); |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
226 tags.readGlobal(new StringReader(content)); |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
227 } catch (CancelledException ex) { |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
228 // IGNORE, can't happen, we did not configure cancellation |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
229 getSessionContext().getLog().dump(getClass(), Debug, ex, null); |
318
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
230 } catch (IOException ex) { |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
231 // UnsupportedEncodingException can't happen (UTF8) |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
232 // only from readGlobal. Need to reconsider exceptions thrown from there: |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
233 // BufferedReader wraps String and unlikely to throw IOException, perhaps, log is enough? |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
234 getSessionContext().getLog().dump(getClass(), Error, ex, null); |
318
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
235 // XXX need to decide what to do this. failure to read single revision shall not break complete cycle |
234
b2cfbe46f9b6
HgTags got TagInfo to access tags. Tags are read from all branches/revisions now, not only working copy
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
236 } |
b2cfbe46f9b6
HgTags got TagInfo to access tags. Tags are read from all branches/revisions now, not only working copy
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
231
diff
changeset
|
237 } |
318
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
238 } |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
239 File file2read = null; |
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
240 try { |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
241 file2read = new File(getWorkingDir(), HgTags.getPath()); |
318
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
242 tags.readGlobal(file2read); // XXX replace with HgDataFile.workingCopy |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
243 file2read = impl.getFileFromRepoDir(HgLocalTags.getName()); // XXX pass internalrepo to readLocal, keep filename there |
318
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
244 tags.readLocal(file2read); |
104
54562de502f7
Preliminary tags implementation
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
245 } catch (IOException ex) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
246 getSessionContext().getLog().dump(getClass(), Error, ex, null); |
318
c3d2233ba842
Shall propagate errors to clients, not work around them silently
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
295
diff
changeset
|
247 throw new HgInvalidControlFileException("Failed to read tags", ex, file2read); |
104
54562de502f7
Preliminary tags implementation
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
102
diff
changeset
|
248 } |
50
f1db8610da62
Log to consult (placeholder, for now) class to find out associated tags
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
45
diff
changeset
|
249 } |
f1db8610da62
Log to consult (placeholder, for now) class to find out associated tags
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
45
diff
changeset
|
250 return tags; |
f1db8610da62
Log to consult (placeholder, for now) class to find out associated tags
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
45
diff
changeset
|
251 } |
f1db8610da62
Log to consult (placeholder, for now) class to find out associated tags
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
45
diff
changeset
|
252 |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
253 /** |
484
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
254 * Access branch information |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
255 * @return branch manager instance, never <code>null</code> |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
256 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
257 */ |
366
189dc6dc1c3e
Use exceptions to expose errors reading mercurial data
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
348
diff
changeset
|
258 public HgBranches getBranches() throws HgInvalidControlFileException { |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
259 if (branches == null) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
260 branches = new HgBranches(impl); |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
261 branches.collect(ProgressSupport.Factory.get(null)); |
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
262 } |
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
263 return branches; |
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
264 } |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
265 |
484
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
266 /** |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
267 * Access state of the recent merge |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
268 * @return merge state facility, never <code>null</code> |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
269 */ |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
270 public HgMergeState getMergeState() { |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
271 if (mergeState == null) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
272 mergeState = new HgMergeState(impl); |
231
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
273 } |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
274 return mergeState; |
1792b37650f2
Introduced access to conflict resolution information (merge state)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
229
diff
changeset
|
275 } |
220
8de327242aa0
Basic information about branches
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
202
diff
changeset
|
276 |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
277 public HgDataFile getFileNode(String path) { |
292
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
289
diff
changeset
|
278 CharSequence nPath = normalizePath.rewrite(path); |
115
c0cc2535462c
Introduced channels to pipeline (and easily filter) data streams
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
114
diff
changeset
|
279 Path p = Path.create(nPath); |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
280 return getFileNode(p); |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
281 } |
1
a3576694a4d1
Repository detection from local/specified directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
0
diff
changeset
|
282 |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
283 public HgDataFile getFileNode(Path path) { |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
284 RevlogStream content = resolveStoreFile(path); |
115
c0cc2535462c
Introduced channels to pipeline (and easily filter) data streams
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
114
diff
changeset
|
285 if (content == null) { |
c0cc2535462c
Introduced channels to pipeline (and easily filter) data streams
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
114
diff
changeset
|
286 return new HgDataFile(this, path); |
c0cc2535462c
Introduced channels to pipeline (and easily filter) data streams
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
114
diff
changeset
|
287 } |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
288 return new HgDataFile(this, path, content); |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
289 } |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
290 |
142
37a34044e6bd
More reasonable use of path normalizer and path.source
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
141
diff
changeset
|
291 /* clients need to rewrite path from their FS to a repository-friendly paths, and, perhaps, vice versa*/ |
37a34044e6bd
More reasonable use of path normalizer and path.source
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
141
diff
changeset
|
292 public PathRewrite getToRepoPathHelper() { |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
293 return normalizePath; |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
294 } |
284
7232b94f2ae3
HgDirstate shall operate with Path instead of String for file names. Use of Pair instead of array of unspecified length for parents.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
280
diff
changeset
|
295 |
7232b94f2ae3
HgDirstate shall operate with Path instead of String for file names. Use of Pair instead of array of unspecified length for parents.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
280
diff
changeset
|
296 /** |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
337
diff
changeset
|
297 * @return pair of values, {@link Pair#first()} and {@link Pair#second()} are respective parents, never <code>null</code>. |
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
337
diff
changeset
|
298 * @throws HgInvalidControlFileException if attempt to read information about working copy parents from dirstate failed |
284
7232b94f2ae3
HgDirstate shall operate with Path instead of String for file names. Use of Pair instead of array of unspecified length for parents.
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
280
diff
changeset
|
299 */ |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
337
diff
changeset
|
300 public Pair<Nodeid,Nodeid> getWorkingCopyParents() throws HgInvalidControlFileException { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
301 return HgDirstate.readParents(impl); |
235
fd845a53f53d
Experimental access to working dir parents
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
234
diff
changeset
|
302 } |
252
a6d19adc2636
HgRepository.getWorkingCopyBranchName() to retrieve branch associated with working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
303 |
a6d19adc2636
HgRepository.getWorkingCopyBranchName() to retrieve branch associated with working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
304 /** |
a6d19adc2636
HgRepository.getWorkingCopyBranchName() to retrieve branch associated with working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
305 * @return name of the branch associated with working directory, never <code>null</code>. |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
337
diff
changeset
|
306 * @throws HgInvalidControlFileException if attempt to read branch name failed. |
252
a6d19adc2636
HgRepository.getWorkingCopyBranchName() to retrieve branch associated with working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
307 */ |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
337
diff
changeset
|
308 public String getWorkingCopyBranchName() throws HgInvalidControlFileException { |
430
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
309 if (wcBranch == null) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
310 wcBranch = HgDirstate.readBranch(impl); |
430
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
311 } |
d280759c2a3f
branch information is not directly related to dirstate, clean API from this dependency
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
425
diff
changeset
|
312 return wcBranch; |
252
a6d19adc2636
HgRepository.getWorkingCopyBranchName() to retrieve branch associated with working directory
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
239
diff
changeset
|
313 } |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
314 |
237
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
315 /** |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
316 * @return location where user files (shall) reside |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
317 */ |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
318 public File getWorkingDir() { |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
319 return workingDir; |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
320 } |
239
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
321 |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
322 /** |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
323 * Provides access to sub-repositories defined in this repository. Enumerated sub-repositories are those directly |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
324 * known, not recursive collection of all nested sub-repositories. |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
325 * @return list of all known sub-repositories in this repository, or empty list if none found. |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
326 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
239
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
327 */ |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
337
diff
changeset
|
328 public List<HgSubrepoLocation> getSubrepositories() throws HgInvalidControlFileException { |
239
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
329 if (subRepos == null) { |
df9d2854d3d6
Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
237
diff
changeset
|
330 subRepos = new SubrepoManager(this); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
337
diff
changeset
|
331 subRepos.read(); |
239
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 return subRepos.all(); |
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:
235
diff
changeset
|
335 |
331
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
336 |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
337 public HgRepoConfig getConfiguration() /* XXX throws HgInvalidControlFileException? Description of the exception suggests it is only for files under ./hg/*/ { |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
338 if (repoConfig == null) { |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
339 try { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
340 ConfigFile configFile = impl.readConfiguration(); |
331
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
341 repoConfig = new HgRepoConfig(configFile); |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
342 } catch (IOException ex) { |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
343 String m = "Errors while reading user configuration file"; |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
344 getSessionContext().getLog().dump(getClass(), Warn, ex, m); |
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
345 return new HgRepoConfig(new ConfigFile(getSessionContext())); // empty config, do not cache, allow to try once again |
331
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
346 //throw new HgInvalidControlFileException(m, ex, null); |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
347 } |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
348 } |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
349 return repoConfig; |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
350 } |
a37ce7145c3f
Access to repository configuration
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
318
diff
changeset
|
351 |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
352 // XXX package-local, unless there are cases when required from outside (guess, working dir/revision walkers may hide dirstate access and no public visibility needed) |
280
35125450c804
Erroneous and slow status for working copies based on non-tip revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
252
diff
changeset
|
353 // XXX consider passing Path pool or factory to produce (shared) Path instead of Strings |
431
12f668401613
FIXMEs: awkward API refactored, what need to be internal got hidden; public aspects got captured in slim interfaces
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
430
diff
changeset
|
354 /*package-local*/ final HgDirstate loadDirstate(Path.Source pathFactory) throws HgInvalidControlFileException { |
292
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
289
diff
changeset
|
355 PathRewrite canonicalPath = null; |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
356 if (!impl.isCaseSensitiveFileSystem()) { |
292
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
289
diff
changeset
|
357 canonicalPath = new PathRewrite() { |
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
289
diff
changeset
|
358 |
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
289
diff
changeset
|
359 public CharSequence rewrite(CharSequence path) { |
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
289
diff
changeset
|
360 return path.toString().toLowerCase(); |
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
289
diff
changeset
|
361 } |
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
289
diff
changeset
|
362 }; |
a415fe296a50
Refactor PathRewrite to accept any char sequence, not only string
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
289
diff
changeset
|
363 } |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
364 HgDirstate ds = new HgDirstate(impl, pathFactory, canonicalPath); |
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
365 ds.read(); |
348
a0864b2892cd
Expose errors reading mercurial control files with exception
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
337
diff
changeset
|
366 return ds; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
367 } |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
368 |
289
086a326f181f
Provide public access to ignored files configuration to use in alternative file walkers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
284
diff
changeset
|
369 /** |
086a326f181f
Provide public access to ignored files configuration to use in alternative file walkers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
284
diff
changeset
|
370 * Access to configured set of ignored files. |
086a326f181f
Provide public access to ignored files configuration to use in alternative file walkers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
284
diff
changeset
|
371 * @see HgIgnore#isIgnored(Path) |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
372 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
289
086a326f181f
Provide public access to ignored files configuration to use in alternative file walkers
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
284
diff
changeset
|
373 */ |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
374 public HgIgnore getIgnore() throws HgInvalidControlFileException { |
91
c2ce1cfaeb9e
ignore file with regex and 'honest' glob support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
77
diff
changeset
|
375 // TODO read config for additional locations |
c2ce1cfaeb9e
ignore file with regex and 'honest' glob support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
77
diff
changeset
|
376 if (ignore == null) { |
409
0f5696623512
Support glob path pattern rewrite to facilitate use of globs with Windows path separator
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
407
diff
changeset
|
377 ignore = new HgIgnore(getToRepoPathHelper()); |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
378 File ignoreFile = new File(getWorkingDir(), HgIgnore.getPath()); |
91
c2ce1cfaeb9e
ignore file with regex and 'honest' glob support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
77
diff
changeset
|
379 try { |
335
3d41dc148d14
Do not fail with exception on syntax errors in .hgignore
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
331
diff
changeset
|
380 final List<String> errors = ignore.read(ignoreFile); |
3d41dc148d14
Do not fail with exception on syntax errors in .hgignore
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
331
diff
changeset
|
381 if (errors != null) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
382 getSessionContext().getLog().dump(getClass(), Warn, "Syntax errors parsing %s:\n%s", ignoreFile.getName(), Internals.join(errors, ",\n")); |
335
3d41dc148d14
Do not fail with exception on syntax errors in .hgignore
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
331
diff
changeset
|
383 } |
91
c2ce1cfaeb9e
ignore file with regex and 'honest' glob support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
77
diff
changeset
|
384 } catch (IOException ex) { |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
385 final String m = String.format("Error reading %s file", ignoreFile); |
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
386 throw new HgInvalidControlFileException(m, ex, ignoreFile); |
91
c2ce1cfaeb9e
ignore file with regex and 'honest' glob support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
77
diff
changeset
|
387 } |
c2ce1cfaeb9e
ignore file with regex and 'honest' glob support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
77
diff
changeset
|
388 } |
c2ce1cfaeb9e
ignore file with regex and 'honest' glob support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
77
diff
changeset
|
389 return ignore; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
390 } |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
391 |
481
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
392 /** |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
393 * Mercurial saves message user has supplied for a commit to facilitate message re-use in case commit fails. |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
394 * This method provides this saved message. |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
395 * |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
396 * @return message used for last commit attempt, or <code>null</code> if none |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
397 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
481
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
398 */ |
482
6c67debed07e
Distinguish files in wc from files under repo root, use these constants
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
481
diff
changeset
|
399 public String getCommitLastMessage() throws HgInvalidControlFileException { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
400 File lastMessage = impl.getFileFromRepoDir(LastMessage.getPath()); |
481
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
401 if (!lastMessage.canRead()) { |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
402 return null; |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
403 } |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
404 FileReader fr = null; |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
405 try { |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
406 fr = new FileReader(lastMessage); |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
407 CharBuffer cb = CharBuffer.allocate(Internals.ltoi(lastMessage.length())); |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
408 fr.read(cb); |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
409 return cb.flip().toString(); |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
410 } catch (IOException ex) { |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
411 throw new HgInvalidControlFileException("Can't retrieve message of last commit attempt", ex, lastMessage); |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
412 } finally { |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
413 if (fr != null) { |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
414 try { |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
415 fr.close(); |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
416 } catch (IOException ex) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
417 getSessionContext().getLog().dump(getClass(), Warn, "Failed to close %s after read", lastMessage); |
481
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
418 } |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
419 } |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
420 } |
a458f9fb00ce
Access to user-supplied message of last commit
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
471
diff
changeset
|
421 } |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
422 |
487
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
423 private HgRepositoryLock wdLock, storeLock; |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
424 |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
425 /** |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
426 * PROVISIONAL CODE, DO NOT USE |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
427 * |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
428 * Access repository lock that covers non-store parts of the repository (dirstate, branches, etc - |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
429 * everything that has to do with working directory state). |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
430 * |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
431 * Note, the lock object returned merely gives access to lock mechanism. NO ACTUAL LOCKING IS DONE. |
487
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
432 * Use {@link HgRepositoryLock#acquire()} to actually lock the repository. |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
433 * |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
434 * @return lock object, never <code>null</code> |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
435 */ |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
436 @Experimental(reason="WORK IN PROGRESS") |
487
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
437 public HgRepositoryLock getWorkingDirLock() { |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
438 if (wdLock == null) { |
487
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
439 int timeout = getLockTimeout(); |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
440 File lf = impl.getFileFromRepoDir("wlock"); |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
441 synchronized (this) { |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
442 if (wdLock == null) { |
488
45b3b6ca046f
Repository locking mechanism is alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
487
diff
changeset
|
443 wdLock = new HgRepositoryLock(lf, timeout); |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
444 } |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
445 } |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
446 } |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
447 return wdLock; |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
448 } |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
449 |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
450 @Experimental(reason="WORK IN PROGRESS") |
487
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
451 public HgRepositoryLock getStoreLock() { |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
452 if (storeLock == null) { |
487
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
453 int timeout = getLockTimeout(); |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
454 File fl = impl.getFileFromStoreDir("lock"); |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
455 synchronized (this) { |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
456 if (storeLock == null) { |
488
45b3b6ca046f
Repository locking mechanism is alive
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
487
diff
changeset
|
457 storeLock = new HgRepositoryLock(fl, timeout); |
486
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
458 } |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
459 } |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
460 } |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
461 return storeLock; |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
462 } |
d740edfff563
Provisional support for Mercurial lock mechanism
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
484
diff
changeset
|
463 |
484
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
464 /** |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
465 * Access bookmarks-related functionality |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
466 * @return facility to manage bookmarks, never <code>null</code> |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
467 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em> |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
468 */ |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
469 public HgBookmarks getBookmarks() throws HgInvalidControlFileException { |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
470 if (bookmarks == null) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
471 bookmarks = new HgBookmarks(impl); |
484
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
472 bookmarks.read(); |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
473 } |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
474 return bookmarks; |
ae4d6604debd
Bookmarks support added
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
483
diff
changeset
|
475 } |
501
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
476 |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
477 public HgExtensionsManager getExtensions() { |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
478 if (extManager == null) { |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
479 class EM extends HgExtensionsManager { |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
480 EM() { |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
481 super(HgRepository.this.getImplHelper()); |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
482 } |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
483 } |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
484 extManager = new EM(); |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
485 } |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
486 return extManager; |
d2f6ab541330
Change the way extensions are accessed (with ExtensionsManager now), add preliminary Rebase extension support
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
493
diff
changeset
|
487 } |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
488 |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
489 /** |
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
490 * @return session environment of the repository |
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
491 */ |
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
492 public SessionContext getSessionContext() { |
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
493 return sessionContext; |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
494 } |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
495 |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
496 /** |
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
497 * Perhaps, should be separate interface, like ContentLookup |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
498 * @param path - normalized file name |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
499 * @return <code>null</code> if path doesn't resolve to a existing file |
2
08db726a0fb7
Shaping out low-level Hg structures
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
1
diff
changeset
|
500 */ |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
501 /*package-local*/ RevlogStream resolveStoreFile(Path path) { |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
502 final SoftReference<RevlogStream> ref = streamsCache.get(path); |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
503 RevlogStream cached = ref == null ? null : ref.get(); |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
504 if (cached != null) { |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
505 return cached; |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
506 } |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
507 File f = impl.getFileFromDataDir(path); |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
508 if (f.exists()) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
509 RevlogStream s = new RevlogStream(impl.getDataAccess(), f); |
388
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
510 if (impl.shallCacheRevlogs()) { |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
511 streamsCache.put(path, new SoftReference<RevlogStream>(s)); |
b015f3918120
Work on FIXME: correct HgDataFile#workingCopy with tests; BasicSessionContext with property override; platform-specific options to internals
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
367
diff
changeset
|
512 } |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
513 return s; |
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
514 } |
493
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
515 return null; |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
516 } |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
517 |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
518 private File fakeNonExistentFile(File expected) throws HgInvalidFileException { |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
519 try { |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
520 File fake = File.createTempFile(expected.getName(), null); |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
521 fake.deleteOnExit(); |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
522 return fake; |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
523 } catch (IOException ex) { |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
524 getSessionContext().getLog().dump(getClass(), Info, ex, null); |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
525 throw new HgInvalidFileException(String.format("Failed to fake existence of file %s", expected), ex); |
ba36f66c32b4
Refactor to keep knowledge about repository control files and their location in respect to .hg/ in a single place (facilitate future adoption of shared repositories)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
491
diff
changeset
|
526 } |
74
6f1b88693d48
Complete refactoring to org.tmatesoft
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
68
diff
changeset
|
527 } |
114
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
528 |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
529 /*package-local*/ List<Filter> getFiltersFromRepoToWorkingDir(Path p) { |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
530 return instantiateFilters(p, new Filter.Options(Filter.Direction.FromRepo)); |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
531 } |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
532 |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
533 /*package-local*/ List<Filter> getFiltersFromWorkingDirToRepo(Path p) { |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
534 return instantiateFilters(p, new Filter.Options(Filter.Direction.ToRepo)); |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
535 } |
237
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
536 |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
537 /*package-local*/ File getFile(HgDataFile dataFile) { |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
538 return new File(getWorkingDir(), dataFile.getPath().toString()); |
6e1373b54e9b
Allow access to working copy content through HgDataFile. Give access to repository's working dir
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
235
diff
changeset
|
539 } |
295
981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
292
diff
changeset
|
540 |
412
63c5a9d7ca3f
Follow-up for Issue 29: unify path translation for manifest and dirstate
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
541 /*package-local*/ Internals getImplHelper() { |
63c5a9d7ca3f
Follow-up for Issue 29: unify path translation for manifest and dirstate
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
542 return impl; |
63c5a9d7ca3f
Follow-up for Issue 29: unify path translation for manifest and dirstate
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
409
diff
changeset
|
543 } |
114
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
544 |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
545 private List<Filter> instantiateFilters(Path p, Filter.Options opts) { |
490
b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
488
diff
changeset
|
546 List<Filter.Factory> factories = impl.getFilters(); |
114
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
547 if (factories.isEmpty()) { |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
548 return Collections.emptyList(); |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
549 } |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
550 ArrayList<Filter> rv = new ArrayList<Filter>(factories.size()); |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
551 for (Filter.Factory ff : factories) { |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
552 Filter f = ff.create(p, opts); |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
553 if (f != null) { |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
554 rv.add(f); |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
555 } |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
556 } |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
557 return rv; |
46291ec605a0
Filters to read and initialize according to configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
104
diff
changeset
|
558 } |
487
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
559 |
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
560 private int getLockTimeout() { |
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
561 return getConfiguration().getIntegerValue("ui", "timeout", 600); |
db48a77ec8ff
Access to reposiotry lock mechanism via HgRepositoryLock
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
486
diff
changeset
|
562 } |
0
dbd663faec1f
Basic changelog parsing
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
563 } |