Mercurial > jhg
comparison src/org/tmatesoft/hg/repo/HgInternals.java @ 229:1ec6b327a6ac
Scope for status reworked: explicit files or a general matcher
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 31 May 2011 05:23:07 +0200 |
parents | 1a7a9a20e1f9 |
children | 6e1373b54e9b |
comparison
equal
deleted
inserted
replaced
228:fffe4f882248 | 229:1ec6b327a6ac |
---|---|
21 import java.io.File; | 21 import java.io.File; |
22 import java.net.InetAddress; | 22 import java.net.InetAddress; |
23 import java.net.UnknownHostException; | 23 import java.net.UnknownHostException; |
24 | 24 |
25 import org.tmatesoft.hg.internal.ConfigFile; | 25 import org.tmatesoft.hg.internal.ConfigFile; |
26 import org.tmatesoft.hg.internal.Experimental; | |
27 import org.tmatesoft.hg.internal.RelativePathRewrite; | |
28 import org.tmatesoft.hg.util.FileIterator; | |
29 import org.tmatesoft.hg.util.FileWalker; | |
26 import org.tmatesoft.hg.util.Path; | 30 import org.tmatesoft.hg.util.Path; |
31 import org.tmatesoft.hg.util.PathRewrite; | |
27 | 32 |
28 | 33 |
29 /** | 34 /** |
30 * DO NOT USE THIS CLASS, INTENDED FOR TESTING PURPOSES. | 35 * DO NOT USE THIS CLASS, INTENDED FOR TESTING PURPOSES. |
31 * | 36 * |
37 * This class gives access to repository internals, and holds methods that I'm not confident have to be widely accessible | |
32 * Debug helper, to access otherwise restricted (package-local) methods | 38 * Debug helper, to access otherwise restricted (package-local) methods |
33 * | 39 * |
34 * @author Artem Tikhomirov | 40 * @author Artem Tikhomirov |
35 * @author TMate Software Ltd. | 41 * @author TMate Software Ltd. |
36 | |
37 */ | 42 */ |
43 @Experimental(reason="Perhaps, shall split methods with debug purpose from methods that are experimental API") | |
38 public class HgInternals { | 44 public class HgInternals { |
39 | 45 |
40 private final HgRepository repo; | 46 private final HgRepository repo; |
41 | 47 |
42 public HgInternals(HgRepository hgRepo) { | 48 public HgInternals(HgRepository hgRepo) { |
84 return username + '@' + hostname; | 90 return username + '@' + hostname; |
85 } catch (UnknownHostException ex) { | 91 } catch (UnknownHostException ex) { |
86 return username; | 92 return username; |
87 } | 93 } |
88 } | 94 } |
95 | |
96 @Experimental(reason="Don't want to expose io.File from HgRepository; need to create FileIterator for working dir. Need a place to keep that code") | |
97 /*package-local*/ FileIterator createWorkingDirWalker(Path.Matcher workindDirScope) { | |
98 File repoRoot = repo.getRepositoryRoot().getParentFile(); | |
99 Path.Source pathSrc = new Path.SimpleSource(new PathRewrite.Composite(new RelativePathRewrite(repoRoot), repo.getToRepoPathHelper())); | |
100 // Impl note: simple source is enough as files in the working dir are all unique | |
101 // even if they might get reused (i.e. after FileIterator#reset() and walking once again), | |
102 // path caching is better to be done in the code which knows that path are being reused | |
103 return new FileWalker(repoRoot, pathSrc, workindDirScope); | |
104 } | |
105 | |
89 | 106 |
90 // Convenient check of local revision number for validity (not all negative values are wrong as long as we use negative constants) | 107 // Convenient check of local revision number for validity (not all negative values are wrong as long as we use negative constants) |
91 public static boolean wrongLocalRevision(int rev) { | 108 public static boolean wrongLocalRevision(int rev) { |
92 return rev < 0 && rev != TIP && rev != WORKING_COPY && rev != BAD_REVISION; | 109 return rev < 0 && rev != TIP && rev != WORKING_COPY && rev != BAD_REVISION; |
93 } | 110 } |