Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/PhasesHelper.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 | 09f2d38ecf26 |
children | ba36f66c32b4 |
comparison
equal
deleted
inserted
replaced
489:9c0138cda59a | 490:b3c16d1aede0 |
---|---|
38 import org.tmatesoft.hg.repo.HgParentChildMap; | 38 import org.tmatesoft.hg.repo.HgParentChildMap; |
39 import org.tmatesoft.hg.repo.HgPhase; | 39 import org.tmatesoft.hg.repo.HgPhase; |
40 import org.tmatesoft.hg.repo.HgRepository; | 40 import org.tmatesoft.hg.repo.HgRepository; |
41 | 41 |
42 /** | 42 /** |
43 * Support to deal with phases feature fo Mercurial (as of Mercutial version 2.1) | 43 * Support to deal with Mercurial phases feature (as of Mercurial version 2.1) |
44 * | |
45 * @see http://mercurial.selenic.com/wiki/Phases | |
46 * @see http://mercurial.selenic.com/wiki/PhasesDevel | |
44 * | 47 * |
45 * @author Artem Tikhomirov | 48 * @author Artem Tikhomirov |
46 * @author TMate Software Ltd. | 49 * @author TMate Software Ltd. |
47 */ | 50 */ |
48 public final class PhasesHelper { | 51 public final class PhasesHelper { |
132 String[] lc = line.trim().split("\\s+"); | 135 String[] lc = line.trim().split("\\s+"); |
133 if (lc.length == 0) { | 136 if (lc.length == 0) { |
134 continue; | 137 continue; |
135 } | 138 } |
136 if (lc.length != 2) { | 139 if (lc.length != 2) { |
137 HgInternals.getContext(repo).getLog().dump(getClass(), Warn, "Bad line in phaseroots:%s", line); | 140 repo.getSessionContext().getLog().dump(getClass(), Warn, "Bad line in phaseroots:%s", line); |
138 continue; | 141 continue; |
139 } | 142 } |
140 int phaseIndex = Integer.parseInt(lc[0]); | 143 int phaseIndex = Integer.parseInt(lc[0]); |
141 Nodeid rootRev = Nodeid.fromAscii(lc[1]); | 144 Nodeid rootRev = Nodeid.fromAscii(lc[1]); |
142 if (!repo.getChangelog().isKnown(rootRev)) { | 145 if (!repo.getChangelog().isKnown(rootRev)) { |
143 HgInternals.getContext(repo).getLog().dump(getClass(), Warn, "Phase(%d) root node %s doesn't exist in the repository, ignored.", phaseIndex, rootRev); | 146 repo.getSessionContext().getLog().dump(getClass(), Warn, "Phase(%d) root node %s doesn't exist in the repository, ignored.", phaseIndex, rootRev); |
144 continue; | 147 continue; |
145 } | 148 } |
146 HgPhase phase = HgPhase.parse(phaseIndex); | 149 HgPhase phase = HgPhase.parse(phaseIndex); |
147 List<Nodeid> roots = phase2roots.get(phase); | 150 List<Nodeid> roots = phase2roots.get(phase); |
148 if (roots == null) { | 151 if (roots == null) { |
157 } finally { | 160 } finally { |
158 if (br != null) { | 161 if (br != null) { |
159 try { | 162 try { |
160 br.close(); | 163 br.close(); |
161 } catch (IOException ex) { | 164 } catch (IOException ex) { |
162 HgInternals.getContext(repo).getLog().dump(getClass(), Info, ex, null); | 165 repo.getSessionContext().getLog().dump(getClass(), Info, ex, null); |
163 // ignore the exception otherwise | 166 // ignore the exception otherwise |
164 } | 167 } |
165 } | 168 } |
166 } | 169 } |
167 return Boolean.TRUE; | 170 return Boolean.TRUE; |