# HG changeset patch # User Artem Tikhomirov # Date 1320987369 -3600 # Node ID f74e36b7344be2cbe78a9ab3f15a3c58ddeeed19 # Parent 3d41dc148d14338953df7ab2ce96d0e9272dd51c Do not fail with HgBadStateException when there are no merge state diff -r 3d41dc148d14 -r f74e36b7344b src/org/tmatesoft/hg/repo/HgMergeState.java --- a/src/org/tmatesoft/hg/repo/HgMergeState.java Thu Nov 10 05:44:12 2011 +0100 +++ b/src/org/tmatesoft/hg/repo/HgMergeState.java Fri Nov 11 05:56:09 2011 +0100 @@ -93,6 +93,7 @@ public void refresh() throws IOException/*XXX it's unlikely caller can do anything reasonable about IOException */ { entries = null; + wcp1 = wcp2 = stateParent = Nodeid.NULL; final File f = new File(repo.getRepositoryRoot(), "merge/state"); if (!f.canRead()) { // empty state @@ -172,7 +173,11 @@ } return !wcp1.equals(stateParent); } - + + /** + * FIXME decide what to return if there's no merge state altogether (perhaps, separate method to check that) + * @return never null + */ public Nodeid getFirstParent() { if (wcp1 == null) { throw new HgBadStateException("Call #refresh() first"); @@ -187,6 +192,9 @@ return wcp2; } + /** + * @return revision of the merge state or {@link Nodeid#NULL} if there's no merge state + */ public Nodeid getStateParent() { if (stateParent == null) { throw new HgBadStateException("Call #refresh() first");