Mercurial > hg4j
comparison src/org/tmatesoft/hg/internal/KeywordFilter.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 | 909306e412e2 |
children | cf200271439a |
comparison
equal
deleted
inserted
replaced
489:9c0138cda59a | 490:b3c16d1aede0 |
---|---|
23 import java.util.Date; | 23 import java.util.Date; |
24 import java.util.TreeMap; | 24 import java.util.TreeMap; |
25 | 25 |
26 import org.tmatesoft.hg.core.Nodeid; | 26 import org.tmatesoft.hg.core.Nodeid; |
27 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; | 27 import org.tmatesoft.hg.repo.HgChangelog.RawChangeset; |
28 import org.tmatesoft.hg.repo.HgInternals; | |
29 import org.tmatesoft.hg.repo.HgRepository; | 28 import org.tmatesoft.hg.repo.HgRepository; |
30 import org.tmatesoft.hg.repo.HgRuntimeException; | 29 import org.tmatesoft.hg.repo.HgRuntimeException; |
31 import org.tmatesoft.hg.util.Pair; | 30 import org.tmatesoft.hg.util.Pair; |
32 import org.tmatesoft.hg.util.Path; | 31 import org.tmatesoft.hg.util.Path; |
33 | 32 |
263 // TODO post-1.0 Either add cset's nodeid into Changeset class or use own inspector | 262 // TODO post-1.0 Either add cset's nodeid into Changeset class or use own inspector |
264 // when accessing changelog, see below, #getChangeset | 263 // when accessing changelog, see below, #getChangeset |
265 int csetRev = repo.getFileNode(path).getChangesetRevisionIndex(HgRepository.TIP); | 264 int csetRev = repo.getFileNode(path).getChangesetRevisionIndex(HgRepository.TIP); |
266 return repo.getChangelog().getRevision(csetRev).shortNotation(); | 265 return repo.getChangelog().getRevision(csetRev).shortNotation(); |
267 } catch (HgRuntimeException ex) { | 266 } catch (HgRuntimeException ex) { |
268 HgInternals.getContext(repo).getLog().dump(getClass(), Error, ex, null); | 267 repo.getSessionContext().getLog().dump(getClass(), Error, ex, null); |
269 return Nodeid.NULL.shortNotation(); // XXX perhaps, might return anything better? Not sure how hg approaches this. | 268 return Nodeid.NULL.shortNotation(); // XXX perhaps, might return anything better? Not sure how hg approaches this. |
270 } | 269 } |
271 } | 270 } |
272 | 271 |
273 private String username() { | 272 private String username() { |
274 try { | 273 try { |
275 return getChangeset().user(); | 274 return getChangeset().user(); |
276 } catch (HgRuntimeException ex) { | 275 } catch (HgRuntimeException ex) { |
277 HgInternals.getContext(repo).getLog().dump(getClass(), Error, ex, null); | 276 repo.getSessionContext().getLog().dump(getClass(), Error, ex, null); |
278 return ""; | 277 return ""; |
279 } | 278 } |
280 } | 279 } |
281 | 280 |
282 private String date() { | 281 private String date() { |
283 Date d; | 282 Date d; |
284 try { | 283 try { |
285 d = getChangeset().date(); | 284 d = getChangeset().date(); |
286 } catch (HgRuntimeException ex) { | 285 } catch (HgRuntimeException ex) { |
287 HgInternals.getContext(repo).getLog().dump(getClass(), Error, ex, null); | 286 repo.getSessionContext().getLog().dump(getClass(), Error, ex, null); |
288 d = new Date(0l); | 287 d = new Date(0l); |
289 } | 288 } |
290 return String.format("%tY/%<tm/%<td %<tH:%<tM:%<tS", d); | 289 return String.format("%tY/%<tm/%<td %<tH:%<tM:%<tS", d); |
291 } | 290 } |
292 | 291 |