当前位置: 首页>>代码示例>>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;未经允许,请勿转载。