Class SVNUrlUtils
- java.lang.Object
-
- org.tigris.subversion.svnclientadapter.utils.SVNUrlUtils
-
public class SVNUrlUtils extends java.lang.Object
Utility class
-
-
Constructor Summary
Constructors Constructor Description SVNUrlUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SVNUrl
getCommonRootUrl(SVNUrl[] urls)
get the common root url for given urlsstatic SVNUrl
getCommonRootUrl(SVNUrl url1, SVNUrl url2)
get the common root url for given urlsstatic java.lang.String
getRelativePath(SVNUrl rootUrl, SVNUrl url)
Get path of url relative to rootUrlstatic java.lang.String
getRelativePath(SVNUrl rootUrl, SVNUrl url, boolean includeStartingSlash)
Get path of url relative to rootUrlstatic SVNUrl
getUrlFromLocalFileName(java.lang.String localFileName, java.lang.String parentUrl, java.lang.String parentPathName)
Get url representing the fileName of working copy.static SVNUrl
getUrlFromLocalFileName(java.lang.String localFileName, SVNUrl parentUrl, java.lang.String parentPathName)
Get url representing the fileName of working copy.
-
-
-
Method Detail
-
getCommonRootUrl
public static SVNUrl getCommonRootUrl(SVNUrl url1, SVNUrl url2)
get the common root url for given urls- Parameters:
url1
-url2
-- Returns:
- the common root url for given urls
-
getCommonRootUrl
public static SVNUrl getCommonRootUrl(SVNUrl[] urls)
get the common root url for given urls- Parameters:
urls
-- Returns:
- the common root url for given urls
-
getRelativePath
public static java.lang.String getRelativePath(SVNUrl rootUrl, SVNUrl url)
Get path of url relative to rootUrl- Parameters:
rootUrl
-url
-- Returns:
- relative path or null if rootUrl is not a parent of url
-
getRelativePath
public static java.lang.String getRelativePath(SVNUrl rootUrl, SVNUrl url, boolean includeStartingSlash)
Get path of url relative to rootUrl- Parameters:
rootUrl
-url
-includeStartingSlash
- whether the realtive url should start with / or not- Returns:
- relative path or null if rootUrl is not a parent of url
-
getUrlFromLocalFileName
public static SVNUrl getUrlFromLocalFileName(java.lang.String localFileName, SVNUrl parentUrl, java.lang.String parentPathName)
Get url representing the fileName of working copy. Use the parent's (not necesarily direct parent) WC fileName and SVNUrl to calculate it. E.g.SVNUrl rootUrl = new SVNUrl("http://svn.collab.net:81/repos/mydir"); String rootPath = "C:\\Documents and Settings\\User\\My Documents\\Eclipse\\mydir"; String filePath = "C:\\Documents and Settings\\User\\My Documents\\Eclipse\\mydir\\mydir2\\myFile.txt"; SVNUrl expected = new SVNUrl("http://svn.collab.net:81/repos/mydir/mydir2/myFile.txt"); assertEquals(expected,SVNUrlUtils.getUrlFromLocalFileName(filePath, rootUrl, rootPath));
- Parameters:
localFileName
- name of the file representing working copy of resourceparentUrl
- svnUrl of a resource preceeding the localFileName in hierarchyparentPathName
- WC fileName of a resource preceeding the localFileName in hierarchy- Returns:
- url representing the fileName of working copy.
-
getUrlFromLocalFileName
public static SVNUrl getUrlFromLocalFileName(java.lang.String localFileName, java.lang.String parentUrl, java.lang.String parentPathName)
Get url representing the fileName of working copy. Use the parent's (not necesarily direct parent) WC fileName and SVNUrl to calculate it. E.g.SVNUrl rootUrl = new SVNUrl("http://svn.collab.net:81/repos/mydir"); String rootPath = "C:\\Documents and Settings\\User\\My Documents\\Eclipse\\mydir"; String filePath = "C:\\Documents and Settings\\User\\My Documents\\Eclipse\\mydir\\mydir2\\myFile.txt"; SVNUrl expected = new SVNUrl("http://svn.collab.net:81/repos/mydir/mydir2/myFile.txt"); assertEquals(expected,SVNUrlUtils.getUrlFromLocalFileName(filePath, rootUrl, rootPath));
- Parameters:
localFileName
- name of the file representing working copy of resourceparentUrl
- url string of a resource preceeding the localFileName in hierarchyparentPathName
- WC fileName of a resource preceeding the localFileName in hierarchy- Returns:
- url representing the fileName of working copy.
-
-