Mercurial > jhg
comparison src/org/tmatesoft/hg/internal/RequiresFile.java @ 295:981f9f50bb6c
Issue 11: Error log facility. SessionContext to share common facilities
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 16 Sep 2011 05:35:32 +0200 |
parents | ff4fdbab4e2d |
children | ba36f66c32b4 |
comparison
equal
deleted
inserted
replaced
294:32890bab7209 | 295:981f9f50bb6c |
---|---|
33 public static final int DOTENCODE = 4; | 33 public static final int DOTENCODE = 4; |
34 | 34 |
35 public RequiresFile() { | 35 public RequiresFile() { |
36 } | 36 } |
37 | 37 |
38 public void parse(Internals repoImpl, File requiresFile) { | 38 public void parse(Internals repoImpl, File requiresFile) throws IOException { |
39 if (!requiresFile.exists()) { | 39 if (!requiresFile.exists()) { |
40 return; | 40 return; |
41 } | 41 } |
42 BufferedReader br = null; | |
42 try { | 43 try { |
43 boolean revlogv1 = false; | 44 boolean revlogv1 = false; |
44 boolean store = false; | 45 boolean store = false; |
45 boolean fncache = false; | 46 boolean fncache = false; |
46 boolean dotencode = false; | 47 boolean dotencode = false; |
47 BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(requiresFile))); | 48 br = new BufferedReader(new InputStreamReader(new FileInputStream(requiresFile))); |
48 String line; | 49 String line; |
49 while ((line = br.readLine()) != null) { | 50 while ((line = br.readLine()) != null) { |
50 revlogv1 |= "revlogv1".equals(line); | 51 revlogv1 |= "revlogv1".equals(line); |
51 store |= "store".equals(line); | 52 store |= "store".equals(line); |
52 fncache |= "fncache".equals(line); | 53 fncache |= "fncache".equals(line); |
55 int flags = 0; | 56 int flags = 0; |
56 flags += store ? STORE : 0; | 57 flags += store ? STORE : 0; |
57 flags += fncache ? FNCACHE : 0; | 58 flags += fncache ? FNCACHE : 0; |
58 flags += dotencode ? DOTENCODE : 0; | 59 flags += dotencode ? DOTENCODE : 0; |
59 repoImpl.setStorageConfig(revlogv1 ? 1 : 0, flags); | 60 repoImpl.setStorageConfig(revlogv1 ? 1 : 0, flags); |
60 br.close(); | 61 } finally { |
61 } catch (IOException ex) { | 62 if (br != null) { |
62 ex.printStackTrace(); // FIXME log | 63 br.close(); |
64 } | |
63 } | 65 } |
64 } | 66 } |
65 } | 67 } |