A Patch for the svnClientAdapter.
From: Sung Kim <hunkims_at_hotmail.com>
Date: 2003-11-08 06:08:40 CET
Hello,
I found a small bug in the CmdLineLogMessage.java
For example:
The CmdLineLogMessage parses the count and read lines based on the
I added simple patch for that, but I thing we should use --xml flag to
Also the attatched patch includes the properyList method which gets a
-
PS - I created the patch using Subclipse!!
Index:
---
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/commandline/CmdLineLogMessage.java (revision 276)
+++
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/commandline/CmdLineLogMessage.java (working copy)
@@ -77,6 +77,7 @@
//grab "rev 49: phil | 2003-06-30 00:14:58 -0500 (Mon,
30 Jun 2003) | 1 line"
String headerLine = st.nextToken();
+
//split the line up into 3 parts, left, middle, and
right.
StringTokenizer ltr = new StringTokenizer(headerLine,
"|");
String left = ltr.nextToken();
@@ -100,23 +101,24 @@
date = Helper.toDate(middle.trim());
//get the number of lines.
+ // TODO: It is not a log line number. See:
+ // rev 167: hunkim | 2003-11-05 14:00:49 -0800 (Wed, 05
Nov 2003) | 1 line
StringTokenizer rightToken = new StringTokenizer(right,
" ");
int messageLineCount =
Integer.parseInt(rightToken.nextToken());
//get the body of the log.
StringBuffer sb = new StringBuffer();
//st.nextToken(); //next line is always blank.
- for(int i=0; i < messageLineCount; i++) {
- sb.append(st.nextToken());
+ for(int i=0; st.hasMoreTokens();i++) {
+ String msgLine = st.nextToken();
+ if
(msgLine.equals("-------------------------------------------------------
-----------------"))
+ break;
- //dont add a newline to the last line.
- if(i < messageLineCount - 1)
+ if (i!=0)
sb.append('\n');
+ sb.append(st.nextToken());
}
msg = sb.toString();
-
- //take off the last dashes
"-----------------------------------------"
- st.nextToken();
}
/* (non-Javadoc)
Index:
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/commandline/CommandLine.java
===================================================================
---
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/commandline/CommandLine.java (revision 276)
+++
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/commandline/CommandLine.java (working copy)
@@ -93,6 +93,7 @@
private static String CMD_MKDIR = "mkdir -m \"{0}\" {1}";
private static String CMD_MKDIR_LOCAL = "mkdir {0}";
private static String CMD_MOVE = "mv -r {0} {1} {2} {3}
--force";
+ private static String CMD_PROPLIST = "proplist -v {0}";
private static String CMD_PROPGET = "propget {0} {1}";
private static String CMD_PROPSET = "propset {0} \"{1}\" {2}";
private static String CMD_PROPSET_FILE = "propset {0} -F \"{1}\"
{2}";
@@ -389,9 +390,20 @@
new String[] { validRev(revision),
source, dest, messageStr })
+ getAuthInfo());
}
-
/**
* <p>
+ * Print list of <tt>properties</tt> on files, dirs, or
revisions.</p>
+ *
+ * @param Local path of resource.
+ */
+ InputStream proplist(String path) throws CmdLineException {
+ Process proc =
+ execProcess(MessageFormat.format(CMD_PROPLIST, new
String[] { path }));
+ return proc.getInputStream();
+ }
+
+ /**
+ * <p>
* Print value of <tt>propName</tt> on files, dirs, or
revisions.</p>
*
* @param Local path of resource.
Index:
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/commandline/CmdLineClientAdapter.java
===================================================================
---
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/commandline/CmdLineClientAdapter.java (revision 276)
+++
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/commandline/CmdLineClientAdapter.java (working copy)
@@ -566,7 +566,47 @@
// TODO : test
diff(url, oldUrlRevision, url, newUrlRevision, outFile,
recurse);
}
-
+
+ public ISVNProperty[] propertyList(File path) throws
SVNClientException {
+ try {
+ String pathString = toString(path);
+ InputStream valueAndData =
_cmd.proplist(toString(path));
+
+ byte[] bytes = streamToByteArray(valueAndData,
true);
+
+ List propList = new java.util.LinkedList();
+ String strList = new String(bytes);
+ // Simple proplist
+ //D:\repos>svn proplist -v bookmark.htm
+ //Properties on 'bookmark.htm':
+ // aa : kk
+ // TODO If propertyName="aa : kk" it is hard to
parse
+ // But assume there is no : in name
+ StringTokenizer tok = new
StringTokenizer(strList, Helper.NEWLINE);
+ // Skip the first line: Properties on
'bookmark.htm':
+ if (tok.hasMoreTokens())
+ tok.nextToken();
+ // Starts from here
+ while(tok.hasMoreTokens()) {
+ String nameValue = tok.nextToken();
+ // Find " : "
+ int seperator = nameValue.indexOf(" :
");
+ if (seperator != -1) {
+ String name =
nameValue.substring(0, seperator);
+ String value =
nameValue.substring(seperator+3); // strlen(" : ")
+ propList.add(new
CmdLineProperty(name, value, pathString, bytes));
+ } else { // No name and value pair ??
+ propList.add(new
CmdLineProperty(nameValue, null, pathString, bytes));
+ }
+ }
+ return (ISVNProperty[]) propList.toArray(new
ISVNProperty[propList.size()]);
+ } catch (CmdLineException e) {
+ throw SVNClientException.wrapException(e);
+ } catch (IOException e) {
+ throw SVNClientException.wrapException(e);
+ }
+ }
+
public ISVNProperty propertyGet(File path, String propertyName)
throws SVNClientException {
try {
String pathString = toString(path);
Index:
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/ISVNClientAdapter.java
===================================================================
---
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/ISVNClientAdapter.java (revision 276)
+++
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/ISVNClientAdapter.java (working copy)
@@ -344,7 +344,19 @@
String propertyValue,
boolean recurse)
throws SVNClientException;
+
/**
+ * Get list of propertie names
+ * @param path
+ * @param recurse
+ * @throws SVNClientException
+ */
+
+ public ISVNProperty[] propertyList(
+ File path)
+ throws SVNClientException;
+
+ /**
* set a property using the content of a file
*/
public abstract void propertySet(
Index:
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/javahl/JhlClientAdapter.java
===================================================================
---
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/javahl/JhlClientAdapter.java (revision 276)
+++
D:/eclipse3/workspace/svnClientAdapter/src/main/org/tigris/subversion/sv
nclientadapter/javahl/JhlClientAdapter.java (working copy)
@@ -835,6 +835,39 @@
}
}
+ /**
+ * Get properties list
+ * @param path
+ * @return
+ * @throws SVNClientException
+ */
+ public ISVNProperty[] propertyList(File path) throws
SVNClientException {
+ try {
+
notificationHandler.setCommand(ISVNNotifyListener.Command.PROPSET);
+
+ String target = fileToSVNPath(path, true);
+ notificationHandler.setCommandLine(
+ "proplist "
+ + target);
+
+ PropertyData []propData =
svnClient.properties(target);
+ if (propData==null)
+ return null;
+
+ // Create array for return
+ JhlPropertyData []propList = new
JhlPropertyData[propData.length];
+ // Transfer data for each element
+ for (int i=0; i<propList.length; i++)
+ propList[i] = new
JhlPropertyData(propData[i]);
+ // return list
+ return propList;
+
+ } catch (ClientException e) {
+ notificationHandler.setException(e);
+ throw new SVNClientException(e);
+ }
+ }
+
/**
* set a property
* @param path
|
This is an archived mail posted to the Subclipse Dev mailing list.
This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.