Mercurial > hg4j
changeset 336:f74e36b7344b
Do not fail with HgBadStateException when there are no merge state
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 11 Nov 2011 05:56:09 +0100 |
parents | 3d41dc148d14 |
children | f377f833b780 |
files | src/org/tmatesoft/hg/repo/HgMergeState.java |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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 <code>null</code> + */ 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");