Package com.aragost.javahg.internals

Source Code of com.aragost.javahg.internals.PhaseLogCommand

package com.aragost.javahg.internals;

import java.io.IOException;
import java.util.Map;

import com.aragost.javahg.Changeset;
import com.aragost.javahg.Phase;
import com.aragost.javahg.Repository;
import com.aragost.javahg.commands.LogCommand;
import com.google.common.collect.Maps;

/**
* Log command for reading phases
*/
public class PhaseLogCommand extends LogCommand {

    public PhaseLogCommand(Repository repository) {
        super(repository, "{node} {phase}\0");
    }

    public Map<Changeset, Phase> execute() {
        Repository repo = getRepository();
        Map<Changeset, Phase> result = Maps.newHashMap();
        HgInputStream stream = launchStream();
        try {
            while (!stream.isEof()) {
                String node = stream.textUpTo(' ');
                String phaseName = stream.textUpTo(0);
                Phase phase = Phase.fromText(phaseName);
                result.put(repo.changeset(node), phase);
            }
        } catch (IOException e) {
            throw new RuntimeIOException(e);
        }
        return result;
    }

}
TOP

Related Classes of com.aragost.javahg.internals.PhaseLogCommand

TOP
Copyright © 2018 www.massapi.com. 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.