Package com.aragost.javahg.internals

Examples of com.aragost.javahg.internals.HgInputStream


     * @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()) {
              // $ hg log --debug --template "{node} {phase}" --rev 5b80e11a7c32121b5fd926b06056bb773eff050f
              // removing unknown node dd8c766936b9 from 1-phase boundary
              // 5b80e11a7c32121b5fd926b06056bb773eff050f draft
              // Observed with at least Mercurial Distributed SCM (version 2.3+10-9d9d15928521)
              String node = stream.textUpTo(' ');

              while ("removing".equals(node) && stream.find('\n')) {
                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);
        } finally {
          try {
        stream.consumeAll();
      } catch (IOException e) {
        throw new RuntimeIOException(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

     * 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) {
            throw new RuntimeIOException(e);
        } finally {
          try {
        stream.consumeAll();
      } catch (IOException e) {
        throw new RuntimeIOException(e);
      }
        }
        return result;
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.