1 | /*
|
---|
2 | * Copyright 2002,2004 The Apache Software Foundation
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | *
|
---|
16 | */
|
---|
17 | package org.apache.tools.ant.taskdefs.cvslib;
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * Holds the information of a line of rdiff
|
---|
21 | */
|
---|
22 | class CvsTagEntry {
|
---|
23 | String m_filename;
|
---|
24 | String m_prevRevision;
|
---|
25 | String m_revision;
|
---|
26 |
|
---|
27 | public CvsTagEntry(String filename) {
|
---|
28 | this(filename, null, null);
|
---|
29 | }
|
---|
30 |
|
---|
31 | public CvsTagEntry(String filename, String revision) {
|
---|
32 | this(filename, revision, null);
|
---|
33 | }
|
---|
34 |
|
---|
35 | public CvsTagEntry(String filename, String revision,
|
---|
36 | String prevRevision) {
|
---|
37 | m_filename = filename;
|
---|
38 | m_revision = revision;
|
---|
39 | m_prevRevision = prevRevision;
|
---|
40 | }
|
---|
41 |
|
---|
42 | public String getFile() {
|
---|
43 | return m_filename;
|
---|
44 | }
|
---|
45 |
|
---|
46 | public String getRevision() {
|
---|
47 | return m_revision;
|
---|
48 | }
|
---|
49 |
|
---|
50 | public String getPreviousRevision() {
|
---|
51 | return m_prevRevision;
|
---|
52 | }
|
---|
53 |
|
---|
54 | public String toString() {
|
---|
55 | StringBuffer buffer = new StringBuffer();
|
---|
56 | buffer.append(m_filename);
|
---|
57 | if ((m_revision == null)) {
|
---|
58 | buffer.append(" was removed");
|
---|
59 | if(m_prevRevision != null) {
|
---|
60 | buffer.append("; previous revision was ").append(m_prevRevision);
|
---|
61 | }
|
---|
62 | } else if (m_revision != null && m_prevRevision == null) {
|
---|
63 | buffer.append(" is new; current revision is ")
|
---|
64 | .append(m_revision);
|
---|
65 | } else if (m_revision != null && m_prevRevision != null) {
|
---|
66 | buffer.append(" has changed from ")
|
---|
67 | .append(m_prevRevision).append(" to ").append(m_revision);
|
---|
68 | }
|
---|
69 | return buffer.toString();
|
---|
70 | }
|
---|
71 | }
|
---|