Mercurial > jhg
changeset 344:168f1994de7e
Distinguish active from removed tags
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Tue, 22 Nov 2011 02:57:14 +0100 |
parents | 58016b1b8554 |
children | 58725dd511b3 |
files | src/org/tmatesoft/hg/repo/HgTags.java |
diffstat | 1 files changed, 32 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/repo/HgTags.java Sat Nov 19 01:07:27 2011 +0100 +++ b/src/org/tmatesoft/hg/repo/HgTags.java Tue Nov 22 02:57:14 2011 +0100 @@ -184,7 +184,18 @@ return rv; } + /** + * @deprecated use {@link #getAllTags()} instead + */ + @Deprecated public Map<String, TagInfo> getTags() { + return getAllTags(); + } + + /** + * All tag entries from the repository, for both active and removed tags + */ + public Map<String, TagInfo> getAllTags() { if (tags == null) { tags = new TreeMap<String, TagInfo>(); for (String t : globalFromName.keySet()) { @@ -197,6 +208,19 @@ } return tags; } + + /** + * Tags that are in use in the repository, unlike {@link #getAllTags()} doesn't list removed tags. + */ + public Map<String, TagInfo> getActiveTags() { + TreeMap<String, TagInfo> rv = new TreeMap<String, TagInfo>(); + for (Map.Entry<String, TagInfo> e : getAllTags().entrySet()) { + if (!e.getValue().isRemoved()) { + rv.put(e.getKey(), e.getValue()); + } + } + return rv; + } public final class TagInfo { @@ -204,7 +228,7 @@ private String branch; TagInfo(String tagName) { - this.name = tagName; + name = tagName; } public String name() { return name; @@ -227,5 +251,12 @@ } return globalFromName.get(name).get(0); } + + /** + * @return <code>true</code> if this tag entry describes tag removal + */ + public boolean isRemoved() { + return revision().isNull(); + } } }