package hudson.plugins.git;

import hudson.scm.ChangeLogSet;
import hudson.model.AbstractBuild;

import java.util.List;
import java.util.Collections;
import java.util.Iterator;

/**
 * List of changeset that went into a particular build.
 * @author Nigel Magnay
 */
public class GitChangeSetList extends ChangeLogSet<GitChangeSet> {
    private final List<GitChangeSet> changeSets;

    /*package*/ GitChangeSetList(AbstractBuild build, List<GitChangeSet> logs) {
        super(build);
        Collections.reverse(logs);  // put new things first
        this.changeSets = Collections.unmodifiableList(logs);
        for (GitChangeSet log : logs)
            log.setParent(this);
    }

    public boolean isEmptySet() {
        return changeSets.isEmpty();
    }

    public Iterator<GitChangeSet> iterator() {
        return changeSets.iterator();
    }

    public List<GitChangeSet> getLogs() {
        return changeSets;
    }
}

@@ -171,16 +171,92 @@
 rator;%0A%0A
+import org.kohsuke.stapler.*;%0Aimport org.kohsuke.stapler.export.Exported;%0A%0A%0A
 /**%0A * L
@@ -1000,10 +1000,84 @@
 ;%0A    %7D%0A
+%0A    @Exported%0A    public String getKind() %7B%0A        return %22git%22;%0A    %7D%0A%0A
 %7D%0A

set changeSet.kind to "git"