public static void main()

in src/main/java/org/apache/openejb/tools/release/cmd/CommitsPerDay.java [38:81]


    public static void main(final String... args) throws Exception {

        final String tag = "http://svn.apache.org/repos/asf/openejb/";

        final String start = "2007-01-01";

        final InputStream in = Exec.read("svn", "log", "--xml", "-rHEAD:{" + start + "}", tag);

        final JAXBContext context = JAXBContext.newInstance(Commit.Log.class);
        final Unmarshaller unmarshaller = context.createUnmarshaller();

        final Commit.Log log = (Commit.Log) unmarshaller.unmarshal(in);

        ObjectList<Commit> commits = log.getCommits();
        commits = commits.ascending("revision");

        final Date end = new Date();

        Date date = new SimpleDateFormat("yyyy-MM-dd").parse(start);

        final ListIterator<Commit> iterator = commits.listIterator();

        while (lesser(date, end)) {

            int c = 0;

            final Date next = increment(date);

            while (iterator.hasNext()) {
                final Commit commit = iterator.next();
                if (lesser(commit.getDate(), next)) {
                    c++;
                } else {
                    iterator.previous();
                    break;
                }
            }

            System.out.print(c + ", ");

            date = next;
        }

    }