diff --git a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/javahg/AbstractChangesetCommand.java b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/javahg/AbstractChangesetCommand.java index b3e3c2f3a9..b7aa64b801 100644 --- a/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/javahg/AbstractChangesetCommand.java +++ b/scm-plugins/scm-hg-plugin/src/main/java/sonia/scm/repository/spi/javahg/AbstractChangesetCommand.java @@ -30,6 +30,7 @@ */ + package sonia.scm.repository.spi.javahg; //~--- non-JDK imports -------------------------------------------------------- @@ -87,6 +88,9 @@ public abstract class AbstractChangesetCommand extends AbstractCommand private static final String NULL_ID = "0000000000000000000000000000000000000000"; + /** changeset property for closed branch */ + private static final String PROPERTY_CLOSE = "hg.close"; + /** changeset property for parent1 revision */ private static final String PROPERTY_PARENT1_REVISION = "hg.p1.rev"; @@ -114,12 +118,80 @@ public abstract class AbstractChangesetCommand extends AbstractCommand //~--- methods -------------------------------------------------------------- + /** + * Method description + * + * + * @param stream + * + * @return + */ + protected List loadRevisionsFromStream(HgInputStream stream) + { + List revisions = Lists.newArrayList(); - //~--- get methods ---------------------------------------------------------- + try + { + while (stream.peek() != -1) + { + int rev = stream.revisionUpTo(' '); + if (rev >= 0) + { + revisions.add(rev); + } + } + } + catch (IOException ex) + { + throw new RuntimeIOException(ex); + } - //~--- methods -------------------------------------------------------------- + return revisions; + } + + /** + * Method description + * + * + * @param in + * + * @return + */ + protected List readListFromStream(HgInputStream in) + { + List changesets = Lists.newArrayList(); + + try + { + boolean found = in.find(CHANGESET_PATTERN); + + if (found) + { + while (!in.match(CHANGESET_PATTERN)) + { + + Changeset cset = createFromInputStream(in); + + if (cset != null) + { + changesets.add(cset); + } + } + + Utils.consumeAll(in); + } + + // If the pattern is not found there is no changsets + } + catch (IOException e) + { + throw new RuntimeIOException(e); + } + + return changesets; + } /** * Method description @@ -168,7 +240,16 @@ public abstract class AbstractChangesetCommand extends AbstractCommand changeset.getParents().add(p2); } - in.mustMatch(' '); // skip space part of {parents} + // skip space part of {parents} + in.mustMatch(' '); + + // read extras + String extraLine = in.textUpTo('\n'); + + if (extraLine.contains("close=1")) + { + changeset.getProperties().put(PROPERTY_CLOSE, "true"); + } Modifications modifications = changeset.getModifications(); @@ -204,39 +285,6 @@ public abstract class AbstractChangesetCommand extends AbstractCommand return changeset; } - /** - * Method description - * - * - * @param stream - * - * @return - */ - protected List loadRevisionsFromStream(HgInputStream stream) - { - List revisions = Lists.newArrayList(); - - try - { - while (stream.peek() != -1) - { - int rev = stream.revisionUpTo(' '); - - if (rev >= 0) - { - revisions.add(rev); - } - } - - } - catch (IOException ex) - { - throw new RuntimeIOException(ex); - } - - return revisions; - } - /** * Method description * @@ -268,48 +316,6 @@ public abstract class AbstractChangesetCommand extends AbstractCommand return in.nextAsText(40); } - /** - * Method description - * - * - * @param in - * - * @return - */ - protected List readListFromStream(HgInputStream in) - { - List changesets = Lists.newArrayList(); - - try - { - boolean found = in.find(CHANGESET_PATTERN); - - if (found) - { - while (!in.match(CHANGESET_PATTERN)) - { - - Changeset cset = createFromInputStream(in); - - if (cset != null) - { - changesets.add(cset); - } - } - - Utils.consumeAll(in); - } - - // If the pattern is not found there is no changsets - } - catch (IOException e) - { - throw new RuntimeIOException(e); - } - - return changesets; - } - //~--- get methods ---------------------------------------------------------- /** diff --git a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/styles/changesets-eager.style b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/styles/changesets-eager.style index 93b0b04e27..5c462fc459 100644 --- a/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/styles/changesets-eager.style +++ b/scm-plugins/scm-hg-plugin/src/main/resources/sonia/scm/styles/changesets-eager.style @@ -1,5 +1,5 @@ header = "%{pattern}" -changeset = "{rev}:{node}{author}\n{date|hgdate}\n{branch}\n{parents}{tags}{file_adds}{file_mods}{file_dels}\n{desc}\0" +changeset = "{rev}:{node}{author}\n{date|hgdate}\n{branch}\n{parents}{join(extras,',')}\n{tags}{file_adds}{file_mods}{file_dels}\n{desc}\0" tag = "t {tag}\n" file_add = "a {file_add}\n" file_mod = "m {file_mod}\n"