Mercurial > hg4j
comparison src/org/tmatesoft/hg/repo/HgInternals.java @ 128:44b97930570c
Introduced ChangelogHelper to look up changesets files were modified in
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 16 Feb 2011 20:13:41 +0100 |
parents | 46291ec605a0 |
children | 37a34044e6bd |
comparison
equal
deleted
inserted
replaced
127:2e395db595e2 | 128:44b97930570c |
---|---|
15 * contact TMate Software at support@hg4j.com | 15 * contact TMate Software at support@hg4j.com |
16 */ | 16 */ |
17 package org.tmatesoft.hg.repo; | 17 package org.tmatesoft.hg.repo; |
18 | 18 |
19 import java.io.File; | 19 import java.io.File; |
20 import java.net.InetAddress; | |
21 import java.net.UnknownHostException; | |
20 | 22 |
21 import org.tmatesoft.hg.internal.ConfigFile; | 23 import org.tmatesoft.hg.internal.ConfigFile; |
22 | 24 |
23 | 25 |
24 /** | 26 /** |
56 } | 58 } |
57 | 59 |
58 public ConfigFile getRepoConfig() { | 60 public ConfigFile getRepoConfig() { |
59 return repo.getConfigFile(); | 61 return repo.getConfigFile(); |
60 } | 62 } |
63 | |
64 // in fact, need a setter for this anyway, shall move to internal.Internals perhaps? | |
65 public String getNextCommitUsername() { | |
66 String hgUser = System.getenv("HGUSER"); | |
67 if (hgUser != null && hgUser.trim().length() > 0) { | |
68 return hgUser.trim(); | |
69 } | |
70 String configValue = getRepoConfig().getString("ui", "username", null); | |
71 if (configValue != null) { | |
72 return configValue; | |
73 } | |
74 String email = System.getenv("EMAIL"); | |
75 if (email != null && email.trim().length() > 0) { | |
76 return email; | |
77 } | |
78 String username = System.getProperty("user.name"); | |
79 try { | |
80 String hostname = InetAddress.getLocalHost().getHostName(); | |
81 return username + '@' + hostname; | |
82 } catch (UnknownHostException ex) { | |
83 return username; | |
84 } | |
85 } | |
61 } | 86 } |