comparison src/org/tmatesoft/hg/repo/HgInternals.java @ 331:a37ce7145c3f

Access to repository configuration
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sat, 05 Nov 2011 04:21:18 +0100
parents 650b45d290b1
children 863356c2847e
comparison
equal deleted inserted replaced
330:9747a786a34d 331:a37ce7145c3f
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.SessionContext; 28 import org.tmatesoft.hg.core.SessionContext;
29 import org.tmatesoft.hg.internal.ConfigFile;
30 import org.tmatesoft.hg.internal.Experimental; 29 import org.tmatesoft.hg.internal.Experimental;
31 import org.tmatesoft.hg.internal.RelativePathRewrite; 30 import org.tmatesoft.hg.internal.RelativePathRewrite;
32 import org.tmatesoft.hg.util.FileIterator; 31 import org.tmatesoft.hg.util.FileIterator;
33 import org.tmatesoft.hg.util.FileWalker; 32 import org.tmatesoft.hg.util.FileWalker;
34 import org.tmatesoft.hg.util.Path; 33 import org.tmatesoft.hg.util.Path;
95 94
96 public File getRepositoryDir() { 95 public File getRepositoryDir() {
97 return repo.getRepositoryRoot(); 96 return repo.getRepositoryRoot();
98 } 97 }
99 98
100 public ConfigFile getRepoConfig() {
101 return repo.getConfigFile();
102 }
103
104 public static HgIgnore newHgIgnore(Reader source) throws IOException { 99 public static HgIgnore newHgIgnore(Reader source) throws IOException {
105 HgIgnore hgIgnore = new HgIgnore(); 100 HgIgnore hgIgnore = new HgIgnore();
106 BufferedReader br = source instanceof BufferedReader ? (BufferedReader) source : new BufferedReader(source); 101 BufferedReader br = source instanceof BufferedReader ? (BufferedReader) source : new BufferedReader(source);
107 hgIgnore.read(br); 102 hgIgnore.read(br);
108 br.close(); 103 br.close();
113 public String getNextCommitUsername() { 108 public String getNextCommitUsername() {
114 String hgUser = System.getenv("HGUSER"); 109 String hgUser = System.getenv("HGUSER");
115 if (hgUser != null && hgUser.trim().length() > 0) { 110 if (hgUser != null && hgUser.trim().length() > 0) {
116 return hgUser.trim(); 111 return hgUser.trim();
117 } 112 }
118 String configValue = getRepoConfig().getString("ui", "username", null); 113 String configValue = repo.getConfiguration().getStringValue("ui", "username", null);
119 if (configValue != null) { 114 if (configValue != null) {
120 return configValue; 115 return configValue;
121 } 116 }
122 String email = System.getenv("EMAIL"); 117 String email = System.getenv("EMAIL");
123 if (email != null && email.trim().length() > 0) { 118 if (email != null && email.trim().length() > 0) {