本文整理汇总了Java中git4idea.util.StringScanner.hasMoreData方法的典型用法代码示例。如果您正苦于以下问题:Java StringScanner.hasMoreData方法的具体用法?Java StringScanner.hasMoreData怎么用?Java StringScanner.hasMoreData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类git4idea.util.StringScanner
的用法示例。
在下文中一共展示了StringScanner.hasMoreData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanFiles
import git4idea.util.StringScanner; //导入方法依赖的package包/类
/**
* Scan working tree and detect locally modified files
*
* @param project the project to scan
* @param root the root to scan
* @param files the collection with files
* @throws VcsException if there problem with running git or working tree is dirty in unsupported way
*/
private static void scanFiles(Project project, VirtualFile root, List<String> files) throws VcsException {
String rootPath = root.getPath();
GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.DIFF);
h.addParameters("--name-status");
h.setSilent(true);
h.setStdoutSuppressed(true);
StringScanner s = new StringScanner(h.run());
while (s.hasMoreData()) {
if (s.isEol()) {
s.line();
continue;
}
if (s.tryConsume("M\t")) {
String path = rootPath + "/" + GitUtil.unescapePath(s.line());
files.add(path);
}
else {
throw new VcsException("Working tree is dirty in unsupported way: " + s.line());
}
}
}
示例2: parseChanges
import git4idea.util.StringScanner; //导入方法依赖的package包/类
/**
* Parse changes from lines
*
* @param project the context project
* @param vcsRoot the git root
* @param thisRevision the current revision
* @param parentRevision the parent revision for this change list
* @param s the lines to parse
* @param changes a list of changes to update
* @param ignoreNames a set of names ignored during collection of the changes
* @throws VcsException if the input format does not matches expected format
*/
public static void parseChanges(Project project,
VirtualFile vcsRoot,
@Nullable GitRevisionNumber thisRevision,
GitRevisionNumber parentRevision,
String s,
Collection<Change> changes,
final Set<String> ignoreNames) throws VcsException {
StringScanner sc = new StringScanner(s);
parseChanges(project, vcsRoot, thisRevision, parentRevision, sc, changes, ignoreNames);
if (sc.hasMoreData()) {
throw new IllegalStateException("Unknown file status: " + sc.line());
}
}
示例3: load
import git4idea.util.StringScanner; //导入方法依赖的package包/类
@NotNull
public List<GitRebaseEntry> load() throws IOException, NoopException {
String encoding = GitConfigUtil.getLogEncoding(myProject, myRoot);
List<GitRebaseEntry> entries = ContainerUtil.newArrayList();
final StringScanner s = new StringScanner(FileUtil.loadFile(new File(myFile), encoding));
boolean noop = false;
while (s.hasMoreData()) {
if (s.isEol() || s.startsWith('#')) {
s.nextLine();
continue;
}
if (s.startsWith("noop")) {
noop = true;
s.nextLine();
continue;
}
String action = s.spaceToken();
String hash = s.spaceToken();
String comment = s.line();
entries.add(new GitRebaseEntry(action, hash, comment));
}
if (noop && entries.isEmpty()) {
throw new NoopException();
}
return entries;
}
示例4: parseRemoteListInternal
import git4idea.util.StringScanner; //导入方法依赖的package包/类
/**
* Parse list of remotes (internal method)
*
* @param output the output to parse
* @return list of remotes
*/
public static List<GitDeprecatedRemote> parseRemoteListInternal(String output) {
ArrayList<GitDeprecatedRemote> remotes = new ArrayList<GitDeprecatedRemote>();
StringScanner s = new StringScanner(output);
String name = null;
String fetch = null;
String push = null;
while (s.hasMoreData()) {
String n = s.tabToken();
if (name != null && !n.equals(name) && fetch != null) {
if (push == null) {
push = fetch;
}
remotes.add(new GitDeprecatedRemote(name, fetch, push));
fetch = null;
push = null;
}
name = n;
String url = s.line();
if (url.endsWith(" (push)")) {
push = url.substring(0, url.length() - " (push)".length());
}
else if (url.endsWith(" (fetch)")) {
fetch = url.substring(0, url.length() - " (fetch)".length());
}
else {
fetch = url;
push = url;
}
}
if (name != null && fetch != null) {
if (push == null) {
push = fetch;
}
remotes.add(new GitDeprecatedRemote(name, fetch, push));
}
return remotes;
}