forked from jenkinsci/subversion-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore Commits only consisting of changed properties on dirs.
- introduced a new property (checkbox) - changed XMLParser to include "kind" attribute into changelog - paths containing kind:dir and action:M (which must be a property change) are ignored during notifyCommit and not part of SCM.ChangeLog, i.e. they are ignored in Maven Builds.
- Loading branch information
Showing
12 changed files
with
322 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
/.project | ||
*.iml | ||
.idea | ||
/work |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
/* | ||
* ==================================================================== | ||
* Copyright (c) 2004-2012 TMate Software Ltd. All rights reserved. | ||
* | ||
* This software is licensed as described in the file COPYING, which | ||
* you should have received as part of this distribution. The terms | ||
* are also available at http://svnkit.com/license.html | ||
* If newer versions of this license are posted there, you may use a | ||
* newer version instead, at your option. | ||
* ==================================================================== | ||
*/ | ||
package hudson.scm; | ||
|
||
import java.util.Iterator; | ||
import java.util.LinkedList; | ||
|
||
import org.tmatesoft.svn.core.ISVNLogEntryHandler; | ||
import org.tmatesoft.svn.core.SVNErrorCode; | ||
import org.tmatesoft.svn.core.SVNErrorMessage; | ||
import org.tmatesoft.svn.core.SVNException; | ||
import org.tmatesoft.svn.core.SVNLogEntry; | ||
import org.tmatesoft.svn.core.SVNLogEntryPath; | ||
import org.tmatesoft.svn.core.internal.util.SVNDate; | ||
import org.tmatesoft.svn.core.internal.wc.SVNErrorManager; | ||
import org.tmatesoft.svn.core.wc.xml.AbstractXMLHandler; | ||
import org.tmatesoft.svn.core.wc.xml.SVNXMLLogHandler; | ||
import org.tmatesoft.svn.util.ISVNDebugLog; | ||
import org.tmatesoft.svn.util.SVNLogType; | ||
import org.xml.sax.ContentHandler; | ||
import org.xml.sax.SAXException; | ||
|
||
/** | ||
* Special XML Log Handler that includes the "kind" attribute for path nodes which are ommited by the original. | ||
* | ||
* This is a lot of copy paste code | ||
* @author qxa4177 | ||
*/ | ||
public class DirAwareSVNXMLLogHandler extends SVNXMLLogHandler implements ISVNLogEntryHandler { | ||
|
||
public static final String KIND_ATTR = "kind"; | ||
|
||
private boolean myIsOmitLogMessage; | ||
|
||
private LinkedList myMergeStack; | ||
|
||
public DirAwareSVNXMLLogHandler(ContentHandler contentHandler, ISVNDebugLog log) { | ||
super(contentHandler, log); | ||
} | ||
|
||
public DirAwareSVNXMLLogHandler(ContentHandler contentHandler) { | ||
super(contentHandler); | ||
} | ||
|
||
/** | ||
* Sets whether log messages must be omitted or not. | ||
* | ||
* @param omitLogMessage <span class="javakeyword">true</span> to omit; | ||
* otherwise <span class="javakeyword">false</span> | ||
*/ | ||
public void setOmitLogMessage(boolean omitLogMessage) { | ||
myIsOmitLogMessage = omitLogMessage; | ||
} | ||
|
||
/** | ||
* Handles a next log entry producing corresponding xml. | ||
* | ||
* @param logEntry log entry | ||
* @throws SVNException | ||
*/ | ||
public void handleLogEntry(SVNLogEntry logEntry) throws SVNException { | ||
try { | ||
sendToHandler(logEntry); | ||
} catch (SAXException e) { | ||
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.XML_MALFORMED, e.getLocalizedMessage()); | ||
SVNErrorManager.error(err, e, SVNLogType.DEFAULT); | ||
} | ||
} | ||
|
||
// unfortunately, the original method is private, so we need to copy / paste it | ||
// copied from SVNXMLLogHandler | ||
// | ||
protected void sendToHandler(SVNLogEntry logEntry) throws SAXException { | ||
if (logEntry.getRevision() == 0 && logEntry.getMessage() == null) { | ||
return; | ||
} | ||
addAttribute(REVISION_ATTR, logEntry.getRevision() + ""); | ||
openTag(LOGENTRY_TAG); | ||
if (logEntry.getAuthor() != null) { | ||
addTag(AUTHOR_TAG, logEntry.getAuthor()); | ||
} | ||
if (logEntry.getDate() != null && logEntry.getDate().getTime() != 0) { | ||
addTag(DATE_TAG, SVNDate.formatDate(logEntry.getDate())); | ||
} | ||
if (logEntry.getChangedPaths() != null && !logEntry.getChangedPaths().isEmpty()) { | ||
openTag(PATHS_TAG); | ||
for (Iterator paths = logEntry.getChangedPaths().keySet().iterator(); paths.hasNext();) { | ||
String key = (String) paths.next(); | ||
SVNLogEntryPath path = (SVNLogEntryPath) logEntry.getChangedPaths().get(key); | ||
addAttribute(ACTION_ATTR, path.getType() + ""); | ||
if (path.getCopyPath() != null) { | ||
addAttribute(COPYFROM_PATH_ATTR, path.getCopyPath()); | ||
addAttribute(COPYFROM_REV_ATTR, path.getCopyRevision() + ""); | ||
} | ||
if (path.getKind() != null) { | ||
addAttribute(KIND_ATTR, path.getKind().toString()); | ||
} | ||
addTag(PATH_TAG, path.getPath()); | ||
} | ||
closeTag(PATHS_TAG); | ||
} | ||
|
||
if (!myIsOmitLogMessage) { | ||
String message = logEntry.getMessage(); | ||
message = message == null ? "" : message; | ||
addTag(MSG_TAG, message); | ||
} | ||
|
||
if (myMergeStack != null && !myMergeStack.isEmpty()) { | ||
MergeFrame frame = (MergeFrame) myMergeStack.getLast(); | ||
frame.myNumberOfChildrenRemaining--; | ||
} | ||
|
||
//TODO: FIXME | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pauxus
Author
Owner
|
||
if (logEntry.hasChildren()) { | ||
MergeFrame frame = new MergeFrame(); | ||
//frame.myNumberOfChildrenRemaining = logEntry.getNumberOfChildren(); | ||
if (myMergeStack == null) { | ||
myMergeStack = new LinkedList(); | ||
} | ||
myMergeStack.addLast(frame); | ||
} else { | ||
while(myMergeStack != null && !myMergeStack.isEmpty()) { | ||
MergeFrame frame = (MergeFrame) myMergeStack.getLast(); | ||
if (frame.myNumberOfChildrenRemaining == 0) { | ||
closeTag(LOGENTRY_TAG); | ||
myMergeStack.removeLast(); | ||
} else { | ||
break; | ||
} | ||
} | ||
closeTag(LOGENTRY_TAG); | ||
} | ||
} | ||
private class MergeFrame { | ||
private long myNumberOfChildrenRemaining; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
What should be fixed here?