comparison src/org/tmatesoft/hg/repo/HgBranches.java @ 423:9c9c442b5f2e

Major refactoring of exception handling. Low-level API uses RuntimeExceptions, while checked are left for higher level
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 23 Mar 2012 22:51:18 +0100
parents 2fadf8695f8a
children 1fc0da631200
comparison
equal deleted inserted replaced
422:5d1cc7366d04 423:9c9c442b5f2e
1 /* 1 /*
2 * Copyright (c) 2011 TMate Software Ltd 2 * Copyright (c) 2011-2012 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 *
32 import java.util.List; 32 import java.util.List;
33 import java.util.Map; 33 import java.util.Map;
34 import java.util.TreeMap; 34 import java.util.TreeMap;
35 import java.util.regex.Pattern; 35 import java.util.regex.Pattern;
36 36
37 import org.tmatesoft.hg.core.HgException;
38 import org.tmatesoft.hg.core.HgInvalidControlFileException;
39 import org.tmatesoft.hg.core.HgInvalidRevisionException;
40 import org.tmatesoft.hg.core.Nodeid; 37 import org.tmatesoft.hg.core.Nodeid;
41 import org.tmatesoft.hg.internal.Experimental; 38 import org.tmatesoft.hg.internal.Experimental;
42 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; 39 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset;
43 import org.tmatesoft.hg.util.ProgressSupport; 40 import org.tmatesoft.hg.util.ProgressSupport;
44 41
238 235
239 /** 236 /**
240 * Writes down information about repository branches in a format Mercurial native client can understand. 237 * Writes down information about repository branches in a format Mercurial native client can understand.
241 * Cache file gets overwritten only if it is out of date (i.e. misses some branch information) 238 * Cache file gets overwritten only if it is out of date (i.e. misses some branch information)
242 * @throws IOException if write to cache file failed 239 * @throws IOException if write to cache file failed
243 * @throws HgException subclass of {@link HgException} in case of repository access issue 240 * @throws HgRuntimeException subclass thereof to indicate issues with the library. <em>Runtime exception</em>
244 */ 241 */
245 @Experimental(reason="Usage of cache isn't supposed to be public knowledge") 242 @Experimental(reason="Usage of cache isn't supposed to be public knowledge")
246 public void writeCache() throws IOException, HgException { 243 public void writeCache() throws IOException, HgRuntimeException {
247 if (isCacheActual) { 244 if (isCacheActual) {
248 return; 245 return;
249 } 246 }
250 File branchheadsCache = getCacheFile(); 247 File branchheadsCache = getCacheFile();
251 if (!branchheadsCache.exists()) { 248 if (!branchheadsCache.exists()) {