Package net.sourceforge.cruisecontrol

Examples of net.sourceforge.cruisecontrol.Modification


                //Folders don't seem to always have a checked-in time, so
                //fake one.
                line = "0" + line;
            }
           
            Modification m = parseModificationDescription(line);
            mods.add(m);
        }
        return mods;
    }
View Full Code Here


    /**
     * Turns a string, most likely provided from the AlienBrain command-line
     * client, into a Modification.
     */
    protected static Modification parseModificationDescription(String description) {
        Modification m = new Modification("AlienBrain");
       
        StringTokenizer st = new StringTokenizer(description, "|");
       
        m.modifiedTime = AlienBrain.filetimeToDate(Long.parseLong(st.nextToken()));
        m.createModifiedFile(st.nextToken(), null);
        m.userName = st.nextToken();
        while (st.hasMoreTokens()) {
            m.comment += st.nextToken();
        }
               
View Full Code Here

            }
        }

        if (propertyOnDelete != null) {
            for (int i = 0; i < modifications.size(); i++) {
                Modification modification = (Modification) modifications.get(i);
                Modification.ModifiedFile file = (Modification.ModifiedFile) modification.files.get(0);
                if (file.action.equals("deleted")) {
                    properties.put(propertyOnDelete, "true");
                    break;
                }
View Full Code Here

            Element logEntryPaths = logEntry.getChild("paths");
            List paths = logEntryPaths.getChildren("path");
            for (Iterator iterator = paths.iterator(); iterator.hasNext();) {
                Element path = (Element) iterator.next();

                Modification modification = new Modification("svn");

                modification.modifiedTime = convertDate(logEntry.getChildText("date"));
                modification.userName = logEntry.getChildText("author");
                modification.comment = logEntry.getChildText("msg");
                modification.revision = logEntry.getAttributeValue("revision");

                Modification.ModifiedFile modfile = modification.createModifiedFile(path.getText(), null);
                modfile.action = convertAction(path.getAttributeValue("action"));
                modfile.revision = modification.revision;

                modifications.add(modification);
            }
View Full Code Here

         * @see <a href="http://subversion.tigris.org/">subversion.tigris.org</a>
         */
        static List filterModifications(Modification[] modifications, Date lastBuild) {
            List filtered = new ArrayList();
            for (int i = 0; i < modifications.length; i++) {
                Modification modification = modifications[i];
                if (modification.modifiedTime.getTime() > lastBuild.getTime()) {
                    filtered.add(modification);
                }
            }
            return filtered;
View Full Code Here

        int day2 = calendar.get(Calendar.DAY_OF_MONTH);
        return day1 == day2;
    }

    private Modification getMod(Date now) {
        Modification mod = new Modification("always");
        Modification.ModifiedFile modfile = mod.createModifiedFile("time build", "time build");
        modfile.action = "change";
        mod.userName = getUserName();
        Calendar nowTimeBuild = Calendar.getInstance();
        nowTimeBuild.setTime(now);
        final int modifHour = this.time / 100;
View Full Code Here

        if ((user != null) && (user.getName().equals("BuildMaster"))) {
            return;
        }

        Modification mod = new Modification();
        mod.type = "StarTeam";
        String fileName = revision.getName();
        String folderName = revision.getParentFolder().getFolderHierarchy();
        Modification.ModifiedFile modFile = mod.createModifiedFile(fileName, folderName);
        modFile.action = status;
        mod.modifiedTime = revision.getModifiedTime().createDate();
        mod.userName = user.getName();
        mod.comment = revision.getComment();
View Full Code Here

   * @return true at the end
   * @throws IOException
   */
  public boolean parseStream(InputStream input) throws IOException, CruiseControlException {
    modifications = new ArrayList();
    Modification modification = null;
    BufferedReader reader = new BufferedReader(new InputStreamReader(input));
    while (true) {
      String line = reader.readLine();
      if (line == null) {
        break;
      }
      LOG.debug(line);
      if (line.startsWith("transaction")) {
        // transaction <id>; <verb>; YYYY/MM/DD hh:mm:ss ; user: <user>
        modification = new Modification();
        String[] parts = line.split(";");
        modification.comment = "";
        modification.revision = parts[0].substring(parts[0].indexOf(' ') + 1);
        modification.type = parts[1].trim();
        modification.modifiedTime = DateTimespec.parse(parts[2].trim());
        modification.userName = parts[3].substring(6).trim();
        modifications.add(modification);
      } else if (line.startsWith("  #")) {
        // # Comment
        if (modification != null) {
          modification.comment += line.substring(3) + "\n";
        } else {
          LOG.warn("Comment outside modification - skipping");
        }
        // Accurev is returning always \\ instead of File.separatorChar
      } else if (line.startsWith("  \\.\\") || line.startsWith("  /./")) {
        // ...but just for the sake of paranoia...
        final char separator = line.charAt(2);
        final int lastSlash = line.lastIndexOf(separator);
        int lastSpace = line.lastIndexOf(' ');
        lastSpace = line.lastIndexOf(' ', lastSpace - 1);
        if (lastSpace > lastSlash) {
          String fileName = line.substring(lastSlash + 1, lastSpace);
          String folderName = ((lastSlash > 5) ? line.substring(5, lastSlash) : line.substring(5)).replace(
              separator, '/');
          Modification.ModifiedFile modfile = modification.createModifiedFile(fileName, folderName);
          modfile.action = "change";
        }
      }
    }
    return true;
View Full Code Here

                s = br.readLine();
                while (s != null && !s.equals("")) {
                    entry.add(s);
                    s = br.readLine();
                }
                Modification mod = handleEntry(entry);
                if (mod != null) {
                    modifications.add(mod);
                }

                if ("".equals(s)) {
View Full Code Here

     *  Parse individual VSS history entry
     *
     *@param  historyEntry
     */
    protected Modification handleEntry(List historyEntry) {
        Modification mod = new Modification("vss");
        String nameAndDateLine = (String) historyEntry.get(2);
        mod.userName = parseUser(nameAndDateLine);
        mod.modifiedTime = parseDate(nameAndDateLine);

        String folderLine = (String) historyEntry.get(0);
        String fileLine = (String) historyEntry.get(3);

        if (!isInSsDir(folderLine)) {
            // We are only interested in modifications to files in the specified ssdir
            return null;
        } else if (isBeforeLastBuild(mod.modifiedTime)) {
            // We are only interested in modifications since the last build
            return null;
        } else if (fileLine.startsWith("Labeled")) {
            // We don't add labels.
            return null;
        } else if (fileLine.startsWith("Checked in")) {

            String fileName = substringFromLastSlash(folderLine);
            String folderName = substringToLastSlash(folderLine);
            Modification.ModifiedFile modfile = mod.createModifiedFile(fileName, folderName);

            modfile.action = "checkin";
            mod.comment = parseComment(historyEntry);
        } else if (fileLine.indexOf(" renamed to ") > -1) {
            // TODO: This is a special case that is really two modifications: deleted and recovered.
            //       For now I'll consider it a deleted to force a clean build.
            //       I should really make this two modifications.
            mod.comment = parseComment(historyEntry);

            String fileName = fileLine.substring(0, fileLine.indexOf(" "));
            String folderName = folderLine;

            Modification.ModifiedFile modfile = mod.createModifiedFile(fileName, folderName);
            modfile.action = "delete";

        } else if (fileLine.indexOf(" moved to ") > -1) {
            // TODO: This is a special case that is really two modifications: deleted and recovered.
            //       For now I'll consider it a deleted to force a clean build.
            //       I should really make this two modifications.
            mod.comment = parseComment(historyEntry);
            String fileName = fileLine.substring(0, fileLine.indexOf(" "));
            String folderName = folderLine;

            Modification.ModifiedFile modfile = mod.createModifiedFile(fileName, folderName);
            modfile.action = "delete";

        } else {
            String folderName = folderLine;
            String fileName = fileLine.substring(0, fileLine.lastIndexOf(" "));
            Modification.ModifiedFile modfile = mod.createModifiedFile(fileName, folderName);

            mod.comment = parseComment(historyEntry);

            if (fileLine.endsWith("added")) {
                modfile.action = "add";
View Full Code Here

TOP

Related Classes of net.sourceforge.cruisecontrol.Modification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.