Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgDirstate.java @ 456:909306e412e2
Refactor LogFacility and SessionContext, better API for both
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 18 Jun 2012 16:54:00 +0200 |
parents | 12f668401613 |
children | b3c16d1aede0 |
comparison
equal
deleted
inserted
replaced
454:36fd1fd06492 | 456:909306e412e2 |
---|---|
15 * contact TMate Software at support@hg4j.com | 15 * contact TMate Software at support@hg4j.com |
16 */ | 16 */ |
17 package org.tmatesoft.hg.repo; | 17 package org.tmatesoft.hg.repo; |
18 | 18 |
19 import static org.tmatesoft.hg.core.Nodeid.NULL; | 19 import static org.tmatesoft.hg.core.Nodeid.NULL; |
20 import static org.tmatesoft.hg.util.LogFacility.Severity.Debug; | |
20 | 21 |
21 import java.io.BufferedReader; | 22 import java.io.BufferedReader; |
22 import java.io.File; | 23 import java.io.File; |
23 import java.io.FileNotFoundException; | 24 import java.io.FileNotFoundException; |
24 import java.io.FileReader; | 25 import java.io.FileReader; |
33 import org.tmatesoft.hg.internal.DataAccess; | 34 import org.tmatesoft.hg.internal.DataAccess; |
34 import org.tmatesoft.hg.internal.EncodingHelper; | 35 import org.tmatesoft.hg.internal.EncodingHelper; |
35 import org.tmatesoft.hg.util.Pair; | 36 import org.tmatesoft.hg.util.Pair; |
36 import org.tmatesoft.hg.util.Path; | 37 import org.tmatesoft.hg.util.Path; |
37 import org.tmatesoft.hg.util.PathRewrite; | 38 import org.tmatesoft.hg.util.PathRewrite; |
39 import org.tmatesoft.hg.util.LogFacility.Severity; | |
38 | 40 |
39 | 41 |
40 /** | 42 /** |
41 * @see http://mercurial.selenic.com/wiki/DirState | 43 * @see http://mercurial.selenic.com/wiki/DirState |
42 * @see http://mercurial.selenic.com/wiki/FileFormats#dirstate | 44 * @see http://mercurial.selenic.com/wiki/FileFormats#dirstate |
139 } else if (state == 'r') { | 141 } else if (state == 'r') { |
140 removed.put(r.name1, r); | 142 removed.put(r.name1, r); |
141 } else if (state == 'm') { | 143 } else if (state == 'm') { |
142 merged.put(r.name1, r); | 144 merged.put(r.name1, r); |
143 } else { | 145 } else { |
144 repo.getContext().getLog().warn(getClass(), "Dirstate record for file %s (size: %d, tstamp:%d) has unknown state '%c'", r.name1, r.size(), r.time, state); | 146 repo.getContext().getLog().dump(getClass(), Severity.Warn, "Dirstate record for file %s (size: %d, tstamp:%d) has unknown state '%c'", r.name1, r.size(), r.time, state); |
145 } | 147 } |
146 } | 148 } |
147 } catch (IOException ex) { | 149 } catch (IOException ex) { |
148 throw new HgInvalidControlFileException("Dirstate read failed", ex, dirstateFile); | 150 throw new HgInvalidControlFileException("Dirstate read failed", ex, dirstateFile); |
149 } finally { | 151 } finally { |
203 b = b.trim().intern(); | 205 b = b.trim().intern(); |
204 } | 206 } |
205 branch = b == null || b.length() == 0 ? HgRepository.DEFAULT_BRANCH_NAME : b; | 207 branch = b == null || b.length() == 0 ? HgRepository.DEFAULT_BRANCH_NAME : b; |
206 r.close(); | 208 r.close(); |
207 } catch (FileNotFoundException ex) { | 209 } catch (FileNotFoundException ex) { |
208 repo.getContext().getLog().debug(HgDirstate.class, ex, null); // log verbose debug, exception might be legal here | 210 repo.getContext().getLog().dump(HgDirstate.class, Debug, ex, null); // log verbose debug, exception might be legal here |
209 // IGNORE | 211 // IGNORE |
210 } catch (IOException ex) { | 212 } catch (IOException ex) { |
211 throw new HgInvalidControlFileException("Error reading file with branch information", ex, branchFile); | 213 throw new HgInvalidControlFileException("Error reading file with branch information", ex, branchFile); |
212 } | 214 } |
213 } | 215 } |