本文整理汇总了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;
}
示例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);
}
}
}
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}