587
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
package com.nokia.maven.scm.provider.hg.command.tags;
|
|
19 |
|
628
|
20 |
import java.util.Enumeration;
|
|
21 |
import java.util.Hashtable;
|
|
22 |
|
587
|
23 |
import org.apache.maven.scm.ScmFileStatus;
|
|
24 |
import org.apache.maven.scm.ScmRevision;
|
|
25 |
import org.apache.maven.scm.ScmTag;
|
628
|
26 |
import org.apache.maven.scm.log.ScmLogger;
|
|
27 |
import org.apache.maven.scm.provider.hg.command.HgConsumer;
|
587
|
28 |
|
|
29 |
/**
|
|
30 |
*/
|
|
31 |
public class HgTagsConsumer
|
|
32 |
extends HgConsumer
|
|
33 |
{
|
|
34 |
|
|
35 |
private Hashtable<ScmTag, ScmRevision> tagMapping = new Hashtable<ScmTag, ScmRevision>();
|
|
36 |
|
|
37 |
public HgTagsConsumer( ScmLogger logger )
|
|
38 |
{
|
|
39 |
super( logger );
|
|
40 |
}
|
|
41 |
|
|
42 |
/** {@inheritDoc} */
|
|
43 |
public void doConsume( ScmFileStatus status, String trimmedLine )
|
|
44 |
{
|
|
45 |
String[] tagging = trimmedLine.split("\\s+");
|
|
46 |
if (tagging.length == 2) {
|
|
47 |
tagMapping.put(new ScmTag( tagging[0] ), new ScmRevision( tagging[1] ));
|
|
48 |
}
|
|
49 |
}
|
|
50 |
|
|
51 |
public Enumeration<ScmTag> getTags()
|
|
52 |
{
|
|
53 |
return tagMapping.keys();
|
|
54 |
}
|
|
55 |
|
|
56 |
public Hashtable<ScmTag, ScmRevision> getMapping()
|
|
57 |
{
|
|
58 |
return tagMapping;
|
|
59 |
}
|
|
60 |
}
|