當前位置: 首頁>>代碼示例>>Java>>正文


Java StoredConfig.getStringList方法代碼示例

本文整理匯總了Java中org.eclipse.jgit.lib.StoredConfig.getStringList方法的典型用法代碼示例。如果您正苦於以下問題:Java StoredConfig.getStringList方法的具體用法?Java StoredConfig.getStringList怎麽用?Java StoredConfig.getStringList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jgit.lib.StoredConfig的用法示例。


在下文中一共展示了StoredConfig.getStringList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMappedBranches

import org.eclipse.jgit.lib.StoredConfig; //導入方法依賴的package包/類
private Map<String, String> getMappedBranches(
    final TfsGitRepositoryJson serverRepository,
    final Repository localRepository) {
    Map<String, String> mappedBranches = null;
    String upstreamURL = serverRepository.getRemoteUrl();
    try {
        upstreamURL = URIUtil.encodePath(serverRepository.getRemoteUrl());
    } catch (final URIException e) {
        log.error("Error encoding repository URL " + upstreamURL, e); //$NON-NLS-1$
    }

    final StoredConfig repositoryConfig = localRepository.getConfig();
    final Set<String> remotes = repositoryConfig.getSubsections(REMOTES_SECTION_NAME);

    for (final String remoteName : remotes) {
        final String remoteURL = repositoryConfig.getString(REMOTES_SECTION_NAME, remoteName, URL_VALUE_NAME);

        if (remoteURL != null && remoteURL.equalsIgnoreCase(upstreamURL)) {
            if (mappedBranches == null) {
                mappedBranches = new HashMap<String, String>();
            }

            final Set<String> branches = repositoryConfig.getSubsections(BRANCHES_SECTION_NAME);

            for (final String branch : branches) {
                final String fullBranchName = Constants.R_HEADS + branch;

                final String[] remoteNames =
                    repositoryConfig.getStringList(BRANCHES_SECTION_NAME, branch, REMOTE_VALUE_NAME);
                final String[] mappedBrancheNames =
                    repositoryConfig.getStringList(BRANCHES_SECTION_NAME, branch, MERGE_VALUE_NAME);

                for (int k = 0; k < remoteNames.length; k++) {
                    if (remoteNames[k].equals(remoteName)) {
                        final String remoteBranchName = mappedBrancheNames[k];

                        if (!mappedBranches.containsKey(remoteBranchName)) {
                            mappedBranches.put(remoteBranchName, fullBranchName);
                        }

                        break;
                    }
                }
            }

            break;
        }
    }

    return mappedBranches;
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:52,代碼來源:GitRepositoriesMap.java

示例2: loadRegistrations

import org.eclipse.jgit.lib.StoredConfig; //導入方法依賴的package包/類
private void loadRegistrations() {
	try {
		StoredConfig config = getConfig();
		Set<String> servers = config.getSubsections(SERVER);
		for (String server : servers) {
			Date lastLogin = new Date(0);
			String date = config.getString(SERVER, server, "lastLogin");
			if (!StringUtils.isEmpty(date)) {
				lastLogin = dateFormat.parse(date);
			}
			String url = config.getString(SERVER, server, "url");
			String account = config.getString(SERVER, server, "account");
			char[] password;
			String pw = config.getString(SERVER, server, "password");
			if (StringUtils.isEmpty(pw)) {
				password = new char[0];
			} else {
				password = new String(Base64.decode(pw)).toCharArray();
			}
			GitblitRegistration reg = new GitblitRegistration(server, url, account, password) {
				private static final long serialVersionUID = 1L;

				protected void cacheFeeds() {
					writeFeedCache(this);
				}
			};
			String[] feeds = config.getStringList(SERVER, server, FEED);
			if (feeds != null) {
				// deserialize the field definitions
				for (String definition : feeds) {
					FeedModel feed = new FeedModel(definition);
					reg.feeds.add(feed);
				}
			}
			reg.lastLogin = lastLogin;
			loadFeedCache(reg);
			registrations.put(reg.name, reg);
		}
	} catch (Throwable t) {
		Utils.showException(GitblitManager.this, t);
	}
}
 
開發者ID:warpfork,項目名稱:gitblit,代碼行數:43,代碼來源:GitblitManager.java


注:本文中的org.eclipse.jgit.lib.StoredConfig.getStringList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。