Don't populate the default value of the Subversion local directory name.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@18916 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-06-15 20:56:45 +00:00
1 parent 679ffdee68
commit 04f1dd6712
2 files changed
+26 -16

No files matched your search

@@ -503,8 +503,8 @@ public class SubversionSCM extends SCM implements Serializable {
try {
listener.getLogger().println("Updating "+ l.remote);
File local = new File(ws, l.local);
svnuc.setEventHandler(new SubversionUpdateEventHandler(listener.getLogger(), externals,local,l.local));
File local = new File(ws, l.getLocalDir());
svnuc.setEventHandler(new SubversionUpdateEventHandler(listener.getLogger(), externals,local,l.getLocalDir()));
svnuc.doUpdate(local.getCanonicalFile(), l.getRevision(revision), true);
} catch (final SVNException e) {
@@ -544,8 +544,8 @@ public class SubversionSCM extends SCM implements Serializable {
try {
listener.getLogger().println("Checking out "+l.remote);
File local = new File(ws, l.local);
svnuc.setEventHandler(new SubversionUpdateEventHandler(new PrintStream(pos), externals, local, l.local));
File local = new File(ws, l.getLocalDir());
svnuc.setEventHandler(new SubversionUpdateEventHandler(new PrintStream(pos), externals, local, l.getLocalDir()));
svnuc.doCheckout(l.getSVNURL(), local.getCanonicalFile(), SVNRevision.HEAD, l.getRevision(revision), true);
} catch (SVNException e) {
e.printStackTrace(listener.error("Failed to check out "+l.remote));
@@ -772,7 +772,7 @@ public class SubversionSCM extends SCM implements Serializable {
// invoke the "svn info"
for( ModuleLocation module : locations ) {
try {
SvnInfo info = new SvnInfo(svnWc.doInfo(new File(ws,module.local), SVNRevision.WORKING));
SvnInfo info = new SvnInfo(svnWc.doInfo(new File(ws,module.getLocalDir()), SVNRevision.WORKING));
revisions.put(info.url,info);
} catch (SVNException e) {
e.printStackTrace(listener.error("Failed to parse svn info for "+module.remote));
@@ -826,7 +826,7 @@ public class SubversionSCM extends SCM implements Serializable {
public Boolean invoke(File ws, VirtualChannel channel) throws IOException {
for (ModuleLocation l : locations) {
String moduleName = l.local;
String moduleName = l.getLocalDir();
File module = new File(ws,moduleName).getCanonicalFile(); // canonicalize to remove ".." and ".". See #474
if(!module.exists()) {
@@ -1004,7 +1004,7 @@ public class SubversionSCM extends SCM implements Serializable {
public FilePath getModuleRoot(FilePath workspace) {
if (getLocations().length > 0)
return workspace.child(getLocations()[0].local);
return workspace.child(getLocations()[0].getLocalDir());
return workspace;
}
@@ -1013,7 +1013,7 @@ public class SubversionSCM extends SCM implements Serializable {
if (moduleLocations.length > 0) {
FilePath[] moduleRoots = new FilePath[moduleLocations.length];
for (int i = 0; i < moduleLocations.length; i++) {
moduleRoots[i] = workspace.child(moduleLocations[i].local);
moduleRoots[i] = workspace.child(moduleLocations[i].getLocalDir());
}
return moduleRoots;
}
@@ -1670,8 +1670,11 @@ public class SubversionSCM extends SCM implements Serializable {
*/
public final String remote;
/**
* Local directory to place the file to.
* Relative to the workspace root.
* Remembers the user-given value.
* Can be null.
*
* @deprecated
* Code should use {@link #getLocalDir()}. This field is only intended for form binding.
*/
public final String local;
@@ -1682,11 +1685,18 @@ public class SubversionSCM extends SCM implements Serializable {
private transient volatile SVNURL repositoryRoot;
public ModuleLocation(String remote, String local) {
if(local==null)
local = getLastPathComponent(remote);
this.remote = remote.trim();
this.local = local.trim();
this.local = Util.fixEmptyAndTrim(local);
}
/**
* Local directory to place the file to.
* Relative to the workspace root.
*/
public String getLocalDir() {
if(local==null)
return getLastPathComponent(remote);
return local;
}
/**
@@ -1781,7 +1791,7 @@ public class SubversionSCM extends SCM implements Serializable {
* values.
*/
public ModuleLocation getExpandedLocation(AbstractBuild<?, ?> build) {
return new ModuleLocation(getExpandedRemote(build), local);
return new ModuleLocation(getExpandedRemote(build), getLocalDir());
}
public String toString() {
@@ -262,7 +262,7 @@ public class SubversionSCMTest extends HudsonTestCase {
ModuleLocation[] rl = rhs.getLocations();
assertEquals(ll.length, rl.length);
for(int i=0; i<ll.length; i++) {
assertEquals(ll[i].local, rl[i].local);
assertEquals(ll[i].getLocalDir(), rl[i].getLocalDir());
assertEquals(ll[i].remote, rl[i].remote);
}