@Override public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { GregorianCalendar c = new GregorianCalendar(); c.setTime(logEntry.getDate()); final String timestamp = sdfTimestampThreadLocal.get().format(logEntry.getDate()); final String year = timestamp.substring(0,4); newProperties.put(SVN_COPYRIGHT_LASTCHANGE_TIMESTAMP_KEY, timestamp); newProperties.put(SVN_COPYRIGHT_LASTCHANGE_DATE_KEY, timestamp.substring(0,8)); newProperties.put(SVN_COPYRIGHT_LASTCHANGE_REVISION_KEY, ""+logEntry.getRevision()); newProperties.put(SVN_COPYRIGHT_LASTCHANGE_YEAR_KEY, year); mojo.getLog().debug("found " + logEntry.getDate() + " as last modified date for file: " + documentFile); if (year.equals(inceptionYear) || inceptionYear == null) { newProperties.put(SVN_COPYRIGHT_YEARS_RANGE_KEY, year); } else { // a real range can be created newProperties.put(SVN_COPYRIGHT_YEARS_RANGE_KEY, inceptionYear + "-" + year); } } };
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(), 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 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 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 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); }
@SuppressWarnings("rawtypes") @Override public List<ChangeSet> getChangeSets() { SVNRepository repository = null; try { SVNURL url = SVNURL.parseURIEncoded(path); repository = SVNRepositoryFactory.create(url); authenticateIfNecessary(repository); List<ChangeSet> allCs = new ArrayList<ChangeSet>(); long startRevision = 0; long endRevision = -1; // HEAD (the latest) revision Collection log = repository.log(new String[] { "" }, null, startRevision, endRevision, true, true); for (Iterator iterator = log.iterator(); iterator.hasNext();) { SVNLogEntry entry = (SVNLogEntry) iterator.next(); allCs.add(new ChangeSet(String.valueOf(entry.getRevision()), convertToCalendar(entry.getDate()))); } return allCs; } catch (SVNException e) { throw new RuntimeException("error in getHead() for " + path, e); } finally { if (repository != null) repository.closeSession(); } }
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 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"); } }
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); } } };
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()); } 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 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); } }
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); } }
entry.getDate().getTime(), Person.toPerson(entry.getAuthor()), entry.getMessage());
String author = logEntry.getAuthor(); String message = logEntry.getMessage(); Date date = logEntry.getDate();