Skip to content

Commit 225f80e

Browse files
committed
Add @ to end of paths that contain an @
This is needed for command line calls otherwise it interprets the @ as a peg revision and fails. This fixes #28
1 parent cc413ba commit 225f80e

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

cmdline/src/main/java/org/tigris/subversion/svnclientadapter/commandline/CmdLineClientAdapter.java

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
import org.tigris.subversion.svnclientadapter.SVNRevisionRange;
5959
import org.tigris.subversion.svnclientadapter.SVNScheduleKind;
6060
import org.tigris.subversion.svnclientadapter.SVNStatusUnversioned;
61-
import org.tigris.subversion.svnclientadapter.SVNUrl;
6261

6362
/**
6463
* <p>
@@ -1007,14 +1006,43 @@ public void propertySet(File path, String propertyName, String propertyValue, bo
10071006
}
10081007
}
10091008

1010-
/**
1011-
* A safe <code>toString()</code> implementation which implements
1012-
* <code>null</code> checking on <code>obj</code>.
1013-
*/
1014-
protected static String toString(Object obj) {
1015-
return (obj == null) ? null : obj.toString();
1009+
protected static String toString(SVNRevision r) {
1010+
return (r == null) ? null : r.toString();
1011+
}
1012+
1013+
protected static String toString(File f) {
1014+
return (f == null) ? null : atSign(f.toString());
1015+
}
1016+
1017+
protected static String toString(File[] f) {
1018+
if (f == null) return null;
1019+
StringBuffer buf = new StringBuffer();
1020+
for (int i = 0; i < f.length; i++) {
1021+
buf.append(atSign(f[i].toString()) + " ");
1022+
}
1023+
return buf.toString();
10161024
}
10171025

1026+
protected static String toString(SVNUrl u) {
1027+
return (u == null) ? null : atSign(u.toString());
1028+
}
1029+
1030+
/**
1031+
* The command line requires paths that contain an '@'
1032+
* have an '@' at the end of the string. Otherwise it
1033+
* interprets the '@' as the start of a peg revision
1034+
*
1035+
* Rather than always add an '@' to end of path we use
1036+
* this method to only do so when needed.
1037+
*/
1038+
private static String atSign(String s) {
1039+
if (s.contains("@"))
1040+
return s + "@";
1041+
else
1042+
return s;
1043+
}
1044+
1045+
10181046
/**
10191047
* Implementation used by overloads of <code>getLogMessages()</code>.
10201048
*

0 commit comments

Comments
 (0)