comparison src/org/tmatesoft/hg/internal/Internals.java @ 628:6526d8adbc0f

Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 22 May 2013 15:52:31 +0200
parents 99ad1e3a4e4d
children a8ce405da1f5
comparison
equal deleted inserted replaced
627:5153eb73b18d 628:6526d8adbc0f
17 package org.tmatesoft.hg.internal; 17 package org.tmatesoft.hg.internal;
18 18
19 import static org.tmatesoft.hg.util.LogFacility.Severity.Error; 19 import static org.tmatesoft.hg.util.LogFacility.Severity.Error;
20 20
21 import java.io.File; 21 import java.io.File;
22 import java.io.IOException;
23 import java.nio.charset.Charset; 22 import java.nio.charset.Charset;
24 import java.util.ArrayList; 23 import java.util.ArrayList;
25 import java.util.Arrays; 24 import java.util.Arrays;
26 import java.util.Collections; 25 import java.util.Collections;
27 import java.util.Iterator; 26 import java.util.Iterator;
28 import java.util.LinkedHashSet; 27 import java.util.LinkedHashSet;
29 import java.util.List; 28 import java.util.List;
30 import java.util.StringTokenizer; 29 import java.util.StringTokenizer;
31 30
31 import org.tmatesoft.hg.core.HgIOException;
32 import org.tmatesoft.hg.core.SessionContext; 32 import org.tmatesoft.hg.core.SessionContext;
33 import org.tmatesoft.hg.repo.HgDataFile; 33 import org.tmatesoft.hg.repo.HgDataFile;
34 import org.tmatesoft.hg.repo.HgInternals; 34 import org.tmatesoft.hg.repo.HgInternals;
35 import org.tmatesoft.hg.repo.HgRepoConfig.ExtensionsSection; 35 import org.tmatesoft.hg.repo.HgRepoConfig.ExtensionsSection;
36 import org.tmatesoft.hg.repo.HgRepository; 36 import org.tmatesoft.hg.repo.HgRepository;
335 return null; 335 return null;
336 } 336 }
337 337
338 /** 338 /**
339 * User-specific configuration, from system-wide and user home locations, without any repository-specific data. 339 * User-specific configuration, from system-wide and user home locations, without any repository-specific data.
340 *
341 * @see http://www.selenic.com/mercurial/hgrc.5.html 340 * @see http://www.selenic.com/mercurial/hgrc.5.html
342 */ 341 */
343 public static ConfigFile readConfiguration(SessionContext sessionCtx) throws IOException { 342 public static ConfigFile readConfiguration(SessionContext sessionCtx) throws HgIOException {
344 ConfigFile configFile = new ConfigFile(sessionCtx); 343 ConfigFile configFile = new ConfigFile(sessionCtx);
345 File hgInstallRoot = findHgInstallRoot(sessionCtx); // may be null 344 File hgInstallRoot = findHgInstallRoot(sessionCtx); // may be null
346 // 345 //
347 if (runningOnWindows()) { 346 if (runningOnWindows()) {
348 if (hgInstallRoot != null) { 347 if (hgInstallRoot != null) {
384 383
385 /** 384 /**
386 * Repository-specific configuration 385 * Repository-specific configuration
387 * @see http://www.selenic.com/mercurial/hgrc.5.html 386 * @see http://www.selenic.com/mercurial/hgrc.5.html
388 */ 387 */
389 public ConfigFile readConfiguration() throws IOException { 388 public ConfigFile readConfiguration() throws HgIOException {
390 ConfigFile configFile = readConfiguration(repo.getSessionContext()); 389 ConfigFile configFile = readConfiguration(repo.getSessionContext());
391 // last one, overrides anything else 390 // last one, overrides anything else
392 // <repo>/.hg/hgrc 391 // <repo>/.hg/hgrc
393 configFile.addLocation(getFileFromRepoDir("hgrc")); 392 configFile.addLocation(getFileFromRepoDir("hgrc"));
394 return configFile; 393 return configFile;