本文整理汇总了Java中org.tmatesoft.svn.core.io.SVNRepository.log方法的典型用法代码示例。如果您正苦于以下问题:Java SVNRepository.log方法的具体用法?Java SVNRepository.log怎么用?Java SVNRepository.log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.tmatesoft.svn.core.io.SVNRepository
的用法示例。
在下文中一共展示了SVNRepository.log方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLastRevision
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private long getLastRevision(boolean deleted) throws SVNException {
SVNRepository repository = getStore().getRepository();
if (repository.getLatestRevision() == 0) {
//new repository cannot hold a revision yet (MCR-1196)
return -1;
}
final String path = getFilePath();
String dir = getDirectory();
LastRevisionLogHandler lastRevisionLogHandler = new LastRevisionLogHandler(path, deleted);
int limit = 0; //we stop through LastRevisionFoundException
try {
repository.log(new String[] { dir }, repository.getLatestRevision(), 0, true, true, limit, false, null,
lastRevisionLogHandler);
} catch (LastRevisionFoundException ignored) {
}
return lastRevisionLogHandler.getLastRevision();
}
示例2: getLastRevision
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private long getLastRevision(@Nonnull SVNRepository repository, @Nonnull String path) throws SVNException {
String folder = RecordPath.from(path).getFolder();
List<SVNLogEntry> entries;
synchronized (pathEntries) {
entries = pathEntries.get(folder);
if (entries == null) {
entries = new ArrayList<>();
repository.log(new String[] { folder }, 0, revision, true, false, entries::add);
pathEntries.put(folder, entries);
}
}
long last = -1;
for (SVNLogEntry entry : entries) {
for (String changedPath : entry.getChangedPaths().keySet()) {
if (changedPath.endsWith(path)) {
last = entry.getRevision() - 1;
}
}
}
return last;
}
示例3: getCurrentRevision
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public String getCurrentRevision() throws Exception {
SVNRepository svnRepository = getSVNRepository(repositoryURL, username, password);
Collection<SVNLogEntry> c = (Collection<SVNLogEntry>) svnRepository.log(new String[] { "" }, null, 0, -1, true,
true);
long prev = -2;
long head = -1;
for (SVNLogEntry o : c) {
if (prev == -2)
prev = -1;
else
prev = head;
head = o.getRevision();
}
return prev + "";
}
示例4: commitUpdatePropertiesRoot
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Check commit .gitattributes.
*
* @throws Exception
*/
@Test
public void commitUpdatePropertiesRoot() throws Exception {
//Map<String, String> props = new HashMap<>()["key":""];
try (SvnTestServer server = SvnTestServer.createEmpty()) {
final SVNRepository repo = server.openSvnRepository();
createFile(repo, "/sample.txt", "", propsEolNative);
checkFileProp(repo, "/sample.txt", propsEolNative);
createFile(repo, "/.gitattributes", "*.txt\t\t\ttext eol=lf\n", propsEolNative);
// After commit .gitattributes file sample.txt must change property svn:eol-style automagically.
checkFileProp(repo, "/sample.txt", propsEolLf);
// After commit .gitattributes directory with .gitattributes must change property svn:auto-props automagically.
checkDirProp(repo, "/", propsAutoProps);
// After commit .gitattributes file sample.txt must change property svn:eol-style automagically.
{
final Set<String> changed = new HashSet<>();
repo.log(new String[]{""}, repo.getLatestRevision(), repo.getLatestRevision(), true, false, logEntry -> changed.addAll(logEntry.getChangedPaths().keySet()));
Assert.assertTrue(changed.contains("/"));
Assert.assertTrue(changed.contains("/.gitattributes"));
Assert.assertTrue(changed.contains("/sample.txt"));
Assert.assertEquals(changed.size(), 3);
}
}
}
示例5: listVersions
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Lists all versions of this metadata object available in the subversion
* repository
*
* @return all stored versions of this metadata object
*/
@SuppressWarnings("unchecked")
public List<MCRMetadataVersion> listVersions() throws IOException {
try {
List<MCRMetadataVersion> versions = new ArrayList<>();
SVNRepository repository = getStore().getRepository();
String path = getFilePath();
String dir = getDirectory();
Collection<SVNLogEntry> entries = null;
try {
entries = repository.log(new String[] { dir }, null, 0, repository.getLatestRevision(), true, true);
} catch (Exception ioex) {
LOGGER.error("Could not get versions", ioex);
return versions;
}
for (SVNLogEntry entry : entries) {
SVNLogEntryPath svnLogEntryPath = entry.getChangedPaths().get(path);
if (svnLogEntryPath != null) {
char type = svnLogEntryPath.getType();
versions.add(new MCRMetadataVersion(this, entry, type));
}
}
return versions;
} catch (SVNException svnExc) {
throw new IOException(svnExc);
}
}
示例6: getRevision
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public MCRMetadataVersion getRevision(long revision) throws IOException {
try {
if (revision < 0) {
revision = getLastPresentRevision();
if (revision < 0) {
LOGGER.warn(
MessageFormat.format("Metadata object {0} in store {1} has no last revision!", getID(),
getStore().getID()));
return null;
}
}
SVNRepository repository = getStore().getRepository();
String path = getFilePath();
String dir = getDirectory();
@SuppressWarnings("unchecked")
Collection<SVNLogEntry> log = repository.log(new String[] { dir }, null, revision, revision, true, true);
for (SVNLogEntry logEntry : log) {
SVNLogEntryPath svnLogEntryPath = logEntry.getChangedPaths().get(path);
if (svnLogEntryPath != null) {
char type = svnLogEntryPath.getType();
return new MCRMetadataVersion(this, logEntry, type);
}
}
LOGGER.warn(MessageFormat.format("Metadata object {0} in store {1} has no revision ''{2}''!", getID(),
getStore().getID(),
getRevision()));
return null;
} catch (SVNException svnExc) {
throw new IOException(svnExc);
}
}
示例7: getAllLogs
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
public Collection<SVNLogEntry> getAllLogs(String relativePath, long startRevision, long endRevision) throws SVNException {
SVNRepository repository = getRepository();
@SuppressWarnings("unchecked")
Collection<SVNLogEntry> logEntries = repository.log(new String[] { relativePath }, null, startRevision, endRevision, true, true);
return logEntries;
}
示例8: getPackageFiles
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private List<String> getPackageFiles(SVNRepository repository, String marker) throws SVNException {
List<String> files = new ArrayList<String>();
SVNDirEntry info = repository.info(".", -1);
long endRevision = info.getRevision();
long startRevision = endRevision - 15;
Collection entries = repository.log(new String[]{""}, null, startRevision, endRevision, true, true);
for (Object entry : entries) {
SVNLogEntry logEntry = (SVNLogEntry)entry;
Map<String, SVNLogEntryPath> paths = logEntry.getChangedPaths();
if (logEntry.getMessage().contains(marker)) {
System.out.println("Revision: " + logEntry.getRevision());
for (String pathKey : paths.keySet()) {
SVNLogEntryPath path = paths.get(pathKey);
if (path.getKind() != SVNNodeKind.FILE) {
continue;
}
if (path.getType() != SVNLogEntryPath.TYPE_DELETED) {
files.add(path.getPath());
}
System.out.println(path);
}
}
}
return files;
}
示例9: getFirstRevision
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Cache the log?
*/
@Override
public String getFirstRevision() throws Exception {
SVNRepository svnRepository = getSVNRepository(repositoryURL, username, password);
Collection<?> c = svnRepository.log(new String[] { "" }, null, 0, Long.valueOf(getCurrentRevision()), true,
true);
for (Object o : c) {
return String.valueOf(((SVNLogEntry) o).getRevision());
}
return null;
}
示例10: checkCopyFrom
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private void checkCopyFrom(@NotNull SVNRepository repo, @NotNull CopyFromSVNEditor editor, long revision) throws SVNException {
final Map<String, String> copyFrom = new TreeMap<>();
repo.log(new String[]{""}, revision, revision, true, true, logEntry -> {
for (SVNLogEntryPath entry : logEntry.getChangedPaths().values()) {
if (entry.getCopyPath() != null) {
copyFrom.put(entry.getPath(), entry.getCopyPath() + "@" + entry.getCopyRevision());
}
}
});
Assert.assertEquals(editor.getCopyFrom(), copyFrom);
}
示例11: loadUpdateRevisions
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
@NotNull
private List<Long> loadUpdateRevisions(@NotNull SVNRepository repo, @NotNull String path) throws SVNException {
final long maxRevision = repo.getLatestRevision();
final LinkedList<Long> revisions = new LinkedList<>();
repo.log(new String[]{path}, maxRevision, 0, false, false, logEntry -> revisions.addFirst(logEntry.getRevision()));
return new ArrayList<>(revisions);
}
示例12: checkLogLimit
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
private void checkLogLimit(@NotNull SVNRepository repo, long r1, long r2, int limit, @NotNull String path, @NotNull LogEntry... expecteds) throws SVNException {
final List<LogEntry> actual = new ArrayList<>();
repo.log(new String[]{path}, r1, r2, true, false, limit, logEntry -> actual.add(new LogEntry(logEntry)));
ArrayAsserts.assertArrayEquals(expecteds, actual.toArray(new LogEntry[actual.size()]));
}
示例13: commitUpdatePropertiesSubdir
import org.tmatesoft.svn.core.io.SVNRepository; //导入方法依赖的package包/类
/**
* Check commit .gitattributes.
*
* @throws Exception
*/
@Test
public void commitUpdatePropertiesSubdir() throws Exception {
try (SvnTestServer server = SvnTestServer.createEmpty()) {
final SVNRepository repo = server.openSvnRepository();
{
final ISVNEditor editor = repo.getCommitEditor("Create directory: /foo", null, false, null);
editor.openRoot(-1);
editor.addDir("/foo", null, -1);
// Empty file.
final String emptyFile = "/foo/.keep";
editor.addFile(emptyFile, null, -1);
editor.changeFileProperty(emptyFile, SVNProperty.EOL_STYLE, SVNPropertyValue.create(SVNProperty.EOL_STYLE_NATIVE));
sendDeltaAndClose(editor, emptyFile, null, "");
// Close dir
editor.closeDir();
editor.closeDir();
editor.closeEdit();
}
createFile(repo, "/sample.txt", "", propsEolNative);
createFile(repo, "/foo/sample.txt", "", propsEolNative);
checkFileProp(repo, "/sample.txt", propsEolNative);
checkFileProp(repo, "/foo/sample.txt", propsEolNative);
createFile(repo, "/foo/.gitattributes", "*.txt\t\t\ttext eol=lf\n", propsEolNative);
// After commit .gitattributes file sample.txt must change property svn:eol-style automagically.
checkFileProp(repo, "/foo/sample.txt", propsEolLf);
checkFileProp(repo, "/sample.txt", propsEolNative);
// After commit .gitattributes directory with .gitattributes must change property svn:auto-props automagically.
checkDirProp(repo, "/foo", propsAutoProps);
// After commit .gitattributes file sample.txt must change property svn:eol-style automagically.
{
final Set<String> changed = new HashSet<>();
repo.log(new String[]{""}, repo.getLatestRevision(), repo.getLatestRevision(), true, false, logEntry -> changed.addAll(logEntry.getChangedPaths().keySet()));
Assert.assertTrue(changed.contains("/foo"));
Assert.assertTrue(changed.contains("/foo/.gitattributes"));
Assert.assertTrue(changed.contains("/foo/sample.txt"));
Assert.assertEquals(changed.size(), 3);
}
}
}