Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/KeywordFilter.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 | b3c16d1aede0 |
comparison
equal
deleted
inserted
replaced
454:36fd1fd06492 | 456:909306e412e2 |
---|---|
13 * For information on how to redistribute this software under | 13 * For information on how to redistribute this software under |
14 * the terms of a license other than GNU General Public License | 14 * the terms of a license other than GNU General Public License |
15 * contact TMate Software at support@hg4j.com | 15 * contact TMate Software at support@hg4j.com |
16 */ | 16 */ |
17 package org.tmatesoft.hg.internal; | 17 package org.tmatesoft.hg.internal; |
18 | |
19 import static org.tmatesoft.hg.util.LogFacility.Severity.Error; | |
18 | 20 |
19 import java.nio.ByteBuffer; | 21 import java.nio.ByteBuffer; |
20 import java.util.ArrayList; | 22 import java.util.ArrayList; |
21 import java.util.Date; | 23 import java.util.Date; |
22 import java.util.TreeMap; | 24 import java.util.TreeMap; |
261 // TODO post-1.0 Either add cset's nodeid into Changeset class or use own inspector | 263 // TODO post-1.0 Either add cset's nodeid into Changeset class or use own inspector |
262 // when accessing changelog, see below, #getChangeset | 264 // when accessing changelog, see below, #getChangeset |
263 int csetRev = repo.getFileNode(path).getChangesetRevisionIndex(HgRepository.TIP); | 265 int csetRev = repo.getFileNode(path).getChangesetRevisionIndex(HgRepository.TIP); |
264 return repo.getChangelog().getRevision(csetRev).shortNotation(); | 266 return repo.getChangelog().getRevision(csetRev).shortNotation(); |
265 } catch (HgRuntimeException ex) { | 267 } catch (HgRuntimeException ex) { |
266 HgInternals.getContext(repo).getLog().error(getClass(), ex, null); | 268 HgInternals.getContext(repo).getLog().dump(getClass(), Error, ex, null); |
267 return Nodeid.NULL.shortNotation(); // XXX perhaps, might return anything better? Not sure how hg approaches this. | 269 return Nodeid.NULL.shortNotation(); // XXX perhaps, might return anything better? Not sure how hg approaches this. |
268 } | 270 } |
269 } | 271 } |
270 | 272 |
271 private String username() { | 273 private String username() { |
272 try { | 274 try { |
273 return getChangeset().user(); | 275 return getChangeset().user(); |
274 } catch (HgRuntimeException ex) { | 276 } catch (HgRuntimeException ex) { |
275 HgInternals.getContext(repo).getLog().error(getClass(), ex, null); | 277 HgInternals.getContext(repo).getLog().dump(getClass(), Error, ex, null); |
276 return ""; | 278 return ""; |
277 } | 279 } |
278 } | 280 } |
279 | 281 |
280 private String date() { | 282 private String date() { |
281 Date d; | 283 Date d; |
282 try { | 284 try { |
283 d = getChangeset().date(); | 285 d = getChangeset().date(); |
284 } catch (HgRuntimeException ex) { | 286 } catch (HgRuntimeException ex) { |
285 HgInternals.getContext(repo).getLog().error(getClass(), ex, null); | 287 HgInternals.getContext(repo).getLog().dump(getClass(), Error, ex, null); |
286 d = new Date(0l); | 288 d = new Date(0l); |
287 } | 289 } |
288 return String.format("%tY/%<tm/%<td %<tH:%<tM:%<tS", d); | 290 return String.format("%tY/%<tm/%<td %<tH:%<tM:%<tS", d); |
289 } | 291 } |
290 | 292 |