Mercurial > hg4j
comparison src/org/tmatesoft/hg/core/HgLogCommand.java @ 142:37a34044e6bd
More reasonable use of path normalizer and path.source
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Thu, 17 Feb 2011 05:06:07 +0100 |
| parents | 4a948ec83980 |
| children | 1a7a9a20e1f9 |
comparison
equal
deleted
inserted
replaced
| 141:8248aae33f7d | 142:37a34044e6bd |
|---|---|
| 31 import org.tmatesoft.hg.repo.HgDataFile; | 31 import org.tmatesoft.hg.repo.HgDataFile; |
| 32 import org.tmatesoft.hg.repo.HgRepository; | 32 import org.tmatesoft.hg.repo.HgRepository; |
| 33 import org.tmatesoft.hg.repo.HgStatusCollector; | 33 import org.tmatesoft.hg.repo.HgStatusCollector; |
| 34 import org.tmatesoft.hg.util.Path; | 34 import org.tmatesoft.hg.util.Path; |
| 35 import org.tmatesoft.hg.util.PathPool; | 35 import org.tmatesoft.hg.util.PathPool; |
| 36 import org.tmatesoft.hg.util.PathRewrite; | |
| 36 | 37 |
| 37 | 38 |
| 38 /** | 39 /** |
| 39 * Access to changelog, 'hg log' command counterpart. | 40 * Access to changelog, 'hg log' command counterpart. |
| 40 * | 41 * |
| 146 // multiple? Bad idea, would need to include extra method into Handler to tell start of next file | 147 // multiple? Bad idea, would need to include extra method into Handler to tell start of next file |
| 147 this.file = file; | 148 this.file = file; |
| 148 followHistory = followCopyRename; | 149 followHistory = followCopyRename; |
| 149 return this; | 150 return this; |
| 150 } | 151 } |
| 152 | |
| 153 /** | |
| 154 * Handy analog of {@link #file(Path, boolean)} when clients' paths come from filesystem and need conversion to repository's | |
| 155 */ | |
| 156 public HgLogCommand file(String file, boolean followCopyRename) { | |
| 157 return file(Path.create(repo.getToRepoPathHelper().rewrite(file)), followCopyRename); | |
| 158 } | |
| 151 | 159 |
| 152 /** | 160 /** |
| 153 * Similar to {@link #execute(org.tmatesoft.hg.repo.Changeset.Inspector)}, collects and return result as a list. | 161 * Similar to {@link #execute(org.tmatesoft.hg.repo.Changeset.Inspector)}, collects and return result as a list. |
| 154 */ | 162 */ |
| 155 public List<HgChangeset> execute() { | 163 public List<HgChangeset> execute() { |
| 172 throw new ConcurrentModificationException(); | 180 throw new ConcurrentModificationException(); |
| 173 } | 181 } |
| 174 try { | 182 try { |
| 175 delegate = handler; | 183 delegate = handler; |
| 176 count = 0; | 184 count = 0; |
| 177 changeset = new HgChangeset(new HgStatusCollector(repo), new PathPool(repo.getPathHelper())); | 185 HgStatusCollector statusCollector = new HgStatusCollector(repo); |
| 186 // files listed in a changeset don't need their names to be rewritten (they are normalized already) | |
| 187 PathPool pp = new PathPool(new PathRewrite.Empty()); | |
| 188 // #file(String, boolean) above may utilize PathPool as well. CommandContext? | |
| 189 statusCollector.setPathPool(pp); | |
| 190 changeset = new HgChangeset(statusCollector, pp); | |
| 178 if (file == null) { | 191 if (file == null) { |
| 179 repo.getChangelog().range(startRev, endRev, this); | 192 repo.getChangelog().range(startRev, endRev, this); |
| 180 } else { | 193 } else { |
| 181 HgDataFile fileNode = repo.getFileNode(file); | 194 HgDataFile fileNode = repo.getFileNode(file); |
| 182 fileNode.history(startRev, endRev, this); | 195 fileNode.history(startRev, endRev, this); |
