buildframework/helium/sf/java/scm/src/com/nokia/helium/scm/ant/types/LatestTag.java
equal
deleted
inserted
replaced
65 /** |
65 /** |
66 * {@inheritDoc} |
66 * {@inheritDoc} |
67 */ |
67 */ |
68 @Override |
68 @Override |
69 public String getName() { |
69 public String getName() { |
70 if (pattern == null) |
70 if (pattern == null) { |
71 throw new BuildException("'pattern' attribute has not been defined."); |
71 throw new BuildException("'pattern' attribute has not been defined."); |
|
72 } |
72 |
73 |
73 List<Tag> tags = getCleanedList(); |
74 List<Tag> tags = getCleanedList(); |
74 Collections.sort(tags, new TagComparator<Tag>(getPattern())); |
75 Collections.sort(tags, new TagComparator<Tag>(getPattern())); |
75 |
76 |
76 if (tags.isEmpty()) |
77 if (tags.isEmpty()) { |
77 throw new BuildException("No tag found."); |
78 throw new BuildException("No tag found."); |
|
79 } |
78 |
80 |
79 getProject().log("Latest tag: " + tags.get(0).getName()); |
81 getProject().log("Latest tag: " + tags.get(0).getName()); |
80 return tags.get(0).getName(); |
82 return tags.get(0).getName(); |
81 } |
83 } |
82 |
84 |
160 */ |
162 */ |
161 @Override |
163 @Override |
162 public int compare(T o1, T o2) { |
164 public int compare(T o1, T o2) { |
163 getProject().log("Comparing: " + o1.getName() + ">" + o2.getName(), Project.MSG_DEBUG); |
165 getProject().log("Comparing: " + o1.getName() + ">" + o2.getName(), Project.MSG_DEBUG); |
164 |
166 |
165 if (o1.getName().equals(o2.getName())) |
167 if (o1.getName().equals(o2.getName())) { |
166 return 0; |
168 return 0; |
|
169 } |
167 Matcher m1 = pVer.matcher(o1.getName()); |
170 Matcher m1 = pVer.matcher(o1.getName()); |
168 Matcher m2 = pVer.matcher(o2.getName()); |
171 Matcher m2 = pVer.matcher(o2.getName()); |
169 m1.matches(); |
172 m1.matches(); |
170 m2.matches(); |
173 m2.matches(); |
171 int max = (m1.groupCount() > m2.groupCount()) ? m2.groupCount() : m1.groupCount(); |
174 int max = (m1.groupCount() > m2.groupCount()) ? m2.groupCount() : m1.groupCount(); |