Mercurial > hg4j
diff src/org/tmatesoft/hg/repo/HgBookmarks.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 | ae4d6604debd |
children | d2f6ab541330 |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgBookmarks.java Mon Aug 13 19:24:29 2012 +0200 +++ b/src/org/tmatesoft/hg/repo/HgBookmarks.java Thu Aug 16 17:08:34 2012 +0200 @@ -24,6 +24,7 @@ import java.util.Map; import org.tmatesoft.hg.core.Nodeid; +import org.tmatesoft.hg.internal.Internals; import org.tmatesoft.hg.internal.LineReader; import org.tmatesoft.hg.util.LogFacility; @@ -33,17 +34,18 @@ * @author TMate Software Ltd. */ public final class HgBookmarks { - private final HgRepository repo; + private final Internals internalRepo; private Map<String, Nodeid> bookmarks = Collections.emptyMap(); private String activeBookmark; - HgBookmarks(HgRepository hgRepo) { - repo = hgRepo; + HgBookmarks(Internals internals) { + internalRepo = internals; } /*package-local*/ void read() throws HgInvalidControlFileException { - final LogFacility log = repo.getContext().getLog(); - File all = new File (repo.getRepositoryRoot(), HgRepositoryFiles.Bookmarks.getName()); + final LogFacility log = internalRepo.getContext().getLog(); + final HgRepository repo = internalRepo.getRepo(); + File all = internalRepo.getFileFromRepoDir(HgRepositoryFiles.Bookmarks.getName()); LinkedHashMap<String, Nodeid> bm = new LinkedHashMap<String, Nodeid>(); if (all.canRead()) { LineReader lr1 = new LineReader(all, log); @@ -74,9 +76,9 @@ } activeBookmark = null; - File active = new File(repo.getRepositoryRoot(), HgRepositoryFiles.BookmarksCurrent.getName()); + File active = internalRepo.getFileFromRepoDir(HgRepositoryFiles.BookmarksCurrent.getName()); if (active.canRead()) { - LineReader lr2 = new LineReader(active, repo.getContext().getLog()); + LineReader lr2 = new LineReader(active, log); ArrayList<String> c = new ArrayList<String>(2); lr2.read(new LineReader.SimpleLineCollector(), c); if (c.size() > 0) {