Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgDirstate.java @ 332:72c6eda838a6
NPE in HgDirstate.known() when no dirstate file present
| author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
|---|---|
| date | Wed, 09 Nov 2011 04:33:44 +0100 |
| parents | 981f9f50bb6c |
| children | a0864b2892cd |
comparison
equal
deleted
inserted
replaced
| 331:a37ce7145c3f | 332:72c6eda838a6 |
|---|---|
| 73 canonicalPathRewrite = canonicalPath; | 73 canonicalPathRewrite = canonicalPath; |
| 74 } | 74 } |
| 75 | 75 |
| 76 private void read() { | 76 private void read() { |
| 77 normal = added = removed = merged = Collections.<Path, Record>emptyMap(); | 77 normal = added = removed = merged = Collections.<Path, Record>emptyMap(); |
| 78 if (canonicalPathRewrite != null) { | |
| 79 canonical2dirstateName = new HashMap<Path,Path>(); | |
| 80 } else { | |
| 81 canonical2dirstateName = Collections.emptyMap(); | |
| 82 } | |
| 78 if (dirstateFile == null || !dirstateFile.exists()) { | 83 if (dirstateFile == null || !dirstateFile.exists()) { |
| 79 return; | 84 return; |
| 80 } | 85 } |
| 81 DataAccess da = repo.getDataAccess().create(dirstateFile); | 86 DataAccess da = repo.getDataAccess().create(dirstateFile); |
| 82 if (da.isEmpty()) { | 87 if (da.isEmpty()) { |
| 85 // not sure linked is really needed here, just for ease of debug | 90 // not sure linked is really needed here, just for ease of debug |
| 86 normal = new LinkedHashMap<Path, Record>(); | 91 normal = new LinkedHashMap<Path, Record>(); |
| 87 added = new LinkedHashMap<Path, Record>(); | 92 added = new LinkedHashMap<Path, Record>(); |
| 88 removed = new LinkedHashMap<Path, Record>(); | 93 removed = new LinkedHashMap<Path, Record>(); |
| 89 merged = new LinkedHashMap<Path, Record>(); | 94 merged = new LinkedHashMap<Path, Record>(); |
| 90 if (canonicalPathRewrite != null) { | |
| 91 canonical2dirstateName = new HashMap<Path,Path>(); | |
| 92 } else { | |
| 93 canonical2dirstateName = Collections.emptyMap(); | |
| 94 } | |
| 95 try { | 95 try { |
| 96 parents = internalReadParents(da); | 96 parents = internalReadParents(da); |
| 97 // hg init; hg up produces an empty repository where dirstate has parents (40 bytes) only | 97 // hg init; hg up produces an empty repository where dirstate has parents (40 bytes) only |
| 98 while (!da.isEmpty()) { | 98 while (!da.isEmpty()) { |
| 99 final byte state = da.readByte(); | 99 final byte state = da.readByte(); |
