Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > subclipse commit: rev 261 - trunk/svnClientAdapter/src/main/org/tigris/subversion/svnclientadapter/commandline

subclipse
Discussion topic

Back to topic list

subclipse commit: rev 261 - trunk/svnClientAdapter/src/main/org/tigris/subversion/svnclientadapter/commandline

Author schatz
Full name Philip Schatz
Date 2003-10-29 07:23:51 PST
Message Author: schatz
Date: Wed Oct 29 09:23:50 2003
New Revision: 261

Modified:
   trunk/svnClientAdapt​er/src/main/org/tigr​is/subversion/svncli​entadapter/commandli​ne/CmdLineClientAdap​ter.java
Log:
Replaced [url,file,revision].toString() and [file].getCanonicalPath() with toString([url,file,revision])

Modified: trunk/svnClientAdapt​er/src/main/org/tigr​is/subversion/svncli​entadapter/commandli​ne/CmdLineClientAdap​ter.java
====================​====================​====================​==================
--- trunk/svnClientAdapt​er/src/main/org/tigr​is/subversion/svncli​entadapter/commandli​ne/CmdLineClientAdap​ter.java (original)
+++ trunk/svnClientAdapt​er/src/main/org/tigr​is/subversion/svncli​entadapter/commandli​ne/CmdLineClientAdap​ter.java Wed Oct 29 09:23:50 2003
@@ -94,17 +94,16 @@
     private List _listeners = new LinkedList();
 
     //Methods
- public static boolean isAvailable() {
- // this will need to be fixed when path to svn will be customizable
- CommandLine cmd = new CommandLine("svn");
- try {
- cmd.version();
- return true;
- } catch (Exception e)
- {
- return false;
- }
- }
+ public static boolean isAvailable() {
+ // this will need to be fixed when path to svn will be customizable
+ CommandLine cmd = new CommandLine("svn");
+ try {
+ cmd.version();
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
 
     /* (non-Javadoc)
      * @see org.tigris.subversio​n.subclipse.client.I​SVNClientAdapter#add​NotifyListener(org.t​igris.subversion.sub​clipse.client.ISVNCl​ientNotifyListener)
@@ -167,12 +166,10 @@
         StringBuffer sb = new StringBuffer();
         try {
             for (int i = 0; i < arg0.length; i++) {
- sb.append(arg0[i].ge​tCanonicalPath());
+ sb.append(toString(arg0[i]));
                 sb.append(' ');
             }
             _cmd.delete(sb.toString(), null);
- } catch (IOException e) {
- throw SVNClientException.w​rapException(e);
         } catch (CmdLineException e) {
             throw SVNClientException.w​rapException(e);
         }
@@ -183,10 +180,8 @@
      */
     public void revert(File arg0, boolean arg1) throws SVNClientException {
         try {
- String changedFiles = _cmd.revert(arg0.get​CanonicalPath(), arg1);
+ String changedFiles = _cmd.revert(toString(arg0), arg1);
             refreshChangedResour​ces(changedFiles);
- } catch (IOException e) {
- throw SVNClientException.w​rapException(e);
         } catch (CmdLineException e) {
             throw SVNClientException.w​rapException(e);
         }
@@ -198,20 +193,19 @@
      */
     public InputStream getContent(SVNUrl arg0, SVNRevision arg1) throws SVNClientException {
 
- try {
- InputStream content = _cmd.cat(toString(arg0), toString(arg1));
+ try {
+ InputStream content = _cmd.cat(toString(arg0), toString(arg1));
 
-
- //read byte-by-byte and put it in a vector.
- //then take the vector and fill a byteArray.
- byte[] byteArray;
- byteArray = streamToByteArray(content, false);
- return new ByteArrayInputStream​(byteArray);
+ //read byte-by-byte and put it in a vector.
+ //then take the vector and fill a byteArray.
+ byte[] byteArray;
+ byteArray = streamToByteArray(content, false);
+ return new ByteArrayInputStream​(byteArray);
         } catch (IOException e) {
             throw SVNClientException.w​rapException(e);
- } catch (CmdLineException e) {
- throw SVNClientException.w​rapException(e);
- }
+ } catch (CmdLineException e) {
+ throw SVNClientException.w​rapException(e);
+ }
 
     }
 
@@ -219,11 +213,11 @@
      * @see org.tigris.subversio​n.subclipse.client.I​SVNClientAdapter#mkd​ir(java.net.URL, java.lang.String)
      */
     public void mkdir(SVNUrl arg0, String arg1) throws SVNClientException {
- try {
- _cmd.mkdir(toString(arg0), arg1);
- } catch (CmdLineException e) {
- throw SVNClientException.w​rapException(e);
- }
+ try {
+ _cmd.mkdir(toString(arg0), arg1);
+ } catch (CmdLineException e) {
+ throw SVNClientException.w​rapException(e);
+ }
     }
 
     /* (non-Javadoc)
@@ -232,10 +226,10 @@
     public ISVNLogMessage[] getLogMessages(SVNUrl arg0, SVNRevision arg1, SVNRevision arg2)
         throws SVNClientException {
         List tempLogs = new java.util.LinkedList();
- String revRange = arg1.toString() + ":" + arg2.toString();
+ String revRange = toString(arg1) + ":" + toString(arg2);
 
         try {
- String messages = _cmd.log(arg0.toString(), revRange);
+ String messages = _cmd.log(toString(arg0), revRange);
 
             StringTokenizer st = new StringTokenizer(messages, Helper.NEWLINE);
             st.nextToken();
@@ -255,7 +249,7 @@
     public void remove(SVNUrl[] arg0, String arg1) throws SVNClientException {
         StringBuffer sb = new StringBuffer();
         for (int i = 0; i < arg0.length; i++) {
- sb.append(arg0[i].toString());
+ sb.append(toString(arg0[i]));
             sb.append(' ');
         }
         try {
@@ -270,19 +264,19 @@
      */
     public void copy(SVNUrl src, SVNUrl dest, String message, SVNRevision rev)
         throws SVNClientException {
- try {
- _cmd.copy(src.toString(), dest.toString(), message, rev.toString());
- } catch (CmdLineException e) {
- SVNClientException.w​rapException(e);
- }
+ try {
+ _cmd.copy(toString(src), toString(dest), message, toString(rev));
+ } catch (CmdLineException e) {
+ SVNClientException.w​rapException(e);
+ }
     }
 
     public void copy(File srcPath, File destPath) throws SVNClientException {
         try {
- _cmd.copy(srcPath.toString(), destPath.toString());
- } catch (CmdLineException e) {
- SVNClientException.w​rapException(e);
- }
+ _cmd.copy(toString(srcPath), toString(destPath));
+ } catch (CmdLineException e) {
+ SVNClientException.w​rapException(e);
+ }
         //sometimes the dir has not yet been created.
         //wait up to 5 sec for the dir to be created.
         for (int i = 0; i < 50 && !destPath.exists(); i++) {
@@ -301,7 +295,7 @@
         throws SVNClientException {
         try {
             String changedResources =
- _cmd.move(url.toString(), destUrl.toString(), message, revision.toString());
+ _cmd.move(toString(url), toString(destUrl), message, toString(revision));
             refreshChangedResour​ces(changedResources​);
         } catch (CmdLineException e) {
             SVNClientException.w​rapException(e);
@@ -314,10 +308,8 @@
     public void move(File file, File file2, boolean b) throws SVNClientException {
         try {
             String changedResources =
- _cmd.move(file.getCa​nonicalPath(), file2.getCanonicalPath(), null, null);
+ _cmd.move(toString(file), toString(file2), null, null);
             refreshChangedResour​ces(changedResources​);
- } catch (IOException e) {
- throw SVNClientException.w​rapException(e);
         } catch (CmdLineException e) {
             throw SVNClientException.w​rapException(e);
         }
@@ -347,9 +339,7 @@
      */
     public void addDirectory(File file, boolean b) throws SVNClientException {
         try {
- _cmd.add(file.getCan​onicalPath(), true);
- } catch (IOException e) {
- throw SVNClientException.w​rapException(e);
+ _cmd.add(toString(file), true);
         } catch (CmdLineException e) {
             //if something is already in svn and we
             //try to add it, we get a warning.
@@ -365,10 +355,8 @@
      */
     public void addFile(File file) throws SVNClientException {
         try {
- String changedResources = _cmd.add(file.getCan​onicalPath(), false);
+ String changedResources = _cmd.add(toString(file), false);
             refreshChangedResour​ces(changedResources​);
- } catch (IOException e) {
- throw SVNClientException.w​rapException(e);
         } catch (CmdLineException e) {
             //if something is already in svn and we
             //try to add it, we get a warning.
@@ -385,7 +373,7 @@
     public long commit(File[] parents, String comment, boolean b) throws SVNClientException {
         StringBuffer sb = new StringBuffer();
         for (int i = 0; i < parents.length; i++) {
- sb.append(parents[i]​.toString());
+ sb.append(toString(p​arents[i]));
             sb.append(' ');
         }
         try {
@@ -420,10 +408,8 @@
      */
     public void update(File file, SVNRevision revision, boolean b) throws SVNClientException {
         try {
- String changedResources = _cmd.update(file.get​CanonicalPath(), revision.toString());
+ String changedResources = _cmd.update(toString(file), toString(revision));
             refreshChangedResour​ces(changedResources​);
- } catch (IOException e) {
- throw SVNClientException.w​rapException(e);
         } catch (CmdLineException e) {
             throw SVNClientException.w​rapException(e);
         }
@@ -435,14 +421,11 @@
     public void checkout(SVNUrl url, File destPath, SVNRevision revision, boolean b)
         throws SVNClientException {
         try {
- String dest = destPath.getCanonicalPath();
- String changedResources = _cmd.checkout(url.toString(), dest, revision.toString(), b);
+ String changedResources = _cmd.checkout(toString(url), toString(destPath), toString(revision), b);
             refreshChangedResour​ces(changedResources​);
 
         } catch (CmdLineException e) {
             throw SVNClientException.w​rapException(e);
- } catch (IOException e) {
- throw SVNClientException.w​rapException(e);
         }
     }
 
@@ -453,8 +436,7 @@
         String path = null;
         List statuses = new LinkedList();
         try {
- path = file.getCanonicalPath();
- String statusLines = _cmd.recursiveStatus(path);
+ String statusLines = _cmd.recursiveStatus​(toString(file));
             StringTokenizer st = new StringTokenizer(statusLines, Helper.NEWLINE);
             while (st.hasMoreTokens()) {
                 String statusLine = st.nextToken();
@@ -464,8 +446,6 @@
             }
 
             return (ISVNStatus[]) statuses.toArray(new ISVNStatus[statuses.size()]);
- } catch (IOException e) {
- throw SVNClientException.w​rapException(e);
         } catch (CmdLineException e) {
             if (e.getMessage().star​tsWith("svn: Path is not a working copy directory")) {
                 return new ISVNStatus[0];
@@ -524,21 +504,21 @@
         if (newPathRevision == null)
             newPathRevision = SVNRevision.WORKING;
 
- try {
- InputStream is =
- _cmd.diff(
- oldPath,
- toString(oldPathRevision),
- newPath,
- toString(newPathRevision),
- recurse);
+ try {
+ InputStream is =
+ _cmd.diff(
+ oldPath,
+ toString(oldPathRevision),
+ newPath,
+ toString(newPathRevision),
+ recurse);
 
- streamToFile(is, outFile);
+ streamToFile(is, outFile);
         } catch (IOException e) {
             //this should never happen
- } catch (CmdLineException e) {
- SVNClientException.w​rapException(e);
- }
+ } catch (CmdLineException e) {
+ SVNClientException.w​rapException(e);
+ }
     }
 
     public void diff(
@@ -606,6 +586,15 @@
         }
     }
 
+ public void propertySet(File path, String propertyName, File propertyFile, boolean recurse)
+ throws SVNClientException, IOException {
+ try {
+ _cmd.propsetFile(propertyName, toString(propertyFile), toString(path), recurse);
+ } catch (CmdLineException e) {
+ throw SVNClientException.w​rapException(e);
+ }
+ }
+
     public void propertyDel(File path, String propertyName, boolean recurse)
         throws SVNClientException {
         // TODO : implement
@@ -649,20 +638,21 @@
     public void setIgnoredPatterns(File path, List patterns) throws SVNClientException {
         if (!path.isDirectory())
             return;
- String value = "";
+ StringBuffer values = new StringBuffer();
         for (Iterator it = patterns.iterator(); it.hasNext();) {
             String pattern = (String) it.next();
- value = value + '\n' + pattern;
+ values.append('\n');
+ values.append(pattern);
         }
- propertySet(path, "svn:ignore", value, false);
+ propertySet(path, "svn:ignore", values.toString(), false);
     }
 
     public void mkdir(File file) throws SVNClientException {
- try {
- _cmd.mkdir(toString(file));
- } catch (CmdLineException e) {
- SVNClientException.w​rapException(e);
- }
+ try {
+ _cmd.mkdir(toString(file));
+ } catch (CmdLineException e) {
+ SVNClientException.w​rapException(e);
+ }
         //sometimes the dir has not yet been created.
         //wait up to 5 sec for the dir to be created.
         for (int i = 0; i < 50 && !file.exists(); i++) {
@@ -697,29 +687,25 @@
         }
     }
 
- public void propertySet(File path, String propertyName, File propertyFile, boolean recurse)
- throws SVNClientException, IOException {
+ public void copy(File srcPath, SVNUrl destUrl, String message) throws SVNClientException {
+ // TODO : test
         try {
- _cmd.propsetFile(propertyName, toString(propertyFile), toString(path), recurse);
+ _cmd.copy(toString(srcPath), toString(destUrl), message, null);
         } catch (CmdLineException e) {
             throw SVNClientException.w​rapException(e);
         }
     }
 
- public void copy(File srcPath, SVNUrl destUrl, String message) throws SVNClientException {
- // TODO : implement
- }
-
     public ISVNLogMessage[] getLogMessages(
         File path,
         SVNRevision revisionStart,
         SVNRevision revisionEnd)
         throws SVNClientException {
         List tempLogs = new java.util.LinkedList();
- String revRange = revisionStart.toString() + ":" + revisionEnd.toString();
+ String revRange = toString(revisionStart) + ":" + toString(revisionEnd);
 
         try {
- String messages = _cmd.log(path.toString(), revRange);
+ String messages = _cmd.log(toString(path), revRange);
 
             StringTokenizer st = new StringTokenizer(messages, Helper.NEWLINE);
             st.nextToken();
@@ -739,14 +725,10 @@
     public void copy(SVNUrl srcUrl, File destPath, SVNRevision revision)
         throws SVNClientException {
         try {
- _cmd.copy(
- srcUrl.toString(),
- destPath.toString(),
- null,
- revision.toString());
- } catch (CmdLineException e) {
- SVNClientException.w​rapException(e);
- }
+ _cmd.copy(toString(srcUrl), toString(destPath), null, toString(revision));
+ } catch (CmdLineException e) {
+ SVNClientException.w​rapException(e);
+ }
     }
 
     /* (non-Javadoc)
@@ -807,60 +789,59 @@
         }
         return byteArray;
     }
-
- public SVNKeywords getKeywords(File path) throws SVNClientException {
- // copied directly from JhlClientAdapter
- ISVNProperty prop = propertyGet(path, ISVNProperty.KEYWORDS);
- if (prop == null)
- return new SVNKeywords();
-
- // value is a space-delimited list of the keywords names
- String value = prop.getValue();
-
- return new SVNKeywords(value);
- }
-
-
- public void setKeywords(File path, SVNKeywords keywords, boolean recurse) throws SVNClientException {
- // copied directly from JhlClientAdapter
- propertySet(path, ISVNProperty.KEYWORDS, keywords.toString(), recurse);
- }
-
- public SVNKeywords addKeywords(File path, SVNKeywords keywords) throws SVNClientException {
- // copied directly from JhlClientAdapter
- SVNKeywords currentKeywords = getKeywords(path);
- if (keywords.isHeadUrl())
- currentKeywords.setH​eadUrl(true);
- if (keywords.isId())
- currentKeywords.setId(true);
- if (keywords.isLastChangedBy())
- currentKeywords.setL​astChangedBy(true);
- if (keywords.isLastChangedDate())
- currentKeywords.setL​astChangedBy(true);
- if (keywords.isLastChan​gedRevision())
- currentKeywords.setL​astChangedRevision(t​rue);
- setKeywords(path,cur​rentKeywords,false);​
-
- return currentKeywords;
- }
-
- public SVNKeywords removeKeywords(File path, SVNKeywords keywords) throws SVNClientException {
- // copied directly from JhlClientAdapter
- SVNKeywords currentKeywords = getKeywords(path);
- if (keywords.isHeadUrl())
- currentKeywords.setH​eadUrl(false);
- if (keywords.isId())
- currentKeywords.setId(false);
- if (keywords.isLastChangedBy())
- currentKeywords.setL​astChangedBy(false);​
- if (keywords.isLastChangedDate())
- currentKeywords.setL​astChangedBy(false);​
- if (keywords.isLastChan​gedRevision())
- currentKeywords.setL​astChangedRevision(f​alse);
- setKeywords(path,cur​rentKeywords,false);​
-
- return currentKeywords;
- }
-
-
+
+ public SVNKeywords getKeywords(File path) throws SVNClientException {
+ // copied directly from JhlClientAdapter
+ ISVNProperty prop = propertyGet(path, ISVNProperty.KEYWORDS);
+ if (prop == null)
+ return new SVNKeywords();
+
+ // value is a space-delimited list of the keywords names
+ String value = prop.getValue();
+
+ return new SVNKeywords(value);
+ }
+
+ public void setKeywords(File path, SVNKeywords keywords, boolean recurse)
+ throws SVNClientException {
+ // copied directly from JhlClientAdapter
+ propertySet(path, ISVNProperty.KEYWORDS, keywords.toString(), recurse);
+ }
+
+ public SVNKeywords addKeywords(File path, SVNKeywords keywords) throws SVNClientException {
+ // copied directly from JhlClientAdapter
+ SVNKeywords currentKeywords = getKeywords(path);
+ if (keywords.isHeadUrl())
+ currentKeywords.setH​eadUrl(true);
+ if (keywords.isId())
+ currentKeywords.setId(true);
+ if (keywords.isLastChangedBy())
+ currentKeywords.setL​astChangedBy(true);
+ if (keywords.isLastChangedDate())
+ currentKeywords.setL​astChangedBy(true);
+ if (keywords.isLastChan​gedRevision())
+ currentKeywords.setL​astChangedRevision(t​rue);
+ setKeywords(path, currentKeywords, false);
+
+ return currentKeywords;
+ }
+
+ public SVNKeywords removeKeywords(File path, SVNKeywords keywords) throws SVNClientException {
+ // copied directly from JhlClientAdapter
+ SVNKeywords currentKeywords = getKeywords(path);
+ if (keywords.isHeadUrl())
+ currentKeywords.setH​eadUrl(false);
+ if (keywords.isId())
+ currentKeywords.setId(false);
+ if (keywords.isLastChangedBy())
+ currentKeywords.setL​astChangedBy(false);​
+ if (keywords.isLastChangedDate())
+ currentKeywords.setL​astChangedBy(false);​
+ if (keywords.isLastChan​gedRevision())
+ currentKeywords.setL​astChangedRevision(f​alse);
+ setKeywords(path, currentKeywords, false);
+
+ return currentKeywords;
+ }
+
 }

--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@subc​lipse.tigris.org
For additional commands, e-mail: cvs-help at subclipse dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

subclipse commit: rev 261 - trunk/svnClientAdapter/src/main/org/tigris/subversion/svnclientadapter/commandline schatz Philip Schatz 2003-10-29 07:23:51 PST
Messages per page: