comparison src/com/tmate/hgkit/ll/LocalHgRepo.java @ 64:19e9e220bf68

Convenient commands constitute hi-level API. org.tmatesoft namespace, GPL2 statement
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 21 Jan 2011 05:56:43 +0100
parents b771e94a4f7c
children
comparison
equal deleted inserted replaced
63:a47530a2ea12 64:19e9e220bf68
11 import java.lang.ref.SoftReference; 11 import java.lang.ref.SoftReference;
12 import java.util.Arrays; 12 import java.util.Arrays;
13 import java.util.HashMap; 13 import java.util.HashMap;
14 import java.util.TreeSet; 14 import java.util.TreeSet;
15 15
16 import org.tmatesoft.hg.core.Path;
17 import org.tmatesoft.hg.util.PathRewrite;
18
16 import com.tmate.hgkit.fs.DataAccessProvider; 19 import com.tmate.hgkit.fs.DataAccessProvider;
17 import com.tmate.hgkit.fs.FileWalker; 20 import com.tmate.hgkit.fs.FileWalker;
18 21
19 /** 22 /**
20 * @author artem 23 * @author artem
22 public class LocalHgRepo extends HgRepository { 25 public class LocalHgRepo extends HgRepository {
23 26
24 private File repoDir; // .hg folder 27 private File repoDir; // .hg folder
25 private final String repoLocation; 28 private final String repoLocation;
26 private final DataAccessProvider dataAccess; 29 private final DataAccessProvider dataAccess;
30 private final PathRewrite normalizePath = new PathRewrite() {
31
32 public String rewrite(String path) {
33 return normalize(path);
34 }
35 };
27 36
28 public LocalHgRepo(String repositoryPath) { 37 public LocalHgRepo(String repositoryPath) {
29 setInvalid(true); 38 setInvalid(true);
30 repoLocation = repositoryPath; 39 repoLocation = repositoryPath;
31 dataAccess = null; 40 dataAccess = null;
100 RevlogStream content = resolve(storagePath); 109 RevlogStream content = resolve(storagePath);
101 // XXX no content when no file? or HgDataFile.exists() to detect that? How about files that were removed in previous releases? 110 // XXX no content when no file? or HgDataFile.exists() to detect that? How about files that were removed in previous releases?
102 return new HgDataFile(this, nPath, content); 111 return new HgDataFile(this, nPath, content);
103 } 112 }
104 113
114 @Override
115 public HgDataFile getFileNode(Path path) {
116 return getFileNode(path.toString());
117 }
118
119 @Override
120 public PathRewrite getPathHelper() {
121 return normalizePath;
122 }
123
105 private boolean revlogv1; 124 private boolean revlogv1;
106 private boolean store; 125 private boolean store;
107 private boolean fncache; 126 private boolean fncache;
108 private boolean dotencode; 127 private boolean dotencode;
109 128