Refine search
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); }
final SvnOperationFactory svnOperationFactory = new SvnOperationFactory(); final SvnLog log = svnOperationFactory.createLog(); log.setSingleTarget(SvnTarget.fromURL(url)); log.addRange(SvnRevisionRange.create(SVNRevision.create(12345), SVNRevision.create(12345))); log.setDiscoverChangedPaths(true); final SVNLogEntry logEntry = log.run(); final Map<String,SVNLogEntryPath> changedPaths = logEntry.getChangedPaths(); for (Map.Entry<String, SVNLogEntryPath> entry : changedPaths.entrySet()) { final SVNLogEntryPath svnLogEntryPath = entry.getValue(); System.out.println(svnLogEntryPath.getType() + " " + svnLogEntryPath.getPath() + (svnLogEntryPath.getCopyPath() == null ? "" : (" from " + svnLogEntryPath.getCopyPath() + ":" + svnLogEntryPath.getCopyRevision()))); }
public static void handleLogMessage(SVNLogEntry logEntry, LogMessageCallback handler) { if(logEntry == null || handler == null) { return; } 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()]); } SVNProperties revisionProperties = logEntry.getRevisionProperties(); Map revisionPropertiesMap = new HashMap(); for(Iterator names = revisionProperties.nameSet().iterator(); names.hasNext();) { String name = (String) names.next(); revisionPropertiesMap.put(name, revisionProperties.getStringValue(name)); } handler.singleMessage(cp, logEntry.getRevision(), revisionPropertiesMap, logEntry.hasChildren()); }
private static Set<ChangePath> getChangePaths(Map<String, SVNLogEntryPath> changedPaths) { if (changedPaths == null) { return null; } Set<ChangePath> changePaths = new HashSet<ChangePath>(); for (Map.Entry<String, SVNLogEntryPath> entry : changedPaths.entrySet()) { SVNLogEntryPath svnLogEntryPath = entry.getValue(); //TODO: replace Tristate.Unknown with correct values in the following changePaths.add(new ChangePath(svnLogEntryPath.getPath(), svnLogEntryPath.getCopyRevision(), svnLogEntryPath.getCopyPath(), getChangePathAction(svnLogEntryPath.getType()), getNodeKind(svnLogEntryPath.getKind()), Tristate.Unknown, Tristate.Unknown)); } return changePaths; }
if (myAuthorOfInterest != null && !"".equals(myAuthorOfInterest) && !myAuthorOfInterest.equals(logEntry.getAuthor())) { return; SVNProperties revisionProperties = logEntry.getRevisionProperties(); String author = revisionProperties.getStringValue(SVNRevisionProperty.AUTHOR); String message = revisionProperties.getStringValue(SVNRevisionProperty.LOG); Date dateObject = dateValue == null ? null : SVNDate.parseDate(dateValue); if (message == null && logEntry.getRevision() == 0) { return; String path = (String) paths.next(); SVNLogEntryPath lPath = (SVNLogEntryPath) sortedPaths.get(path); buffer.append(" " + lPath.getType() + " " + path); if (lPath.getCopyPath() != null) { buffer.append(" (from " + lPath.getCopyPath() + ":" + lPath.getCopyRevision() + ")");
SVNLogEntryPath change = (SVNLogEntryPath) changedPaths.get(path); if (change != null) { if (change.getType() != SVNLogEntryPath.TYPE_ADDED && change.getType() != SVNLogEntryPath.TYPE_REPLACED) { previousPath = path; } else { if (change.getCopyPath() != null) { previousPath = change.getCopyPath(); action[0] = change.getType(); copyFromRevision[0] = change.getCopyRevision(); if (change.getCopyPath() != null) { if (action != null && action.length > 0) { action[0] = change.getType(); copyFromRevision[0] = change.getCopyRevision(); previousPath = SVNPathUtil.append(change.getCopyPath(), path.substring(changedPath.length() + 1)); break;
public boolean isIncluded(SVNLogEntry logEntry) { if (excludedRevprop != null) { SVNProperties revprops = logEntry.getRevisionProperties(); if (revprops != null && revprops.containsName(excludedRevprop)) { if (getLog() != null) { getLog().println(hudson.scm.subversion.Messages.SubversionSCM_pollChanges_ignoredRevision( logEntry.getRevision(), hudson.scm.subversion.Messages.SubversionSCM_pollChanges_ignoredRevision_revprop(excludedRevprop))); String author = logEntry.getAuthor(); if (excludedUsers.contains(author)) { boolean contentChanged = false; for (SVNLogEntryPath path : changedPaths.values()) { if (path.getType() != 'M' || path.getKind() != SVNNodeKind.DIR) { contentChanged = true; break;
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { Map changedPaths = logEntry.getChangedPaths(); for (Iterator changedPathsIter = changedPaths.keySet().iterator(); changedPathsIter.hasNext();) { String path = (String) changedPathsIter.next(); SVNLogEntryPath change = (SVNLogEntryPath) changedPaths.get(path); if (myPath.equals(path) && (change.getType() == SVNLogEntryPath.TYPE_DELETED || change.getType() == SVNLogEntryPath.TYPE_REPLACED)) { myDeletedRevision = logEntry.getRevision(); } } }
myRevProps.put(SVNRevisionProperty.DATE, SVNDate.formatDate(myDate)); SVNLogEntry logEntry = new SVNLogEntry(myPaths, myRevision, myRevProps, myHasChildren); logEntry.setSubtractiveMerge(myIsSubtractiveMerge); myLogEntryHandler.handleLogEntry(logEntry); if (logEntry.hasChildren()) { myNestLevel++; myPaths = new SVNHashMap(); myPath.setPath(cdata.toString()); String path = myPath.getPath(); myPath.setPath(path); myPaths.put(myPath.getPath(), myPath);
@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()); } } };
Map changedPaths = logEntry.getChangedPaths(); if (changedPaths != null && !changedPaths.isEmpty()) { TreeMap sortedChangedPaths = new TreeMap(Collections.reverseOrder()); String changedPath = (String) changedPathsIter.next(); SVNLogEntryPath logEntryPath = (SVNLogEntryPath) sortedChangedPaths.get(changedPath); if (logEntryPath.getCopyPath() != null && SVNRevision.isValidRevisionNumber(logEntryPath.getCopyRevision()) && SVNPathUtil.isAncestor(changedPath, myTargetPath)) { String copyFromPath = null; if (changedPath.equals(myTargetPath)) { copyFromPath = logEntryPath.getCopyPath(); } else { String relPath = myTargetPath.substring(changedPath.length()); relPath = relPath.substring(1); copyFromPath = SVNPathUtil.getAbsolutePath(SVNPathUtil.append(logEntryPath.getCopyPath(), relPath)); myCopyFromLocation = new SVNLocationEntry(logEntryPath.getCopyRevision(), copyFromPath); break;
long copyRevision = SVNReader.getLong(pathItems, 3); String kind = SVNReader.getString(pathItems, 4); changedPathsMap.put(path, new SVNLogEntryPath(path, action.charAt(0), copyPath, copyRevision, kind != null ? SVNNodeKind.parseKind(kind) : SVNNodeKind.UNKNOWN)); SVNLogEntry logEntry = new SVNLogEntry(changedPathsMap, revision, logEntryProperties, hasChildren); handler.handleLogEntry(logEntry); if (logEntry.hasChildren()) { nestLevel++; if (logEntry.getRevision() < 0) { nestLevel--; if (nestLevel < 0) {
public void receive(SvnTarget target, SVNLogEntry logEntry) throws SVNException { if (logEntry.getRevision() == 0) { return; SVNMergeRangeList thisRangeList = new SVNMergeRangeList(logEntry.getRevision() - 1, logEntry.getRevision(), true); SVNMergeRangeList intersection = this.rangelist.intersect(thisRangeList, false); if (mergeSourceRelTarget != null) { interrupted = true; if ("".equals(mergeSourceRelTarget) && logEntry.getChangedPaths().get(changedPath).getType() != 'M') { interrupted = false; if (nearestAncestorMergeInfo != null && ancestorIsSelf && logEntry.getChangedPaths().get(changedPath).getType() != 'M') {
return; if (thisRevision == logEntry.getRevision()) return; Set changedPathsSet = logEntry.getChangedPaths().keySet(); for (Iterator changedPaths = changedPathsSet.iterator(); changedPaths.hasNext();) { SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry.getChangedPaths().get(changedPaths.next()); String workingFileName = entryPath.getPath();
private SVNLogEntryPath getFileCopyOrigin(String path) throws SVNException { String[] paths = (String[]) myCopiedPaths.keySet().toArray(new String[myCopiedPaths.size()]); Arrays.sort(paths, 0, paths.length, SVNPathUtil.PATH_COMPARATOR); SVNLogEntryPath realPath = null; List candidates = new ArrayList(); for (int i = 0; i < paths.length; i++) { String copiedPath = (String) paths[i]; if (!path.startsWith(copiedPath + "/")) { continue; } else if (path.equals(copiedPath)) { return (SVNLogEntryPath) myCopiedPaths.get(copiedPath); } candidates.add(copiedPath); } // check candidates from the end of the list for(int i = candidates.size() - 1; i >=0; i--) { String candidateParent = (String) candidates.get(i); if (getSourceRepository().checkPath(candidateParent, myTargetRevision) != SVNNodeKind.DIR) { continue; } SVNLogEntryPath changedPath = (SVNLogEntryPath) myCopiedPaths.get(candidateParent); String fileRelativePath = path.substring(candidateParent.length() + 1); fileRelativePath = SVNPathUtil.append(changedPath.getCopyPath(), fileRelativePath); return new SVNLogEntryPath(path, ' ', fileRelativePath, changedPath.getCopyRevision()); } return realPath; }
private List<Modification> getModifications(SVNRepository repository, SVNURL url, long revision, SVNLogEntry logEntry) throws SVNException, UnsupportedEncodingException { List<Modification> modifications = new ArrayList<Modification>(); for (Entry<String, SVNLogEntryPath> entry : logEntry.getChangedPaths().entrySet()) { SVNLogEntryPath e = entry.getValue(); String diffText = getDiffText(repository, url, e, revision); String sc = getSourceCode(repository, revision, e); Modification modification = new Modification(e.getCopyPath(), e.getPath(), getModificationType(e), diffText, sc); modifications.add(modification); } return modifications; }
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { if (logEntry.getChangedPaths() == null) { return; for (Map.Entry<String, SVNLogEntryPath> entry : logEntry.getChangedPaths().entrySet()) { String path = entry.getKey(); SVNLogEntryPath logEntryPath = entry.getValue(); if ("".equals(SVNFileUtil.getFilePath(child))) { SVNNodeKind nodeKind; if (logEntryPath.getKind() == SVNNodeKind.UNKNOWN) { File wcChildAbsPath = SVNFileUtil.createFilePath(mergeTargetAbsPath, relPath); nodeKind = context.readKind(wcChildAbsPath, false); } else { nodeKind = logEntryPath.getKind(); if (logEntryPath.getType() == 'A' || !operativeChildren.containsKey(potentialChild)) { operativeChildren.put(potentialChild, path);
private ModificationType getModificationType(SVNLogEntryPath e) { if (e.getType() == 'A') { return ModificationType.ADD; } else if (e.getType() == 'D') { return ModificationType.DELETE; } else if (e.getType() == 'M') { return ModificationType.MODIFY; } else if (e.getType() == 'R') { return ModificationType.COPY; } return null; }
for (Iterator entries = logEntries.iterator(); entries.hasNext();) { SVNLogEntry logEntry = (SVNLogEntry) entries.next(); if (logEntry.getChangedPaths().size() > 0) { Set<String> changedPathsSet = logEntry.getChangedPaths().keySet(); for (Iterator<String> changedPaths = changedPathsSet.iterator(); changedPaths .hasNext();) { SVNLogEntryPath entryPath = (SVNLogEntryPath) logEntry .getChangedPaths().get(changedPaths.next()); String path = entryPath.getPath(); if (!path.startsWith(updatePath)) { continue; }