mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
return a property for closed branches
This commit is contained in:
@@ -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<Integer> loadRevisionsFromStream(HgInputStream stream)
|
||||
{
|
||||
List<Integer> 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<Changeset> readListFromStream(HgInputStream in)
|
||||
{
|
||||
List<Changeset> 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<Integer> loadRevisionsFromStream(HgInputStream stream)
|
||||
{
|
||||
List<Integer> 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<Changeset> readListFromStream(HgInputStream in)
|
||||
{
|
||||
List<Changeset> 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 ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user