~ubuntu-branches/ubuntu/oneiric/ivy/oneiric

« back to all changes in this revision

Viewing changes to src/java/org/apache/ivy/core/module/id/ModuleRevisionId.java

  • Committer: Bazaar Package Importer
  • Author(s): Miguel Landaeta
  • Date: 2011-02-06 20:56:32 UTC
  • mfrom: (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110206205632-sqhg7bx09z0ywj79
Tags: 2.2.0-1
* New upstream release.
* Update pom.xml to the latest version.
* Add Build-Depends and Suggests on libbcprov-java and libbcpg-java.
* Add mh_clean call in clean target.
* Bump Standards-Version to 3.9.1. No changes were required.
* Add myself to Uploaders.

Show diffs side-by-side

added added

removed removed

Lines of Context:
210
210
            // just to get the default branch
211
211
            ? (context.peekIvy() == null ? null : context.getSettings().getDefaultBranch(moduleId)) 
212
212
            : branch;
213
 
        this.revision = revision == null ? Ivy.getWorkingRevision() : revision;
 
213
        this.revision = revision == null ? Ivy.getWorkingRevision() : normalizeRevision(revision);
214
214
        setStandardAttribute(IvyPatternHelper.ORGANISATION_KEY, this.moduleId.getOrganisation());
215
215
        setStandardAttribute(IvyPatternHelper.MODULE_KEY, this.moduleId.getName());
216
216
        setStandardAttribute(IvyPatternHelper.BRANCH_KEY, this.branch);
274
274
 
275
275
    public String encodeToString() {
276
276
        StringBuffer buf = new StringBuffer();
277
 
        Map attributes = getAttributes();
 
277
        Map attributes = new HashMap(getAttributes());
 
278
        attributes.keySet().removeAll(getExtraAttributes().keySet());
 
279
        attributes.putAll(getQualifiedExtraAttributes());
 
280
 
278
281
        for (Iterator iter = attributes.keySet().iterator(); iter.hasNext();) {
279
282
            String attName = (String) iter.next();
280
283
            String value = (String) attributes.get(attName);
334
337
    public String getBranch() {
335
338
        return branch;
336
339
    }
 
340
    
 
341
    /**
 
342
     * [revision] is a valid revision in maven. This method strips the '[' and ']'
 
343
     * characters. Cfr. http://docs.codehaus.org/x/IGU
 
344
     */
 
345
    private static String normalizeRevision(String revision) {
 
346
        if (revision.startsWith("[") && revision.endsWith("]") && revision.indexOf(',') == -1) {
 
347
            if (IvyPatternHelper.getTokenString(IvyPatternHelper.REVISION_KEY).equals(revision)) {
 
348
                // this is the case when listing dynamic revions
 
349
                return revision;
 
350
            }
 
351
            
 
352
            return revision.substring(1, revision.length() - 1);
 
353
        } else {
 
354
            return revision;
 
355
        }
 
356
    }
337
357
}