improve changeset viewer

This commit is contained in:
Sebastian Sdorra
2011-04-18 18:01:40 +02:00
parent 270b9cfeaa
commit 2c209e4161
2 changed files with 3 additions and 45 deletions

View File

@@ -164,30 +164,17 @@ public class GitChangesetViewer implements ChangesetViewer
switch (entry.getChangeType()) switch (entry.getChangeType())
{ {
case ADD : case ADD :
if (modifications.getAdded() == null)
{
modifications.setAdded(new ArrayList<String>());
}
modifications.getAdded().add(entry.getNewPath()); modifications.getAdded().add(entry.getNewPath());
break; break;
case MODIFY : case MODIFY :
if (modifications.getModified() == null)
{
modifications.setModified(new ArrayList<String>());
}
modifications.getModified().add(entry.getNewPath()); modifications.getModified().add(entry.getNewPath());
break; break;
case DELETE : case DELETE :
if (modifications.getRemoved() == null)
{
modifications.setRemoved(new ArrayList<String>());
}
modifications.getRemoved().add(entry.getOldPath()); modifications.getRemoved().add(entry.getOldPath());
@@ -239,14 +226,6 @@ public class GitChangesetViewer implements ChangesetViewer
if (tag != null) if (tag != null)
{ {
List<String> tagList = changeset.getTags();
if (tagList == null)
{
tagList = new ArrayList<String>();
changeset.setTags(tagList);
}
changeset.getTags().add(tag); changeset.getTags().add(tag);
} }

View File

@@ -176,15 +176,15 @@ public class HgChangesetParser
} }
else if ("files-added".equals(name)) else if ("files-added".equals(name))
{ {
getModifications(changeset).setAdded(getList(value)); changeset.getModifications().setAdded(getList(value));
} }
else if ("files-mods".equals(name)) else if ("files-mods".equals(name))
{ {
getModifications(changeset).setModified(getList(value)); changeset.getModifications().setModified(getList(value));
} }
else if ("files-dels".equals(name)) else if ("files-dels".equals(name))
{ {
getModifications(changeset).setRemoved(getList(value)); changeset.getModifications().setRemoved(getList(value));
} }
} }
} }
@@ -230,27 +230,6 @@ public class HgChangesetParser
return Arrays.asList(value.split(" ")); return Arrays.asList(value.split(" "));
} }
/**
* Method description
*
*
* @param changeset
*
* @return
*/
private Modifications getModifications(Changeset changeset)
{
Modifications mods = changeset.getModifications();
if (mods == null)
{
mods = new Modifications();
changeset.setModifications(mods);
}
return mods;
}
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */ /** Field description */