Package com.aragost.javahg.internals

Examples of com.aragost.javahg.internals.HgInputStream


     *
     * @return old branch name
     * @throws IOException
     */
    public String clean() throws IOException {
        HgInputStream stream = launchStream("--clean");
        stream.mustMatch(CLEAN_PREFIX);
        String oldName = stream.textUpTo('\n');
        stream.consumeAll();
        return oldName;
    }
View Full Code Here


     *
     * @return all bookmarks
     */
    public List<Bookmark> list() {
        Repository repo = getRepository();
        HgInputStream stream = launchStream();
        try {
            if (stream.match(NO_BOOKMARKS)) {
                stream.consumeAll();
                return Collections.emptyList();
            }
            List<Bookmark> result = Lists.newArrayList();
            while (stream.peek() != -1) {
                stream.mustMatch(' ');
                boolean active = stream.read() == '*';
                stream.mustMatch(' ');
                String name = stream.textUpTo(' ');
                stream.upTo(':');
                String node = stream.textUpTo('\n');
                Bookmark bookmark = new Bookmark(repo.changeset(node), name, active);
                result.add(bookmark);
            }
            return result;
        } catch (IOException e) {
View Full Code Here

    public Bundle execute(String src) {
        if (this.bundleFile == null) {
            this.bundleFile = Utils.createTempFile(".bundle");
            cmdAppend("--bundle", this.bundleFile.getPath());
        }
        HgInputStream stream = launchStream(src);
        Bundle bundle = new Bundle(getRepository().getBaseRepository(), this.bundleFile, true);
        List<Changeset> changesets = Changeset.readListFromStream(bundle.getOverlayRepository(), stream);
        if (changesets.isEmpty()) {
            bundle.close();
            return null;
View Full Code Here

     */
    public List<Changeset> execute(String... files) {
        if (stylePath != null) {
            cmdAppend("--style", stylePath);
        }
        HgInputStream stream = launchStream(files);
        return Changeset.readListFromStream(getRepository(), stream, eager);
    }
View Full Code Here

     * This correspond to the --list option for resolve.
     *
     * @return List we status of merge files
     */
    public List<ResolveStatusLine> list() {
        HgInputStream stream = launchStream("--list");
        List<ResolveStatusLine> result = Lists.newArrayList();
        try {
            while (stream.peek() != -1) {
                result.add(ResolveStatusLine.fromStream(stream));
            }
        } catch (IOException e) {
            throw new RuntimeIOException(e);
        }
View Full Code Here

     */
    public List<AnnotateLine> execute(String file) throws IOException {
        Repository repo = getRepository();
        List<Integer> revisions = Lists.newArrayList();
        List<String> lines = Lists.newArrayList();
        HgInputStream stream = launchStream(file);
        while (stream.peek() != -1) {
            revisions.add(stream.revisionUpTo(':'));
            stream.skip(1);
            lines.add(stream.textUpTo('\n'));
        }
        Map<Integer, Changeset> revNumMap = createRevNumMap(repo, revisions);
        int size = lines.size();
        List<AnnotateLine> result = Lists.newArrayListWithCapacity(size);
        for (int i = 0 ; i < size; i ++) {
View Full Code Here

     *            an optional list of files to retrieve the log for.
     *            With no files, all changesets are considered.
     * @return the log as a list of changesets
     */
    public List<Changeset> execute(String... files) {
        HgInputStream stream = launchStream(files);
        return Changeset.readListFromStream(getRepository(), stream);
    }
View Full Code Here

     * @return Map mapping a {@link Changeset} to a {@link Phase}
     */
    public Map<Changeset, Phase> phases(String... revs) {
        GenericLogCommand cmd = new GenericLogCommand(this).template("{node} {phase}\\0");
        cmd.rev(revs);
        HgInputStream stream = cmd.stream();
        Map<Changeset, Phase> result = Maps.newHashMap();
        try {
            while (!stream.isEof()) {
                String node = stream.textUpTo(' ');
                String phaseName = stream.textUpTo('\0');
                Phase phase = Phase.fromText(phaseName);
                result.put(changeset(node), phase);
            }
        } catch (IOException e) {
            throw new RuntimeIOException(e);
View Full Code Here

     * Return tags that is pointing the this changeset
     */
    public List<String> tags() {
        GenericLogCommand cmd = new GenericLogCommand(getRepository()).style("tags");
        cmd.rev(getNode());
        HgInputStream stream = cmd.stream();
        List<String> result = Lists.newArrayList();
        try {
            while (!stream.isEof()) {
                String tag = stream.textUpTo(0);
                if (!"tip".equals(tag)) {
                    result.add(tag);
                }
            }
        } catch (IOException e) {
View Full Code Here

     * @return Map mapping a {@link Changeset} to a {@link Phase}
     */
    public Map<Changeset, Phase> phases(String... revs) {
        GenericLogCommand cmd = new GenericLogCommand(this).template("{node} {phase}\\0");
        cmd.rev(revs);
        HgInputStream stream = cmd.stream();
        Map<Changeset, Phase> result = Maps.newHashMap();
        try {
            while (!stream.isEof()) {
                String node = stream.textUpTo(' ');
                String phaseName = stream.textUpTo('\0');
                Phase phase = Phase.fromText(phaseName);
                result.put(changeset(node), phase);
            }
        } catch (IOException e) {
            throw new RuntimeIOException(e);
View Full Code Here

TOP

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

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.