当前位置: 首页>>代码示例>>Java>>正文


Java FileMode.REGULAR_FILE属性代码示例

本文整理汇总了Java中org.eclipse.jgit.lib.FileMode.REGULAR_FILE属性的典型用法代码示例。如果您正苦于以下问题:Java FileMode.REGULAR_FILE属性的具体用法?Java FileMode.REGULAR_FILE怎么用?Java FileMode.REGULAR_FILE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.eclipse.jgit.lib.FileMode的用法示例。


在下文中一共展示了FileMode.REGULAR_FILE属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: scanDashboards

private List<DashboardInfo> scanDashboards(
    Project definingProject,
    Repository git,
    RevWalk rw,
    Ref ref,
    String project,
    boolean setDefault)
    throws IOException {
  List<DashboardInfo> list = new ArrayList<>();
  try (TreeWalk tw = new TreeWalk(rw.getObjectReader())) {
    tw.addTree(rw.parseTree(ref.getObjectId()));
    tw.setRecursive(true);
    while (tw.next()) {
      if (tw.getFileMode(0) == FileMode.REGULAR_FILE) {
        try {
          list.add(
              DashboardsCollection.parse(
                  definingProject,
                  ref.getName().substring(REFS_DASHBOARDS.length()),
                  tw.getPathString(),
                  new BlobBasedConfig(null, git, tw.getObjectId(0)),
                  project,
                  setDefault));
        } catch (ConfigInvalidException e) {
          log.warn(
              String.format(
                  "Cannot parse dashboard %s:%s:%s: %s",
                  definingProject.getName(), ref.getName(), tw.getPathString(), e.getMessage()));
        }
      }
    }
  }
  return list;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:34,代码来源:ListDashboards.java

示例2: onLoad

@Override
protected void onLoad() throws IOException, ConfigInvalidException {
  String prefix = DestinationList.DIR_NAME + "/";
  for (PathInfo p : getPathInfos(true)) {
    if (p.fileMode == FileMode.REGULAR_FILE) {
      String path = p.path;
      if (path.startsWith(prefix)) {
        String label = path.substring(prefix.length());
        ValidationError.Sink errors = TabFile.createLoggerSink(path, log);
        destinations.parseLabel(label, readUTF8(path), errors);
      }
    }
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:VersionedAccountDestinations.java

示例3: getBaseConfig

@Nullable
private static Config getBaseConfig(@NotNull Repository repository, @NotNull String configFileName) throws IOException, ConfigInvalidException {
	final Config baseConfig;
	if (repository.isBare()) {
		// read bugtraq config directly from the repository
		String content = null;
		RevWalk rw = new RevWalk(repository);
		try (TreeWalk tw = new TreeWalk(repository)) {
			tw.setFilter(PathFilterGroup.createFromStrings(configFileName));
			Ref head = repository.getRef(Constants.HEAD);
			if (head == null) {
				return null;
			}
			head = head.getTarget();
			if (head == null) {
				return null;
			}
			ObjectId headId = head.getObjectId();
			if (headId == null) {
				return null;
			}
			RevCommit commit = rw.parseCommit(headId);
			RevTree tree = commit.getTree();
			tw.reset(tree);
			while (tw.next()) {
				ObjectId entid = tw.getObjectId(0);
				FileMode entmode = tw.getFileMode(0);
				if (FileMode.REGULAR_FILE == entmode) {
					ObjectLoader ldr = repository.open(entid, Constants.OBJ_BLOB);
					content = new String(ldr.getCachedBytes(), commit.getEncoding());
					break;
				}
			}
		} finally {
			rw.close();
			rw.dispose();
		}

		if (content == null) {
			// config not found
			baseConfig = null;
		} else {
			// parse the config
			Config config = new Config();
			config.fromText(content);
			baseConfig = config;
		}
	} else {
		// read bugtraq config from work tree
		final File baseFile = new File(repository.getWorkTree(), configFileName);
		if (baseFile.isFile()) {
			FileBasedConfig fileConfig = new FileBasedConfig(baseFile, repository.getFS());
			fileConfig.load();
			baseConfig = fileConfig;
		} else {
			baseConfig = null;
		}
	}
	return baseConfig;
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:60,代码来源:BugtraqConfig.java

示例4: createChild

@NotNull
@Override
public GitEntry createChild(@NotNull String name, boolean isDir) {
  return new GitEntryImpl(props, getFullPath(), GitProperty.emptyArray, name, isDir ? FileMode.TREE : FileMode.REGULAR_FILE);
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:5,代码来源:GitEntryImpl.java

示例5: createChild

@NotNull
@Override
default GitEntry createChild(@NotNull String name, boolean isDir) {
  return new GitEntryImpl(getRawProperties(), getFullPath(), GitProperty.emptyArray, name, isDir ? FileMode.TREE : FileMode.REGULAR_FILE);
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:5,代码来源:GitFile.java

示例6: createForPath

@NotNull
private static GitProperty[] createForPath(@NotNull GitProperty[] baseProps, @NotNull String path) {
  GitProperty[] props = baseProps;
  String[] pathItems = path.split("/");
  for (int i = 0; i < pathItems.length; ++i) {
    final String name = pathItems[i];
    if (!name.isEmpty()) {
      final FileMode mode = i == pathItems.length - 1 ? FileMode.REGULAR_FILE : FileMode.TREE;
      props = createForChild(props, name, mode);
    }
  }
  return props;
}
 
开发者ID:bozaro,项目名称:git-as-svn,代码行数:13,代码来源:GitEolTest.java


注:本文中的org.eclipse.jgit.lib.FileMode.REGULAR_FILE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。