comparison src/org/tmatesoft/hg/repo/HgMergeState.java @ 628:6526d8adbc0f

Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 22 May 2013 15:52:31 +0200
parents b3c16d1aede0
children b4242b7e7dfe
comparison
equal deleted inserted replaced
627:5153eb73b18d 628:6526d8adbc0f
1 /* 1 /*
2 * Copyright (c) 2011-2012 TMate Software Ltd 2 * Copyright (c) 2011-2013 TMate Software Ltd
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License. 6 * the Free Software Foundation; version 2 of the License.
7 * 7 *
183 * Value of {@link #getConflicts()} is reasonable iff this method returned <code>false</code>. 183 * Value of {@link #getConflicts()} is reasonable iff this method returned <code>false</code>.
184 * 184 *
185 * @return <code>true</code> when recorded merge state doesn't seem to correspond to present working copy 185 * @return <code>true</code> when recorded merge state doesn't seem to correspond to present working copy
186 */ 186 */
187 public boolean isStale() { 187 public boolean isStale() {
188 if (wcp1 == null) { 188 assert wcp1 != null;
189 refresh();
190 }
191 return !stateParent.isNull() /*there's merge state*/ && !wcp1.equals(stateParent) /*and it doesn't match*/; 189 return !stateParent.isNull() /*there's merge state*/ && !wcp1.equals(stateParent) /*and it doesn't match*/;
192 } 190 }
193 191
194 /** 192 /**
195 * It's possible for a repository to be in a 'merging' state (@see {@link #isMerging()} without any 193 * It's possible for a repository to be in a 'merging' state (@see {@link #isMerging()} without any
196 * conflict to resolve (no merge state information file). 194 * conflict to resolve (no merge state information file).
197 * 195 *
198 * @return first parent of the working copy, never <code>null</code> 196 * @return first parent of the working copy, never <code>null</code>
199 */ 197 */
200 public Nodeid getFirstParent() { 198 public Nodeid getFirstParent() {
201 if (wcp1 == null) { 199 assert wcp1 != null;
202 refresh();
203 }
204 return wcp1; 200 return wcp1;
205 } 201 }
206 202
207 /** 203 /**
208 * @return second parent of the working copy, never <code>null</code> 204 * @return second parent of the working copy, never <code>null</code>
209 */ 205 */
210 public Nodeid getSecondParent() { 206 public Nodeid getSecondParent() {
211 if (wcp2 == null) { 207 assert wcp2 != null;
212 refresh();
213 }
214 return wcp2; 208 return wcp2;
215 } 209 }
216 210
217 /** 211 /**
218 * @return revision of the merge state or {@link Nodeid#NULL} if there's no merge state 212 * @return revision of the merge state or {@link Nodeid#NULL} if there's no merge state
219 */ 213 */
220 public Nodeid getStateParent() { 214 public Nodeid getStateParent() {
221 if (stateParent == null) { 215 assert stateParent != null;
222 refresh();
223 }
224 return stateParent; 216 return stateParent;
225 } 217 }
226 218
227 /** 219 /**
228 * List of conflicts as recorded in the merge state information file. 220 * List of conflicts as recorded in the merge state information file.