making more progress. bug fixes and added "clear error" support.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3404 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-06-07 05:53:09 +00:00
1 parent 27ef6caa74
commit a9684270e9
3 files changed
+25 -22

No files matched your search

@@ -5,6 +5,7 @@ import hudson.model.TaskListener;
import hudson.model.AbstractModelObject;
import hudson.model.Action;
import hudson.model.AbstractBuild;
import hudson.model.Hudson;
import hudson.util.ByteBuffer;
import hudson.util.StreamTaskListener;
@@ -84,6 +85,18 @@ public abstract class AbstractScmTagAction extends AbstractModelObject implement
}
}
/**
* Clears the error status.
*/
public synchronized void doClearError(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
if(!Hudson.adminCheck(req,rsp))
return;
if(workerThread!=null && !workerThread.isAlive())
workerThread = null;
rsp.sendRedirect(".");
}
public static abstract class AbstractTagWorkerThread extends Thread {
// StringWriter is synchronized
-12
View File
@@ -1104,18 +1104,6 @@ public class CVSSCM extends AbstractCVSFamilySCM implements Serializable {
return name==null || name.length()==0;
}
/**
* Clears the error status.
*/
public synchronized void doClearError(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
if(!Hudson.adminCheck(req,rsp))
return;
if(workerThread!=null && !workerThread.isAlive())
workerThread = null;
doIndex(req,rsp);
}
/**
* Performs tagging.
*/
@@ -4,6 +4,7 @@ import hudson.model.AbstractBuild;
import hudson.model.Action;
import hudson.model.Hudson;
import hudson.model.TaskListener;
import hudson.model.LargeText;
import hudson.scm.SubversionSCM.SvnInfo;
import hudson.util.CopyOnWriteMap;
import org.kohsuke.stapler.StaplerRequest;
@@ -24,6 +25,7 @@ import java.util.Map;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.Map.Entry;
import java.lang.ref.WeakReference;
/**
* {@link Action} that lets people create tag for the given build.
@@ -103,7 +105,7 @@ public class SubversionTagAction extends AbstractScmTagAction {
Map<SvnInfo,String> newTags = new HashMap<SvnInfo,String>();
int i=0;
int i=-1;
for (Entry<SvnInfo, String> e : tags.entrySet()) {
i++;
if(req.getParameter("tag"+i)==null)
@@ -111,7 +113,7 @@ public class SubversionTagAction extends AbstractScmTagAction {
newTags.put(e.getKey(),req.getParameter("name" + i));
}
new TagWorkerThread(build,newTags).start();
new TagWorkerThread(newTags).start();
rsp.sendRedirect(".");
}
@@ -119,19 +121,19 @@ public class SubversionTagAction extends AbstractScmTagAction {
/**
* The thread that performs tagging operation asynchronously.
*/
public static final class TagWorkerThread extends AbstractTagWorkerThread {
/**
* Build that has triggered the tagging operation.
*/
private final AbstractBuild build;
public final class TagWorkerThread extends AbstractTagWorkerThread {
private final Map<SvnInfo,String> tagSet;
public TagWorkerThread(AbstractBuild build, Map<SvnInfo, String> tagSet) {
this.build = build;
public TagWorkerThread(Map<SvnInfo, String> tagSet) {
this.tagSet = tagSet;
}
public synchronized void start() {
SubversionTagAction.this.workerThread = this;
SubversionTagAction.this.log = new WeakReference<LargeText>(text);
super.start();
}
@Override
protected void perform(TaskListener listener) {
SVNClientManager cm = SubversionSCM.createSvnClientManager(SubversionSCM.DescriptorImpl.DESCRIPTOR.createAuthenticationProvider());