提交 27ef6caa 编写于 作者: K kohsuke

implemented tag name suggestion algorithm.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@3403 71c3de6d-444a-0410-be80-ed276b4c234a
上级 2a8f7cf1
...@@ -21,6 +21,8 @@ import java.util.Collection; ...@@ -21,6 +21,8 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.Map.Entry; import java.util.Map.Entry;
/** /**
...@@ -75,6 +77,23 @@ public class SubversionTagAction extends AbstractScmTagAction { ...@@ -75,6 +77,23 @@ public class SubversionTagAction extends AbstractScmTagAction {
return Collections.unmodifiableMap(tags); return Collections.unmodifiableMap(tags);
} }
private static final Pattern TRUNK_BRANCH_MARKER = Pattern.compile("/(trunk|branches)(/|$)");
/**
* Creates a URL, to be used as the default value of the module tag URL.
*
* @return
* null if failed to guess.
*/
public String makeTagURL(SvnInfo si) {
// assume the standard trunk/branches/tags repository layout
Matcher m = TRUNK_BRANCH_MARKER.matcher(si.url);
if(!m.find())
return null; // doesn't have 'trunk' nor 'branches'
return si.url.substring(0,m.start())+"/tags/"+build.getProject().getName()+"-"+build.getNumber();
}
/** /**
* Invoked to actually tag the workspace. * Invoked to actually tag the workspace.
*/ */
......
...@@ -22,7 +22,10 @@ ...@@ -22,7 +22,10 @@
<td style="white-space:nowrap;"><label for="tag${loop.index}"> <td style="white-space:nowrap;"><label for="tag${loop.index}">
${m.key.url} (rev.${m.key.revision}) ${m.key.url} (rev.${m.key.revision})
</label></td> </label></td>
<td width="100%"><input type="text" name="name${loop.index}" value="xxx" style="width:100%" id="name${loop.index}" /></td> <td width="100%">
<input type="text" name="name${loop.index}"
value="${it.makeTagURL(m.key)}" style="width:100%" id="name${loop.index}" />
</td>
</tr> </tr>
</j:forEach> </j:forEach>
</table> </table>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册