[Anthill] Subversion support for Anthill OS

Matt Avery mavery at einnovation.com
Wed Feb 25 08:52:49 CST 2004


Thanks Jim, I'm interested.

Subversion 1.0 has been released.

Jim Hague wrote:
> I tried Anthill OS 1.6.3.67 out a few weeks ago against CVS. It's a nice tool -
> much appreciation to all. Does just what I want.
> 
> For reasons that will become obvious in a moment, I then tried out current CVS.
> I had a problem with class files getting corrupted (building on Linux - Debian
> stable & unstable). The following seems to sort it:
> 
> ===================================================================
> RCS file: /usr/local/cvs/Anthill/build/build.xml,v
> retrieving revision 1.26
> diff -u -r1.26 build.xml
> --- build/build.xml     2003/04/30 19:06:08     1.26
> +++ build/build.xml     2004/02/25 13:40:38
> @@ -137,8 +137,9 @@
>      <fixcrlf srcdir="${conf.profile.dir}/Unix/unix_cvs" />
>      <fixcrlf srcdir="${conf.profile.dir}/Unix/unix_perforce" />
>      <fixcrlf srcdir="${conf.profile.dir}/Unix/unix_pvcs" />
> +    <fixcrlf srcdir="${conf.profile.dir}/Unix/unix_subversion" />
>      <fixcrlf srcdir="${conf.profile.dir}/Unix/unix_vss" />
> -    <fixcrlf srcdir="${build.dir}" excludes="**/CVS" />
> +    <fixcrlf srcdir="${build.dir}" excludes="**/CVS **/*.class" />
>    </target>
>     
>  </project>
> ===================================================================
> 
> I then went and coverted our repository to Subversion. Which left an itch to be
> scratched. Anyone reading the above patch closely will have guessed that I've
> been scratching it.
> 
> So, attached for anyone that might be interested, is my initial attempt at
> adding Subversion support to Anthill OS. The patch is against current CVS. It's
> a work in progress - I haven't even tried the tagging code or building a
> specific revision, for example - but it Works For Me building my main project
> with Subversion 0.37. Documentation is lacking too. This is strictly 'chuck it
> over the wall and see if anyone's interested' at present.
> 
> Obviously I'm new to Anthill, so please be patient if I've grossly
> misunderstood how it all is supposed to work.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> diff -Naur -x CVS Anthill-urbancode/source/main/java/com/urbancode/anthill/adapt
> er/ChangesetRevision.java Anthill/source/main/java/com/urbancode/anthill/adapter
> /ChangesetRevision.java
> --- Anthill-urbancode/source/main/java/com/urbancode/anthill/adapter/ChangesetRe
> vision.java	1970-01-01 01:00:00.000000000 +0100
> +++ Anthill/source/main/java/com/urbancode/anthill/adapter/ChangesetRevision.jav
> a	2004-02-25 13:21:07.000000000 +0000
> @@ -0,0 +1,160 @@
> +/*
> + * ChangesetRevision.java
> + *
> + * Created on February 23rd 2004.
> + */
> +
> +package com.urbancode.anthill.adapter;
> +
> +import org.apache.log4j.Category;
> +import java.util.Date;
> +import java.util.Enumeration;
> +import java.util.Vector;
> +import java.text.DateFormat;
> +
> +/**
> + * The Revision class assumes a SCM that is file-change based. This
> + * doesn't really fit too well with more modern SCM that are changeset
> + * based. The changeset consists of a comment about the changeset and
> + * a list of the files in that changeset. Yes, you can create a
> + * file-based changeset from that but unless your SCM supports
> + * per-file comments and your users make fully use of that then the
> + * changelog is going to look a bit silly; a list of filenames all
> + * with the same comment. Urgh.
> + * <p>
> + * So this class implements a more Changeset-friendly revision. It
> + * doesn't handle per-file comments in addition to the changeset
> + * comment at the moment, because I'm scratching a Subversion itch,
> + * and Subversion doesn't have per-file comments. 
> + *
> + * @author Jim Hague, <jim.hague at acm.org>
> + */
> +public class ChangesetRevision
> +    extends Revision
> +{
> +    // Create Log4j category instance for logging
> +    static private Category log = Category.getInstance(ChangesetRevision.class.
> getName());
> +    
> +    // Date format used for the revision date. Living on the
> +    // right-hand side of the pond I can't stomach MM/dd/yy, but let's
> +    // try being ecumenical and use something Java thinks is locale
> +    // friendly. That'll be server locale, of course.
> +    private static final DateFormat DATE_FORMAT =
> +	DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM);
> +
> +    // 'userName', 'date' and 'comment' fields are inherited from Revision.
> +    public String changeId;
> +
> +    // Vectors of Revisions for files added, delted, modified or replaced.
> +    public Vector filesAdded = new Vector();
> +    public Vector filesDeleted = new Vector();
> +    public Vector filesModified = new Vector();
> +    public Vector filesReplaced = new Vector();
> +
> +    /**
> +     * Build an empty revision.
> +     */
> +    public ChangesetRevision()
> +    {
> +    }
> +
> +    /**
> +     * Build a revision with the given initial settings.
> +     */
> +    public ChangesetRevision(String changeId, String user, Date date)
> +    {
> +	this.changeId = changeId;
> +	this.userName = user;
> +	this.date = date;
> +    }
> +
> +    /**
> +     * Add a Revision for an added file.
> +     */
> +    public void addAddedFile(Revision r)
> +    {
> +	filesAdded.add(r);
> +    }
> +    
> +    /**
> +     * Add a Revision for a deleted file.
> +     */
> +    public void addDeletedFile(Revision r)
> +    {
> +	filesDeleted.add(r);
> +    }
> +    
> +    /**
> +     * Add a Revision for a modified file.
> +     */
> +    public void addModifiedFile(Revision r)
> +    {
> +	filesModified.add(r);
> +    }
> +    
> +    /**
> +     * Add a Revision for a replaced file.
> +     */
> +    public void addReplacedFile(Revision r)
> +    {
> +	filesReplaced.add(r);
> +    }
> +    
> +    public String toString()
> +    {
> +	// The output is as follows:
> +	//
> +	// Change ID	user	date
> +	//
> +	// Added files:
> +	//	foo/bar/seagoon.java
> +	// Deleted files:
> +	//	foo/bar/bloodnok.java
> +	// Modified files:
> +	//	foo/bar/eccles.java
> +	// Replaced files:
> +	//	foo/bar/bluebottle.java
> +	//
> +	// Comment line 1
> +	// Comment line 2
> +	// etc.
> +	StringBuffer buf = new StringBuffer();
> +
> +	buf.append(changeId);
> +	buf.append("\t");
> +	buf.append(userName);
> +	buf.append("\t");
> +	buf.append(DATE_FORMAT.format(date));
> +	buf.append("\n\n");
> +
> +	addFilesToBuf(buf, filesAdded, "Added files");
> +	addFilesToBuf(buf, filesDeleted, "Deleted files");
> +	addFilesToBuf(buf, filesModified, "Modified files");
> +	addFilesToBuf(buf, filesReplaced, "Replaced files");
> +
> +	buf.append(comment.trim());
> +	buf.append("\n");
> +
> +	return buf.toString();
> +    }
> +
> +    private void addFilesToBuf(StringBuffer buf, Vector files, String title)
> +    {
> +	if ( files.isEmpty() )
> +	    return;
> +
> +	buf.append(title);
> +	buf.append(":\n");
> +	for (Enumeration e = files.elements() ; e.hasMoreElements() ;)
> +	{
> +	    Revision r = (Revision) e.nextElement();
> +	    
> +	    buf.append("\t");
> +	    buf.append(r.fileName);
> +	    buf.append("\n");
> +	}
> +
> +	buf.append("\n");
> +    }
> +}
> +
> diff -Naur -x CVS Anthill-urbancode/source/main/java/com/urbancode/anthill/adapt
> er/SubversionRepositoryAdapter.java Anthill/source/main/java/com/urbancode/anthi
> ll/adapter/SubversionRepositoryAdapter.java
> --- Anthill-urbancode/source/main/java/com/urbancode/anthill/adapter/SubversionR
> epositoryAdapter.java	1970-01-01 01:00:00.000000000 +0100
> +++ Anthill/source/main/java/com/urbancode/anthill/adapter/SubversionRepositoryA
> dapter.java	2004-02-25 11:24:01.000000000 +0000
> @@ -0,0 +1,290 @@
> +/*
> + * SubversionRepositoryAdapter.java
> + *
> + * Created on February 23rd 2004
> + */
> +package com.urbancode.anthill.adapter;
> +
> +import org.apache.log4j.Category;
> +import com.urbancode.anthill.util.Execute;
> +import com.urbancode.anthill.util.StreamPumper;
> +import com.urbancode.anthill.AnthillProject;
> +import com.urbancode.anthill.ProjectProperties;
> +import com.urbancode.anthill.BuildDefinition;
> +import com.urbancode.anthill.util.FileRemover;
> +import java.io.*;
> +import java.text.ParseException;
> +import java.text.SimpleDateFormat;
> +import java.util.List;
> +import java.util.ArrayList;
> +import java.util.Date;
> +import java.util.StringTokenizer;
> +import java.util.Iterator;
> +import java.util.TimeZone;
> +import java.util.Map;
> +import java.util.HashMap;
> +import java.util.Vector;
> +import com.urbancode.pagelet.*;
> +import org.apache.regexp.*;
> +
> +/**
> + * <p>
> + * An implementation of <code>RepositoryAdapter</code> that interfaces with
> + * a command-line Subversion client to work with a Subversion repository.</p>
> + * <p>
> + * The following extra properties must be specified for this adapter in the
> + * .anthill file:
> + * <ul>
> + *   <li>SVN_URL - the URL pointing to the repository.
> + *   <li>SVN_USER - access the repository with this username
> + *   <li>SVN_PASS - access the repository with this password
> + * </ul></p>
> + *
> + * @author  Jim Hague <jim.hague at acm.org>
> + */
> +public class SubversionRepositoryAdapter extends ProfileRepositoryAdapter {
> +    
> +    //*************************************************************************
> *
> +    // CLASS
> +    //*************************************************************************
> +    
> +    // Create Log4j category instance for logging
> +    static private Category log = Category.getInstance(SubversionRepositoryAdap
> ter.class.getName());
> +    // Create Log4j category instance for logging
> +    static private Category streamLog = Category.getInstance(SubversionReposito
> ryAdapter.class.getName()+"Stream");
> +    // CVS project property key
> +    
> +    static public final String ADAPTER_SUFFIX = "subversion";
> +    
> +    static protected final String GET_REVISIONS_SINCE_PAGELET = "getRevisionsSi
> nce.pgl";
> +    static protected final String COMMAND_INIT = "getCommandInit.pgl";
> +
> +    // The various property keys
> +    static public final String WORK_DIR_KEY = "repository.subversion.work.dir";
> +    static public final String URL_KEY = "repository.subversion.url";
> +    static public final String TAGS_URL_KEY = "repository.subversion.tags.url";
> +    static public final String USER_KEY = "repository.subversion.anthill.user";
> +    static public final String PASSWORD_KEY = "repository.subversion.anthill.pa
> ssword";
> +
> +    // The comment for build increment commits.
> +    public static final String BUILD_INCREMENT_COMMENT = "Anthill: Increment bu
> ild number";
> +    
> +    // date format understood by Subversion commands
> +    public static SimpleDateFormat SUBVERSION_DATE = new SimpleDateFormat("yyyy
> -MM-dd HH:mm:ss ZZZZZ");
> +
> +    // The file delimiting token in log output.
> +    private static final String REV_DELIM_TOKEN = "----------------------------
> --------------------------------------------";
> +    
> +    private static final String NEW_LINE = System.getProperty("line.separator")
> ;
> +    
> +    /**
> +     * Create a new SubversionRepositoryAdapter
> +     */
> +    public SubversionRepositoryAdapter() {
> +    }
> +    
> +    public String getAdapterSuffix() {
> +        return ADAPTER_SUFFIX;
> +    }
> +    
> +    protected void calculateRepositoryProperties()
> +	throws RepositoryException {
> +	// calculate the work directory, and local project directory
> +	calculateWorkDirName(WORK_DIR_KEY);
> +	localProjectDirName = workDirName;
> +    }
> +    
> +    /**
> +     * Returns a List of Revision objects detailing the changes that have
> +     * been made since the specified date.
> +     * <p>
> +     * It isn't particularly simple to get per-file change info out of
> +     * Subversion. So to keep things simple for the moment, don't
> +     * try. Subvert a Revision object to describe a Subversion
> +     * revision. Set the revision number in the filename and put the
> +     * log output into the comment. If the comment is the same as the
> +     * build number auto-commit commit, assume the revision is the
> +     * build increment revision and ignore it.
> +     *
> +     * @param Date
> +     * @return List.
> +     */
> +    public List getRevisionsSince(Date date)
> +    throws RepositoryException {
> +        
> +        Process p = null;
> +        StreamPumper errorPumper = null;
> +        int exitcode = 0;
> +        List revisionList = new ArrayList();
> +        try {
> +            Map tempMap = new HashMap();
> +            tempMap.put("Adapter", this);
> +            tempMap.put("Properties", project.getProperties());
> +            tempMap.put("Date", date);
> +            Pagelet pagelet = getPageletFactory().getPagelet(makeProfilePagelet
> Name(GET_REVISIONS_SINCE_PAGELET));
> +            String commandString = pagelet.service(tempMap);
> +            log.info("Get revisions since command: " + commandString);
> +            p = Runtime.getRuntime().exec(toArray(commandString));
> +
> +            // pump the error stream.
> +            errorPumper = new StreamPumper(p.getErrorStream(), "getRevisions",
> +            System.err, true);
> +            errorPumper.start();
> +            
> +            // get and parse the input stream
> +            InputStream input = p.getInputStream();
> +            parseLogCommandResult(input, revisionList);
> +            
> +            exitcode = p.waitFor();
> +            
> +        }
> +        catch (Exception e) {
> +            log.error(e.getMessage() + " thrown in new catch");
> +            e.printStackTrace();
> +            throw new RepositoryException(e.getMessage());
> +        }
> +        finally {
> +            if (errorPumper != null) {
> +                try {
> +                    errorPumper.join();
> +                } catch (InterruptedException e) {
> +                    throw new RepositoryException(e);
> +                }
> +            }
> +        }
> +        
> +        // handle errors
> +        if (exitcode != 0) {
> +            throw (new RepositoryException("svn log failed.  Exit code: " + exi
> tcode));
> +        }
> +        log.debug("returning revisionList");
> +        return revisionList;
> +    }
> +    
> +    protected void parseLogCommandResult(InputStream in, List revList)
> +	throws IOException, RepositoryException {
> +	final int PARSE_REV_START = 1;
> +	final int PARSE_REV_FILELIST = 2;
> +	final int PARSE_REV_COMMENT = 3;
> +	
> +        BufferedReader br = new BufferedReader(new InputStreamReader(in));
> +	ChangesetRevision rev = null;
> +	StringBuffer comment = new StringBuffer();
> +	RE headerRE = null;
> +	RE fileRE = null;
> +	int parseState = PARSE_REV_START;
> +	
> +	try
> +	{
> +	    headerRE = new RE("^r(\\d+) \\| (\\S+) \\| ([^\\(]+)");
> +	    fileRE = new RE("^   ([ADMR]) /(\\S+)");
> +	}
> +	catch (RESyntaxException rse)
> +	{
> +	    log.error(rse);
> +	    throw new RepositoryException(rse);
> +	}
> +	
> +	for ( String line = br.readLine(); line != null; line = br.readLine() )
> +	{
> +	    switch (parseState)
> +	    {
> +	    case PARSE_REV_START:
> +		// Just look out for lines matching the header.
> +		if ( headerRE.match(line) )
> +		{
> +		    try
> +		    {
> +			String revId = headerRE.getParen(1);
> +			String user = headerRE.getParen(2);
> +			Date date = SUBVERSION_DATE.parse(headerRE.getParen(3));
> +
> +			rev = new ChangesetRevision("Revision " + revId,
> +						    user, date);
> +
> +			log.debug("RevID: " + revId);
> +			log.debug("User: " + user);
> +			log.debug("Date: " + rev.date);
> +		    }
> +		    catch (ParseException pe)
> +		    {
> +			log.warn(pe);
> +		    }
> +		    parseState = PARSE_REV_FILELIST;
> +		}
> +		break;
> +
> +	    case PARSE_REV_FILELIST:
> +		// Grab all file info lines, ignoring any that doesn't
> +		// match their pattern. The end of this section is
> +		// indicated by a blank line.
> +		if ( fileRE.match(line) )
> +		{
> +		    char ftype = fileRE.getParen(1).charAt(0);
> +		    Revision filerev = new Revision();
> +
> +		    filerev.fileName = fileRE.getParen(2);
> +		    switch(ftype)
> +		    {
> +		    case 'A':
> +			rev.addAddedFile(filerev);
> +			break;
> +
> +		    case 'D':
> +			rev.addDeletedFile(filerev);
> +			break;
> +
> +		    case 'M':
> +			rev.addModifiedFile(filerev);
> +			break;
> +
> +		    case 'R':
> +			rev.addReplacedFile(filerev);
> +			break;
> +		    }
> +		}
> +		else if (line.trim().length() == 0 )
> +		    parseState = PARSE_REV_COMMENT;
> +		break;
> +
> +	    case PARSE_REV_COMMENT:
> +		// Everything is a comment line up to the delimiter line.
> +		if ( line.startsWith(REV_DELIM_TOKEN ) )
> +		{
> +		    // End of revision info. Add the current revision
> +		    // provided that the revision is not a build
> +		    // version increment.
> +		    if ( comment.lastIndexOf(BUILD_INCREMENT_COMMENT) < 0 )
> +		    {
> +			rev.comment = comment.toString();
> +			revList.add(rev);
> +		    }
> +
> +		    // Empty the comment buffer and reset the revision
> +		    // info for the next one.
> +		    comment.setLength(0);
> +		    rev = null;
> +
> +		    parseState = PARSE_REV_START;
> +		    continue;
> +		}
> +		else
> +		{
> +		    // Otherwise it's a comment line.
> +		    comment.append(line);
> +		    comment.append(NEW_LINE);
> +		}
> +		break;
> +	    }
> +	}
> +    }
> +
> +    /**
> +     * Subversion doesn't at present have any pre-edit that needs
> +     * doing as far as I can see.
> +     *
> +     * @param file  file to prepare for editing
> +     */
> +    public void prepareFileForEdit(String file) throws RepositoryException {
> +    }    
> +}
> diff -Naur -x CVS Anthill-urbancode/source/main/profiles/Unix/unix_subversion/ge
> tRevisionsSince.pgl Anthill/source/main/profiles/Unix/unix_subversion/getRevisio
> nsSince.pgl
> --- Anthill-urbancode/source/main/profiles/Unix/unix_subversion/getRevisionsSinc
> e.pgl	1970-01-01 01:00:00.000000000 +0100
> +++ Anthill/source/main/profiles/Unix/unix_subversion/getRevisionsSince.pgl	2004
> -02-25 12:25:45.000000000 +0000
> @@ -0,0 +1,39 @@
> +<%@ import="com.urbancode.anthill.ProjectProperties" %>
> +<%@ import="com.urbancode.anthill.adapter.*" %>
> +<%@ import="com.urbancode.anthill.Anthill" %>
> +<%
> +Anthill anthill = Anthill.getAnthill();
> +
> +ProjectProperties pp = (ProjectProperties)context.get("Properties");
> +SubversionRepositoryAdapter ra = (SubversionRepositoryAdapter)context.get("Adap
> ter");
> +
> +Date date = (Date)context.get("Date");
> +String url = pp.getProperty(SubversionRepositoryAdapter.URL_KEY);
> +String user = pp.getProperty(SubversionRepositoryAdapter.USER_KEY).trim();
> +String password = pp.getProperty(SubversionRepositoryAdapter.PASSWORD_KEY).trim
> ();
> +String pageletDir = anthill.getAnthillRootDir().getAbsolutePath() +
> +                    File.separator + "conf" +
> +                    File.separator + "profiles"+ File.separator + "Unix" +
> +                    File.separator + "unix_subversion" + File.separator;
> +
> +String version = (String)context.get("Version");
> +
> +String authArgs = "";
> +
> +if ( user.length() > 0 )
> +{
> +    authArgs = "--username \"" + user + "\" --password \"" + password + "\"";
> +}
> +
> +String revString = "";
> +
> +if ( version != null && !version.trim().equals("") ) {
> +     revString = "-r " + version;
> +} else if (date != null) {
> +     String dateConstraint = "{" + ra.SUBVERSION_DATE.format(date) + "}:HEAD";
> +     revString = "-r \"" + dateConstraint + "\"";
> +}
> +
> +%>
> +
> +sh <%=pageletDir%>getRevisionsSince.sh <%=authArgs%> <%=revString%> <%=url%>
> diff -Naur -x CVS Anthill-urbancode/source/main/profiles/Unix/unix_subversion/ge
> tRevisionsSince.sh Anthill/source/main/profiles/Unix/unix_subversion/getRevision
> sSince.sh
> --- Anthill-urbancode/source/main/profiles/Unix/unix_subversion/getRevisionsSinc
> e.sh	1970-01-01 01:00:00.000000000 +0100
> +++ Anthill/source/main/profiles/Unix/unix_subversion/getRevisionsSince.sh	2004-
> 02-25 12:25:45.000000000 +0000
> @@ -0,0 +1,4 @@
> +#!/bin/bash
> +echo "Executing: svn log --non-interactive $@"
> +svn log --non-interactive -v "$@"
> +
> diff -Naur -x CVS Anthill-urbancode/source/main/profiles/Unix/unix_subversion/ge
> tWorkingProject.pgl Anthill/source/main/profiles/Unix/unix_subversion/getWorking
> Project.pgl
> --- Anthill-urbancode/source/main/profiles/Unix/unix_subversion/getWorkingProjec
> t.pgl	1970-01-01 01:00:00.000000000 +0100
> +++ Anthill/source/main/profiles/Unix/unix_subversion/getWorkingProject.pgl	2004
> -02-25 12:25:45.000000000 +0000
> @@ -0,0 +1,42 @@
> +<%@ import="com.urbancode.anthill.ProjectProperties" %>
> +<%@ import="com.urbancode.anthill.adapter.*" %>
> +<%@ import="com.urbancode.anthill.Anthill" %>
> +<%
> +Anthill anthill = Anthill.getAnthill();
> +
> +ProjectProperties pp = (ProjectProperties)context.get("Properties");
> +ProfileRepositoryAdapter ra = (ProfileRepositoryAdapter)context.get("Adapter");
> +
> +String url = pp.getProperty(SubversionRepositoryAdapter.URL_KEY);
> +String user = pp.getProperty(SubversionRepositoryAdapter.USER_KEY).trim();
> +String password = pp.getProperty(SubversionRepositoryAdapter.PASSWORD_KEY).trim
> ();
> +String workDirectory = anthill.getAnthillRootDir().getAbsolutePath() +
> +                       File.separator + pp.getProperty(SubversionRepositoryAdap
> ter.WORK_DIR_KEY);
> +String pageletDir = anthill.getAnthillRootDir().getAbsolutePath() +
> +                    File.separator + "conf" +
> +                    File.separator + "profiles"+ File.separator + "Unix" +
> +                    File.separator + "unix_subversion" + File.separator;
> +
> +String version = (String)context.get("Version");
> +
> +String authArgs = "";
> +
> +if ( user.length() > 0 )
> +{
> +    authArgs = "--username \"" + user + "\" --password \"" + password + "\"";
> +}
> +
> +String revString = "";
> +
> +if ( version != null && !version.trim().equals("") ) {
> +     revString = "-r " + version;
> +}
> +
> +File workFile = new File(workDirectory);
> +if (!workFile.exists()) {
> +        workFile.mkdirs();
> +}
> +workDirectory = workFile.getAbsolutePath();
> +%>
> +
> +sh <%=pageletDir%>getWorkingProject.sh <%=authArgs%> <%=revString%> <%=url%> <%
> =workDirectory%>
> diff -Naur -x CVS Anthill-urbancode/source/main/profiles/Unix/unix_subversion/ge
> tWorkingProject.sh Anthill/source/main/profiles/Unix/unix_subversion/getWorkingP
> roject.sh
> --- Anthill-urbancode/source/main/profiles/Unix/unix_subversion/getWorkingProjec
> t.sh	1970-01-01 01:00:00.000000000 +0100
> +++ Anthill/source/main/profiles/Unix/unix_subversion/getWorkingProject.sh	2004-
> 02-25 12:25:45.000000000 +0000
> @@ -0,0 +1,3 @@
> +#!/bin/sh
> +echo "Executing: svn checkout --non-interactive $@"
> +svn checkout --non-interactive "$@"
> diff -Naur -x CVS Anthill-urbancode/source/main/profiles/Unix/unix_subversion/la
> bel.pgl Anthill/source/main/profiles/Unix/unix_subversion/label.pgl
> --- Anthill-urbancode/source/main/profiles/Unix/unix_subversion/label.pgl	1970-0
> 1-01 01:00:00.000000000 +0100
> +++ Anthill/source/main/profiles/Unix/unix_subversion/label.pgl	2004-02-25 12:25
> :45.000000000 +0000
> @@ -0,0 +1,32 @@
> +<%@ import="com.urbancode.anthill.adapter.*" %>
> +<%@ import="com.urbancode.anthill.ProjectProperties" %>
> +<%@ import="com.urbancode.anthill.Anthill" %>
> +<%
> +Anthill anthill = Anthill.getAnthill();
> +
> +ProfileRepositoryAdapter ra = (ProfileRepositoryAdapter)context.get("Adapter");
> +ProjectProperties pp = (ProjectProperties)context.get("Properties");
> +String tag = (String)context.get("Tag");
> +String url = pp.getProperty(SubversionRepositoryAdapter.URL_KEY);
> +String tagUrl = pp.getProperty(SubversionRepositoryAdapter.TAGS_URL_KEY);
> +String user = pp.getProperty(SubversionRepositoryAdapter.USER_KEY).trim();
> +String password = pp.getProperty(SubversionRepositoryAdapter.PASSWORD_KEY).trim
> ();
> +String pageletDir = anthill.getAnthillRootDir().getAbsolutePath() +
> +                    File.separator + "conf" +
> +                    File.separator + "profiles"+ File.separator + "Unix" +
> +                    File.separator + "unix_subversion" + File.separator;
> +
> +if (!tagUrl.endsWith("/"))
> +   tagUrl.concat("/");
> +tagUrl.concat(tag);
> +
> +String authArgs = "";
> +
> +if ( user.length() > 0 )
> +{
> +    authArgs = "--username \"" + user + "\" --password \"" + password + "\"";
> +}
> +
> +%>
> +
> +sh <%=pageletDir%>label.sh <%=authArgs%> <%=url%> <%=tagUrl%>
> diff -Naur -x CVS Anthill-urbancode/source/main/profiles/Unix/unix_subversion/la
> bel.sh Anthill/source/main/profiles/Unix/unix_subversion/label.sh
> --- Anthill-urbancode/source/main/profiles/Unix/unix_subversion/label.sh	1970-01
> -01 01:00:00.000000000 +0100
> +++ Anthill/source/main/profiles/Unix/unix_subversion/label.sh	2004-02-25 12:25:
> 45.000000000 +0000
> @@ -0,0 +1,3 @@
> +#!/bin/bash
> +echo "Executing: svn copy $@"
> +svn copy --non-interactive "$@"
> diff -Naur -x CVS Anthill-urbancode/source/main/profiles/Unix/unix_subversion/po
> stEditPagelet.pgl Anthill/source/main/profiles/Unix/unix_subversion/postEditPage
> let.pgl
> --- Anthill-urbancode/source/main/profiles/Unix/unix_subversion/postEditPagelet.
> pgl	1970-01-01 01:00:00.000000000 +0100
> +++ Anthill/source/main/profiles/Unix/unix_subversion/postEditPagelet.pgl	2004-0
> 2-25 12:25:45.000000000 +0000
> @@ -0,0 +1,32 @@
> +<%@ import="com.urbancode.anthill.adapter.*" %>
> +<%@ import="com.urbancode.anthill.ProjectProperties" %>
> +<%@ import="com.urbancode.anthill.Anthill" %>
> +<%
> +Anthill anthill = Anthill.getAnthill();
> +
> +ProfileRepositoryAdapter ra = (ProfileRepositoryAdapter)context.get("Adapter");
> +ProjectProperties pp = (ProjectProperties)context.get("Properties");
> +String postEditFile = (String)context.get("File");
> +String user = pp.getProperty(SubversionRepositoryAdapter.USER_KEY).trim();
> +String password = pp.getProperty(SubversionRepositoryAdapter.PASSWORD_KEY).trim
> ();
> +String pageletDir = anthill.getAnthillRootDir().getAbsolutePath() +
> +                    File.separator + "conf" +
> +                    File.separator + "profiles"+ File.separator + "Unix" +
> +                    File.separator + "unix_subversion" + File.separator;
> +
> +String workDirectory = anthill.getAnthillRootDir().getAbsolutePath() +
> +                       File.separator + pp.getProperty(SubversionRepositoryAdap
> ter.WORK_DIR_KEY);
> +
> +postEditFile = workDirectory + File.separator + postEditFile;
> +
> +String authArgs = "";
> +
> +if ( user.length() > 0 )
> +{
> +    authArgs = "--username \"" + user + "\" --password \"" + password + "\"";
> +}
> +
> +String msg = "-m \"" + SubversionRepositoryAdapter.BUILD_INCREMENT_COMMENT + "\
> "";
> +
> +%>
> +sh <%=pageletDir%>postEditPagelet.sh <%=authArgs%> <%=msg%> <%=postEditFile%>
> diff -Naur -x CVS Anthill-urbancode/source/main/profiles/Unix/unix_subversion/po
> stEditPagelet.sh Anthill/source/main/profiles/Unix/unix_subversion/postEditPagel
> et.sh
> --- Anthill-urbancode/source/main/profiles/Unix/unix_subversion/postEditPagelet.
> sh	1970-01-01 01:00:00.000000000 +0100
> +++ Anthill/source/main/profiles/Unix/unix_subversion/postEditPagelet.sh	2004-02
> -25 12:25:45.000000000 +0000
> @@ -0,0 +1,3 @@
> +#!/bin/bash
> +echo "Executing: svn $@"
> +svn commit --non-interactive "$@"
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Anthill mailing list
> Anthill at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill

-- 
Matthew Avery
Senior Developer
(513) 470-5316
http://www.einnovation.com/




More information about the Anthill mailing list