Mercurial > jhg
diff src/org/tmatesoft/hg/repo/HgBranches.java @ 490:b3c16d1aede0
Refactoring: move HgRepository's implementation aspects to Internals (which is now its imlementation counterpart and primary repository class to be used by other parts of the library)
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 16 Aug 2012 17:08:34 +0200 |
parents | 909306e412e2 |
children | 5c68567b3645 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgBranches.java Mon Aug 13 19:24:29 2012 +0200 +++ b/src/org/tmatesoft/hg/repo/HgBranches.java Thu Aug 16 17:08:34 2012 +0200 @@ -39,6 +39,7 @@ import org.tmatesoft.hg.core.Nodeid; import org.tmatesoft.hg.internal.Experimental; +import org.tmatesoft.hg.internal.Internals; import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; import org.tmatesoft.hg.util.ProgressSupport; @@ -51,10 +52,12 @@ private final Map<String, BranchInfo> branches = new TreeMap<String, BranchInfo>(); private final HgRepository repo; + private final Internals internalRepo; private boolean isCacheActual = false; - HgBranches(HgRepository hgRepo) { - repo = hgRepo; + HgBranches(Internals internals) { + internalRepo = internals; + repo = internals.getRepo(); // merely a cached value } private int readCache() { @@ -101,24 +104,24 @@ return lastInCache; } catch (IOException ex) { // log error, but otherwise do nothing - repo.getContext().getLog().dump(getClass(), Warn, ex, null); + repo.getSessionContext().getLog().dump(getClass(), Warn, ex, null); // FALL THROUGH to return -1 indicating no cache information } catch (NumberFormatException ex) { - repo.getContext().getLog().dump(getClass(), Warn, ex, null); + repo.getSessionContext().getLog().dump(getClass(), Warn, ex, null); // FALL THROUGH } catch (HgInvalidControlFileException ex) { // shall not happen, thus log as error - repo.getContext().getLog().dump(getClass(), Error, ex, null); + repo.getSessionContext().getLog().dump(getClass(), Error, ex, null); // FALL THROUGH } catch (HgInvalidRevisionException ex) { - repo.getContext().getLog().dump(getClass(), Error, ex, null); + repo.getSessionContext().getLog().dump(getClass(), Error, ex, null); // FALL THROUGH } finally { if (br != null) { try { br.close(); } catch (IOException ex) { - repo.getContext().getLog().dump(getClass(), Warn, ex, null); // ignore + repo.getSessionContext().getLog().dump(getClass(), Warn, ex, null); // ignore } } } @@ -275,7 +278,7 @@ private File getCacheFile() { // prior to 1.8 used to be .hg/branchheads.cache - return new File(repo.getRepositoryRoot(), "cache/branchheads"); + return internalRepo.getFileFromRepoDir("cache/branchheads"); } public static class BranchInfo {