annotate src/org/tmatesoft/hg/internal/ExceptionInfo.java @ 569:c4fd1037bc6f

Support for copy/rename follow/no-follow for annotate
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 10 Apr 2013 20:04:54 +0200
parents cdd53e5884ae
children
rev   line source
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2012 TMate Software Ltd
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.internal;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import static org.tmatesoft.hg.repo.HgRepository.BAD_REVISION;
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
20 import static org.tmatesoft.hg.repo.HgRepository.NO_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: 403
diff changeset
21 import static org.tmatesoft.hg.repo.HgRepository.TIP;
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
22 import static org.tmatesoft.hg.repo.HgRepository.WORKING_COPY;
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 import java.io.File;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
25
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
26 import org.tmatesoft.hg.core.Nodeid;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 import org.tmatesoft.hg.repo.HgRepository;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
28 import org.tmatesoft.hg.util.Path;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
29
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 /**
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31 * Extras to record with exception to describe it better.
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 * XXX perhaps, not only with exception, may utilize it with status object?
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33 *
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34 * @author Artem Tikhomirov
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 * @author TMate Software Ltd.
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36 */
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37 public class ExceptionInfo<T> {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38 protected final T owner;
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
39 protected Integer revNumber = null;
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
40 protected Nodeid revision;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41 protected Path filename;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 protected File localFile;
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
43 // next two make sense only when revNumber was set
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
44 private int rangeLeftBoundary = BAD_REVISION, rangeRightBoundary = BAD_REVISION;
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
45
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 /**
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
47 * @param owner instance to return from setters
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 */
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
49 public ExceptionInfo(T owner) {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
50 this.owner = owner;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
51 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
52
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
53 /**
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
54 * @return not {@link HgRepository#BAD_REVISION} only when revision index was supplied at the construction time
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
55 */
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
56 public int getRevisionIndex() {
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
57 return revNumber == null ? HgRepository.BAD_REVISION : revNumber;
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
58 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
59
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
60 public T setRevisionIndex(int rev) {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
61 revNumber = rev;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
62 return owner;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
63 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
64
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
65 public boolean isRevisionIndexSet() {
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
66 return revNumber != null;
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
67 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
68
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
69 /**
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
70 * @return non-null only when revision was supplied at construction time
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
71 */
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
72 public Nodeid getRevision() {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
73 return revision;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
74 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
75
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
76 public T setRevision(Nodeid r) {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
77 revision = r;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
78 return owner;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
79 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
80
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
81 public boolean isRevisionSet() {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
82 return revision != null;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
83 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
84
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
85 /**
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
86 * @return non-null only if file name was set at construction time
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
87 */
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
88 public Path getFileName() {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
89 return filename;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
90 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
91
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
92 public T setFileName(Path name) {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
93 filename = name;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
94 return owner;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
95 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
96
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
97 public T setFile(File file) {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
98 localFile = file;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
99 return owner;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
100 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
101
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
102 /**
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
103 * @return file object that causes troubles, or <code>null</code> if specific file is unknown
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
104 */
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
105 public File getFile() {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
106 return localFile;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
107 }
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
108
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
109 public T setRevisionIndexBoundary(int revisionIndex, int rangeLeft, int rangeRight) {
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
110 setRevisionIndex(revisionIndex);
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
111 rangeLeftBoundary = rangeLeft;
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
112 rangeRightBoundary = rangeRight;
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
113 return owner;
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
114 }
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
115
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
116 public StringBuilder appendDetails(StringBuilder sb) {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
117 if (filename != null) {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
118 sb.append("path:'");
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
119 sb.append(filename);
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
120 sb.append('\'');
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
121 sb.append(';');
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
122 sb.append(' ');
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
123 }
485
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
124 if (isRevisionIndexSet() || isRevisionSet()) {
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
125 if (isRevisionIndexSet()) {
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
126 if (rangeLeftBoundary != BAD_REVISION || rangeRightBoundary != BAD_REVISION) {
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
127 String sr;
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
128 switch (getRevisionIndex()) {
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
129 case BAD_REVISION:
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
130 sr = "UNKNOWN"; break;
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
131 case TIP:
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
132 sr = "TIP"; break;
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
133 case WORKING_COPY:
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
134 sr = "WORKING-COPY"; break;
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
135 case NO_REVISION:
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
136 sr = "NO REVISION"; break;
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
137 default:
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
138 sr = String.valueOf(getRevisionIndex());
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
139 }
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
140 sb.append(String.format("%s is not from [%d..%d]", sr, rangeLeftBoundary, rangeRightBoundary));
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
141 } else {
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
142 sb.append("rev:");
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
143 sb.append(getRevisionIndex());
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
144 if (isRevisionSet()) {
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
145 sb.append(':');
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
146 // fall-through to get revision appended
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
147 }
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
148 }
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
149 }
485
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
150 if (isRevisionSet()) {
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
151 sb.append(getRevision().shortNotation());
cdd53e5884ae Do not add anything to exception message in case no details are known
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents: 439
diff changeset
152 }
403
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
153 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
154 if (localFile != null) {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
155 sb.append(';');
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
156 sb.append(' ');
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
157 sb.append(" file:");
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
158 sb.append(localFile.getPath());
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
159 sb.append(',');
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
160 if (localFile.exists()) {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
161 sb.append("EXISTS");
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
162 } else {
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
163 sb.append("DOESN'T EXIST");
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
164 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
165 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
166 return sb;
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
167 }
2747b0723867 FIXMEs: work on exceptions and javadoc
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
168 }