@Override public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { if (!logEntry.getMessage().equals(ourMessage)) { result.add(new Change(logEntry.getAuthor(), logEntry.getMessage())); } } });
/** * Performs a search in the repository root. * */ public Map<String, String> searchCommitLog(String _str, Date _asOf) { final Map<String,String> hits = new HashMap<String,String>(); try { // Update revision log this.updateCommitLog(_asOf); for (SVNLogEntry logEntry : this.logEntries) { if (logEntry.getMessage()!=null && logEntry.getMessage().contains(_str)) { SvnClient.log.info("Revision '" + logEntry.getRevision() + "' : " + logEntry.getMessage().trim()); hits.put(String.valueOf(logEntry.getRevision()), logEntry.getMessage().trim()); } } } catch (SVNException e) { SvnClient.log.error("Error while searching commit log: " + e.getMessage()); } return hits; }
@Override public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { for (Map.Entry<String, SVNLogEntryPath> entry : (Set<Map.Entry<String, SVNLogEntryPath>>) logEntry .getChangedPaths().entrySet()) { String path = entry.getKey(); SVNLogEntryPath value = entry.getValue(); //log if(log.isDebugEnabled()) { log.debug("path changed : " + path + " = [" + value.getType() + "] " + logEntry.getMessage()); } // handler return url as : // /isis-fish-data/trunk/scripts/version.txt // just transform in into // scripts/version.txt String relativePath = SVNPathUtil.getRelativePath(repoPath, repoRootPath + path); // tranform SVNLogEntryPath into file File file = new File(getLocalRepository().getAbsoluteFile() + File.separator + relativePath); changLog.put(file, logEntry.getMessage()); } } };
public Map<String, String> getCommitLogEntries(Set<String> _revs) {//String[] _ids) { final Map<String,String> hits = new HashMap<String,String>(); try { // Update revision log (null indicates to retrieve all log entries as of rev. 0) this.updateCommitLog(null); String id = null; for (SVNLogEntry logEntry : this.logEntries) { id = String.valueOf(logEntry.getRevision()); for(String sid: _revs) { if(!sid.equals("") && sid.equals(id)) { hits.put(sid, logEntry.getMessage().trim()); continue; } } } } catch (SVNException e) { SvnClient.log.error("Error while searching commit log: " + e.getMessage()); } return hits; }
@Override protected void doInTransactionWithoutResult(TransactionStatus transactionStatus) { try { revisionListener.accept(logEntry.getRevision()); indexInTransaction(repository, logEntry); } catch (Exception ex) { throw new SVNIndexationException(logEntry.getRevision(), logEntry.getMessage(), ex); } } });
public void handleLogEntry( SVNLogEntry logEntry ) throws SVNException { List<ChangeFile> changedFiles = new ArrayList<ChangeFile>(); for ( String changedPath : logEntry.getChangedPaths().keySet() ) { changedFiles.add( new ChangeFile( changedPath, Long.toString( logEntry.getRevision() ) ) ); } SvnChangeSet changeSet = new SvnChangeSet( logEntry.getDate(), logEntry.getMessage(), logEntry.getAuthor(), changedFiles ); changeSet.setRevision( Long.toString( logEntry.getRevision() ) ); changeSets.add( changeSet ); }
public static LogMessage createLogMessage(SVNLogEntry logEntry) { if(logEntry == null){ return null; } Map cpaths = logEntry.getChangedPaths(); ChangePath[] cp = null; if(cpaths == null){ cp = new ChangePath[]{}; }else{ Collection clientChangePaths = new ArrayList(); for (Iterator iter = cpaths.keySet().iterator(); iter.hasNext();) { String path = (String) iter.next(); SVNLogEntryPath entryPath = (SVNLogEntryPath)cpaths.get(path); if(entryPath != null){ clientChangePaths.add(new ChangePath(path, entryPath.getCopyRevision(), entryPath.getCopyPath(), entryPath.getType())); } } cp = (ChangePath[]) clientChangePaths.toArray(new ChangePath[clientChangePaths.size()]); } return new LogMessage(logEntry.getMessage(), logEntry.getDate(), logEntry.getRevision(), logEntry.getAuthor(), cp); }
private void indexIssues(SVNRepository repository, SVNLogEntry logEntry) { // Is the repository associated with any issue service? ConfiguredIssueService configuredIssueService = repository.getConfiguredIssueService(); if (configuredIssueService != null) { IssueServiceExtension issueServiceExtension = configuredIssueService.getIssueServiceExtension(); IssueServiceConfiguration issueServiceConfiguration = configuredIssueService.getIssueServiceConfiguration(); // Revision information to scan long revision = logEntry.getRevision(); String message = logEntry.getMessage(); // Cache for issues Set<String> revisionIssues = new HashSet<>(); // Gets all issues from the message Set<String> issues = issueServiceExtension.extractIssueKeysFromMessage( issueServiceConfiguration, message ); // For each issue in the message issues.stream() // Checks that the issue has not already been associated with this revision .filter(issueKey -> !revisionIssues.contains(issueKey)) // Indexes this issue .forEach(issueKey -> { revisionIssues.add(issueKey); logger.info(String.format(" Indexing revision %d <-> %s", revision, issueKey)); // Indexes this issue issueRevisionDao.link(repository.getId(), revision, issueKey); }); } }
private List<Revision> getSVNLogs(final SVNClientManager clientManager, final String[] paths, final SVNRevision startRevision, final int start, final int limit) throws StoreException.ReadException { try { final SVNLogClient logClient = clientManager.getLogClient(); final FilterableSVNLogEntryHandler handler = new FilterableSVNLogEntryHandler(); // In order to get history is "descending" order, the startRevision should be the one closer to HEAD logClient.doLog(svnUrl, paths, /* pegRevision */ SVNRevision.HEAD, startRevision, SVNRevision.create(1), /* stopOnCopy */ false, /* discoverChangedPaths */ false, /* includeMergedRevisions */ false, /* limit */ start + limit, new String[]{SVNRevisionProperty.LOG, SVNRevisionProperty.AUTHOR, SVNRevisionProperty.DATE}, handler); final List<SVNLogEntry> entries = handler.getLogEntries(); final List<Revision> revisions; if (entries.size() <= start) { revisions = Collections.emptyList(); } else { final int end = Math.min(start + limit, entries.size()); revisions = Lists.newArrayListWithCapacity(end - start); for (int i = 0; i < end - start; i++) { final SVNLogEntry entry = entries.get(start + i); revisions.add(new Revision(String.valueOf(entry.getRevision()), entry.getAuthor(), entry.getDate(), entry.getMessage())); } } return revisions; } catch (final SVNException e) { throw new StoreException.ReadException("Unable to get older revisions"); } }
private Commit createCommit(SVNLogEntry logEntry) { Developer committer = new Developer(logEntry.getAuthor(), null); Calendar date = convertToCalendar(logEntry.getDate()); Commit commit = new Commit(String.valueOf(logEntry.getRevision()), null, committer, date, date, logEntry.getMessage(), null); return commit; }
private List<Revision> getSVNLogs(final SVNClientManager clientManager, final String[] paths, final SVNRevision startRevision, final int start, final int limit) throws StoreException.ReadException { try { final SVNLogClient logClient = clientManager.getLogClient(); final FilterableSVNLogEntryHandler handler = new FilterableSVNLogEntryHandler(); // In order to get history is "descending" order, the startRevision should be the one closer to HEAD logClient.doLog(svnUrl, paths, /* pegRevision */ SVNRevision.HEAD, startRevision, SVNRevision.create(1), /* stopOnCopy */ false, /* discoverChangedPaths */ false, /* includeMergedRevisions */ false, /* limit */ start + limit, new String[]{SVNRevisionProperty.LOG, SVNRevisionProperty.AUTHOR, SVNRevisionProperty.DATE}, handler); final List<SVNLogEntry> entries = handler.getLogEntries(); final List<Revision> revisions; if (entries.size() <= start) { revisions = Collections.emptyList(); } else { final int end = Math.min(start + limit, entries.size()); revisions = Lists.newArrayListWithCapacity(end - start); for (int i = 0; i < end - start; i++) { final SVNLogEntry entry = entries.get(start + i); revisions.add(new Revision(String.valueOf(entry.getRevision()), entry.getAuthor(), entry.getDate(), entry.getMessage())); } } return revisions; } catch (final SVNException e) { throw new StoreException.ReadException("Unable to get older revisions"); } }
private SVNChangeLogRevision createChangeLogRevision(SVNRepository repository, String path, int level, SVNLogEntry svnEntry) { return SVNServiceUtils.createChangeLogRevision( repository, path, level, svnEntry.getRevision(), svnEntry.getMessage(), svnEntry.getAuthor(), Time.from(svnEntry.getDate(), null) ); }
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { if (logEntry.getDate() != null) { getOptions().saveCommitMessage(DAVRepository.this, logEntry.getRevision(), logEntry.getMessage()); } if (handler != null) { handler.handleLogEntry(logEntry); } } };
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { if (logEntry.getDate() != null) { getOptions().saveCommitMessage(DAVRepository.this, logEntry.getRevision(), logEntry.getMessage()); } handler.handleLogEntry(logEntry); }
public static LogMessage createLogMessage(SVNLogEntry logEntry) { if(logEntry == null){ return null; } Map cpaths = logEntry.getChangedPaths(); ChangePath[] cp = null; if(cpaths == null){ cp = new ChangePath[]{}; }else{ Collection clientChangePaths = new ArrayList(); for (Iterator iter = cpaths.keySet().iterator(); iter.hasNext();) { String path = (String) iter.next(); SVNLogEntryPath entryPath = (SVNLogEntryPath)cpaths.get(path); if(entryPath != null){ clientChangePaths.add(new ChangePath(path, entryPath.getCopyRevision(), entryPath.getCopyPath(), entryPath.getType(), getNodeKind(entryPath.getKind()))); } } cp = (ChangePath[]) clientChangePaths.toArray(new ChangePath[clientChangePaths.size()]); // sort by paths. Arrays.sort(cp, CHANGE_PATH_COMPARATOR); } long time = 0; if (logEntry.getDate() != null) { time = logEntry.getDate().getTime()*1000; if (logEntry.getDate() instanceof SVNDate) { time = ((SVNDate) logEntry.getDate()).getTimeInMicros(); } } return new LogMessage(cp, logEntry.getRevision(), logEntry.getAuthor(), time, logEntry.getMessage()); }
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { if (logEntry.getDate() != null) { getOptions().saveCommitMessage(DAVRepository.this, logEntry.getRevision(), logEntry.getMessage()); } if (handler != null) { handler.handleLogEntry(logEntry); } } };
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { if (logEntry.getDate() != null) { getOptions().saveCommitMessage(DAVRepository.this, logEntry.getRevision(), logEntry.getMessage()); } if (handler != null) { handler.handleLogEntry(logEntry); } } };
public void run() throws SVNException { SVNLookCommandEnvironment environment = getSVNLookEnvironment(); SVNLookClient client = environment.getClientManager().getLookClient(); SVNLogEntry logEntry = null; if (environment.isRevision()) { logEntry = client.doGetInfo(environment.getRepositoryFile(), getRevisionObject()); } else { logEntry = client.doGetInfo(environment.getRepositoryFile(), environment.getTransaction()); } String author = logEntry.getAuthor() != null ? logEntry.getAuthor() : ""; String date = logEntry.getDate() != null ? SVNDate.formatCustomDate(logEntry.getDate()) : ""; String log = logEntry.getMessage() != null ? logEntry.getMessage() : ""; environment.getOut().println(author); environment.getOut().println(date); if (log == null || log.length() == 0) { environment.getOut().println("0"); } else { environment.getOut().println(String.valueOf(log.length())); environment.getOut().println(log); } }
private LogEntry(@NotNull SVNLogEntry logEntry) { this(logEntry.getRevision(), logEntry.getMessage(), convert(logEntry.getChangedPaths().values())); }
public void run() throws SVNException { SVNLookCommandEnvironment environment = getSVNLookEnvironment(); SVNLookClient client = environment.getClientManager().getLookClient(); SVNLogEntry logEntry = null; if (environment.isRevision()) { logEntry = client.doGetInfo(environment.getRepositoryFile(), getRevisionObject()); } else { logEntry = client.doGetInfo(environment.getRepositoryFile(), environment.getTransaction()); } String author = logEntry.getAuthor() != null ? logEntry.getAuthor() : ""; String date = logEntry.getDate() != null ? SVNDate.formatCustomDate(logEntry.getDate()) : ""; String log = logEntry.getMessage() != null ? logEntry.getMessage() : ""; environment.getOut().println(author); environment.getOut().println(date); if (log == null || log.length() == 0) { environment.getOut().println("0"); } else { environment.getOut().println(String.valueOf(log.length())); environment.getOut().println(log); } }