annotate src/org/tmatesoft/hg/repo/HgSubrepoLocation.java @ 457:d78cb5ca3053

Get rid of ambiguity in method name
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Mon, 18 Jun 2012 17:06:42 +0200
parents 6865eb742883
children 51d682cf9cdc
rev   line source
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 295
diff changeset
2 * Copyright (c) 2011-2012 TMate Software Ltd
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.repo;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import java.io.File;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
20
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: 403
diff changeset
21 import org.tmatesoft.hg.core.HgRepositoryNotFoundException;
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
22 import org.tmatesoft.hg.core.Nodeid;
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23 import org.tmatesoft.hg.internal.Experimental;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 import org.tmatesoft.hg.util.Path;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
25
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
26 /**
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 * WORK IN PROGRESS, DO NOT USE
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
28 *
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
29 * @see http://mercurial.selenic.com/wiki/Subrepository
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 * @author Artem Tikhomirov
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31 * @author TMate Software Ltd.
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 */
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 @Experimental(reason="Work in progress")
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34 public class HgSubrepoLocation {
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36 private final HgRepository owner;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37 private final Kind kind;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38 private final Path location;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39 private final String source;
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
40 private final Nodeid revInfo;
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 public enum Kind { Hg, SVN, Git, }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
43
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
44 /**
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
45 *
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
46 * @param parentRepo
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
47 * @param repoLocation path, shall be valid directory (i.e. even if .hgsub doesn't specify trailing slash, this one shall)
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
48 * @param actualLocation
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
49 * @param type
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
50 * @param revision may be <code>null</code>
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
51 */
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
52 /*package-local*/ HgSubrepoLocation(HgRepository parentRepo, Path repoLocation, String actualLocation, Kind type, Nodeid revision) {
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
53 owner = parentRepo;
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
54 location = repoLocation;
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
55 source = actualLocation;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
56 kind = type;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
57 revInfo = revision;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
58 }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
59
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
60 /**
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
61 * Sub-repository's location within owning repository, always directory, <code>path/to/nested</code>.
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
62 * <p>
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
63 * May differ from left-hand, key value from <code>.hgsub</code> if the latter doesn't include trailing slash, which is required
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
64 * for {@link Path} objects
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
65 *
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
66 * @return path to nested repository relative to owner's location
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
67 */
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
68 public Path getLocation() {
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
69 return location;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
70 }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
71
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
72 /**
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
73 * Right-hand value from <code>.hgsub</code>, with <code>[kind]</code> stripped, if any.
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
74 * @return sub-repository's source
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
75 */
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
76 public String getSource() {
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
77 return source;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
78 }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
79
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
80 /**
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
81 * Sub-repository kind, either Mercurial, Subversion or Git
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
82 * @return one of predefined constants
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
83 */
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
84 public Kind getType() {
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
85 return kind;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
86 }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
87
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
88 /**
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
89 * For a nested repository that has been committed at least once, returns
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
90 * its revision as known from <code>.hgsubstate</code>
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
91 *
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
92 * <p>Note, this revision belongs to the nested repository history, not that of owning repository.
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
93 *
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
94 * @return revision of the nested repository, or <code>null</code> if not yet committed
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
95 */
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
96 public Nodeid getRevision() {
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
97 return revInfo;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
98 }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
99
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
100 /**
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
101 * Answers whether this sub repository has ever been part of a commit of the owner repository
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
102 *
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
103 * @return <code>true</code> if owning repository records {@link #getRevision() revision} of this sub-repository
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
104 */
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
105 public boolean isCommitted() {
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
106 return revInfo != null;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
107 }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
108
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
109 /**
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
110 * Answers whether there are local changes in the sub-repository,
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
111 * @return <code>true</code> if it's dirty
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
112 */
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
113 public boolean hasChanges() {
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
114 throw HgRepository.notImplemented();
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
115 }
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
116
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
117 /**
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
118 * Access repository that owns nested one described by this object
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
119 */
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
120 public HgRepository getOwner() {
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
121 return owner;
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
122 }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
123
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: 403
diff changeset
124 /**
442
6865eb742883 Tests for subrepo API, refactor status tests for reuse, better subrepos API
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 423
diff changeset
125 * Access nested repository as a full-fledged Mercurial repository
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: 403
diff changeset
126 *
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: 403
diff changeset
127 * @return object to access sub-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: 403
diff changeset
128 * @throws HgRepositoryNotFoundException if failed to find 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: 403
diff changeset
129 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
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: 403
diff changeset
130 */
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: 403
diff changeset
131 public HgRepository getRepo() throws HgRepositoryNotFoundException {
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
132 if (kind != Kind.Hg) {
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: 403
diff changeset
133 throw new HgInvalidStateException(String.format("Unsupported subrepository %s", kind));
239
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
134 }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
135 return new HgLookup().detect(new File(owner.getWorkingDir(), source));
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
136 }
df9d2854d3d6 Initial access to subrepositories
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
137 }