Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/ChangesetTransformer.java @ 195:c9b305df0b89
Optimization: use ParentWalker to get changeset's parents, if possible. Do not keep duplicating nodeids and strings in manifest revisions
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Fri, 15 Apr 2011 05:17:44 +0200 |
parents | 37f3d4a596e4 |
children | ffc5f6d59f7e |
comparison
equal
deleted
inserted
replaced
194:344e8d7e4d6e | 195:c9b305df0b89 |
---|---|
34 /*package-local*/ class ChangesetTransformer implements HgChangelog.Inspector { | 34 /*package-local*/ class ChangesetTransformer implements HgChangelog.Inspector { |
35 private final HgLogCommand.Handler handler; | 35 private final HgLogCommand.Handler handler; |
36 private final HgChangeset changeset; | 36 private final HgChangeset changeset; |
37 private Set<String> branches; | 37 private Set<String> branches; |
38 | 38 |
39 public ChangesetTransformer(HgRepository hgRepo, HgLogCommand.Handler delegate) { | 39 // repo and delegate can't be null, parent walker can |
40 public ChangesetTransformer(HgRepository hgRepo, HgLogCommand.Handler delegate, HgChangelog.ParentWalker pw) { | |
40 if (hgRepo == null || delegate == null) { | 41 if (hgRepo == null || delegate == null) { |
41 throw new IllegalArgumentException(); | 42 throw new IllegalArgumentException(); |
42 } | 43 } |
43 HgStatusCollector statusCollector = new HgStatusCollector(hgRepo); | 44 HgStatusCollector statusCollector = new HgStatusCollector(hgRepo); |
44 // files listed in a changeset don't need their names to be rewritten (they are normalized already) | 45 // files listed in a changeset don't need their names to be rewritten (they are normalized already) |
45 PathPool pp = new PathPool(new PathRewrite.Empty()); | 46 PathPool pp = new PathPool(new PathRewrite.Empty()); |
46 statusCollector.setPathPool(pp); | 47 statusCollector.setPathPool(pp); |
47 changeset = new HgChangeset(statusCollector, pp); | 48 changeset = new HgChangeset(statusCollector, pp); |
49 changeset.setParentHelper(pw); | |
48 handler = delegate; | 50 handler = delegate; |
49 } | 51 } |
50 | 52 |
51 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { | 53 public void next(int revisionNumber, Nodeid nodeid, RawChangeset cset) { |
52 if (branches != null && !branches.contains(cset.branch())) { | 54 if (branches != null && !branches.contains(cset.branch())) { |