Mercurial > jhg
comparison src/org/tmatesoft/hg/core/HgCloneCommand.java @ 571:e4ee4bf4c7d0
Let session context control creation of Path instances
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Thu, 11 Apr 2013 16:27:06 +0200 |
| parents | 9edfd5a223b8 |
| children | 5e0313485eef |
comparison
equal
deleted
inserted
replaced
| 570:36853bb80a35 | 571:e4ee4bf4c7d0 |
|---|---|
| 144 private final File hgDir; | 144 private final File hgDir; |
| 145 private final PathRewrite storagePathHelper; | 145 private final PathRewrite storagePathHelper; |
| 146 private final ProgressSupport progressSupport; | 146 private final ProgressSupport progressSupport; |
| 147 private final CancelSupport cancelSupport; | 147 private final CancelSupport cancelSupport; |
| 148 private final SessionContext ctx; | 148 private final SessionContext ctx; |
| 149 private final Path.Source pathFactory; | |
| 149 private FileOutputStream indexFile; | 150 private FileOutputStream indexFile; |
| 150 private String filename; // human-readable name of the file being written, for log/exception purposes | 151 private String filename; // human-readable name of the file being written, for log/exception purposes |
| 151 | 152 |
| 152 private final TreeMap<Nodeid, Integer> changelogIndexes = new TreeMap<Nodeid, Integer>(); | 153 private final TreeMap<Nodeid, Integer> changelogIndexes = new TreeMap<Nodeid, Integer>(); |
| 153 private boolean collectChangelogIndexes = false; | 154 private boolean collectChangelogIndexes = false; |
| 172 repoInit.setRequires(STORE | FNCACHE | DOTENCODE); | 173 repoInit.setRequires(STORE | FNCACHE | DOTENCODE); |
| 173 storagePathHelper = repoInit.buildDataFilesHelper(sessionCtx); | 174 storagePathHelper = repoInit.buildDataFilesHelper(sessionCtx); |
| 174 progressSupport = progress; | 175 progressSupport = progress; |
| 175 cancelSupport = cancel; | 176 cancelSupport = cancel; |
| 176 revlogDataZip = new RevlogCompressor(sessionCtx); | 177 revlogDataZip = new RevlogCompressor(sessionCtx); |
| 178 pathFactory = ctx.getPathFactory(); | |
| 177 } | 179 } |
| 178 | 180 |
| 179 public void initEmptyRepository() throws IOException { | 181 public void initEmptyRepository() throws IOException { |
| 180 repoInit.initEmptyRepository(hgDir); | 182 repoInit.initEmptyRepository(hgDir); |
| 181 try { | 183 try { |
| 241 | 243 |
| 242 public void fileStart(String name) { | 244 public void fileStart(String name) { |
| 243 try { | 245 try { |
| 244 revlogHeader.offset(0).baseRevision(-1); | 246 revlogHeader.offset(0).baseRevision(-1); |
| 245 revisionSequence.clear(); | 247 revisionSequence.clear(); |
| 246 fncacheFile.add(Path.create(name)); | 248 fncacheFile.add(pathFactory.path(name)); |
| 247 File file = new File(hgDir, filename = storagePathHelper.rewrite(name).toString()); | 249 File file = new File(hgDir, filename = storagePathHelper.rewrite(name).toString()); |
| 248 file.getParentFile().mkdirs(); | 250 file.getParentFile().mkdirs(); |
| 249 indexFile = new FileOutputStream(file); | 251 indexFile = new FileOutputStream(file); |
| 250 } catch (IOException ex) { | 252 } catch (IOException ex) { |
| 251 String m = String.format("Failed to write file %s", filename); | 253 String m = String.format("Failed to write file %s", filename); |
