Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/NewlineFilter.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 | 9c9c442b5f2e |
children | e31e85cf4d4c |
comparison
equal
deleted
inserted
replaced
454:36fd1fd06492 | 456:909306e412e2 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011 TMate Software Ltd | 2 * Copyright (c) 2011-2012 TMate Software Ltd |
3 * | 3 * |
4 * This program is free software; you can redistribute it and/or modify | 4 * This program is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published by | 5 * it under the terms of the GNU General Public License as published by |
6 * the Free Software Foundation; version 2 of the License. | 6 * the Free Software Foundation; version 2 of the License. |
7 * | 7 * |
19 import static java.lang.Math.max; | 19 import static java.lang.Math.max; |
20 import static java.lang.Math.min; | 20 import static java.lang.Math.min; |
21 import static org.tmatesoft.hg.internal.Filter.Direction.FromRepo; | 21 import static org.tmatesoft.hg.internal.Filter.Direction.FromRepo; |
22 import static org.tmatesoft.hg.internal.Filter.Direction.ToRepo; | 22 import static org.tmatesoft.hg.internal.Filter.Direction.ToRepo; |
23 import static org.tmatesoft.hg.internal.KeywordFilter.copySlice; | 23 import static org.tmatesoft.hg.internal.KeywordFilter.copySlice; |
24 import static org.tmatesoft.hg.util.LogFacility.Severity.Warn; | |
24 | 25 |
25 import java.io.File; | 26 import java.io.File; |
26 import java.io.IOException; | 27 import java.io.IOException; |
27 import java.nio.ByteBuffer; | 28 import java.nio.ByteBuffer; |
28 import java.util.ArrayList; | 29 import java.util.ArrayList; |
313 // XXX perhaps, add HgDataFile.hasWorkingCopy and workingCopyContent()? | 314 // XXX perhaps, add HgDataFile.hasWorkingCopy and workingCopyContent()? |
314 ConfigFile hgeol = new ConfigFile(); | 315 ConfigFile hgeol = new ConfigFile(); |
315 try { | 316 try { |
316 hgeol.addLocation(cfgFile); | 317 hgeol.addLocation(cfgFile); |
317 } catch (IOException ex) { | 318 } catch (IOException ex) { |
318 HgInternals.getContext(hgRepo).getLog().warn(getClass(), ex, null); | 319 HgInternals.getContext(hgRepo).getLog().dump(getClass(), Warn, ex, null); |
319 } | 320 } |
320 nativeRepoFormat = hgeol.getSection("repository").get("native"); | 321 nativeRepoFormat = hgeol.getSection("repository").get("native"); |
321 if (nativeRepoFormat == null) { | 322 if (nativeRepoFormat == null) { |
322 nativeRepoFormat = "LF"; | 323 nativeRepoFormat = "LF"; |
323 } | 324 } |
336 } else if ("native".equals(e.getValue())) { | 337 } else if ("native".equals(e.getValue())) { |
337 nativePatterns.add(e.getKey()); | 338 nativePatterns.add(e.getKey()); |
338 } else if ("BIN".equals(e.getValue())) { | 339 } else if ("BIN".equals(e.getValue())) { |
339 binPatterns.add(e.getKey()); | 340 binPatterns.add(e.getKey()); |
340 } else { | 341 } else { |
341 HgInternals.getContext(hgRepo).getLog().warn(getClass(), "Can't recognize .hgeol entry: %s for %s", e.getValue(), e.getKey()); | 342 HgInternals.getContext(hgRepo).getLog().dump(getClass(), Warn, "Can't recognize .hgeol entry: %s for %s", e.getValue(), e.getKey()); |
342 } | 343 } |
343 } | 344 } |
344 if (!crlfPatterns.isEmpty()) { | 345 if (!crlfPatterns.isEmpty()) { |
345 crlfMatcher = new PathGlobMatcher(crlfPatterns.toArray(new String[crlfPatterns.size()])); | 346 crlfMatcher = new PathGlobMatcher(crlfPatterns.toArray(new String[crlfPatterns.size()])); |
346 } | 347 } |