Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgInternals.java @ 348:a0864b2892cd
Expose errors reading mercurial control files with exception
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Thu, 24 Nov 2011 02:57:03 +0100 |
parents | 8da7ade36c57 |
children | 2fadf8695f8a |
comparison
equal
deleted
inserted
replaced
347:8da7ade36c57 | 348:a0864b2892cd |
---|---|
23 import java.io.IOException; | 23 import java.io.IOException; |
24 import java.io.Reader; | 24 import java.io.Reader; |
25 import java.net.InetAddress; | 25 import java.net.InetAddress; |
26 import java.net.UnknownHostException; | 26 import java.net.UnknownHostException; |
27 | 27 |
28 import org.tmatesoft.hg.core.HgInvalidControlFileException; | |
28 import org.tmatesoft.hg.core.HgInvalidRevisionException; | 29 import org.tmatesoft.hg.core.HgInvalidRevisionException; |
29 import org.tmatesoft.hg.core.SessionContext; | 30 import org.tmatesoft.hg.core.SessionContext; |
30 import org.tmatesoft.hg.internal.Experimental; | 31 import org.tmatesoft.hg.internal.Experimental; |
31 import org.tmatesoft.hg.internal.RelativePathRewrite; | 32 import org.tmatesoft.hg.internal.RelativePathRewrite; |
32 import org.tmatesoft.hg.util.FileIterator; | 33 import org.tmatesoft.hg.util.FileIterator; |
52 | 53 |
53 public HgInternals(HgRepository hgRepo) { | 54 public HgInternals(HgRepository hgRepo) { |
54 repo = hgRepo; | 55 repo = hgRepo; |
55 } | 56 } |
56 | 57 |
57 public void dumpDirstate() { | 58 public HgDirstate getDirstate() throws HgInvalidControlFileException { |
58 getDirstate().dump(); | |
59 } | |
60 | |
61 public HgDirstate getDirstate() { | |
62 return repo.loadDirstate(new PathPool(new PathRewrite.Empty())); | 59 return repo.loadDirstate(new PathPool(new PathRewrite.Empty())); |
63 } | 60 } |
64 | 61 |
65 // tests | 62 // tests |
66 public HgDirstate createDirstate(boolean caseSensitiveFileSystem) { | 63 public HgDirstate createDirstate(boolean caseSensitiveFileSystem) throws HgInvalidControlFileException { |
67 PathRewrite canonicalPath = null; | 64 PathRewrite canonicalPath = null; |
68 if (!caseSensitiveFileSystem) { | 65 if (!caseSensitiveFileSystem) { |
69 canonicalPath = new PathRewrite() { | 66 canonicalPath = new PathRewrite() { |
70 | 67 |
71 public CharSequence rewrite(CharSequence path) { | 68 public CharSequence rewrite(CharSequence path) { |
72 return path.toString().toLowerCase(); | 69 return path.toString().toLowerCase(); |
73 } | 70 } |
74 }; | 71 }; |
75 } | 72 } |
76 return new HgDirstate(repo, new File(repo.getRepositoryRoot(), "dirstate"), new PathPool(new PathRewrite.Empty()), canonicalPath); | 73 HgDirstate ds = new HgDirstate(repo, new File(repo.getRepositoryRoot(), "dirstate"), new PathPool(new PathRewrite.Empty()), canonicalPath); |
74 ds.read(); | |
75 return ds; | |
77 } | 76 } |
78 | 77 |
79 public Path[] checkKnown(HgDirstate dirstate, Path[] toCheck) { | 78 public Path[] checkKnown(HgDirstate dirstate, Path[] toCheck) { |
80 Path[] rv = new Path[toCheck.length]; | 79 Path[] rv = new Path[toCheck.length]; |
81 for (int i = 0; i < toCheck.length; i++) { | 80 for (int i = 0; i < toCheck.length; i++) { |