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. * Holds the information of a line of rdiff
  20. */
  21. class CvsTagEntry {
  22. String m_filename;
  23. String m_prevRevision;
  24. String m_revision;
  25. public CvsTagEntry(String filename) {
  26. this(filename, null, null);
  27. }
  28. public CvsTagEntry(String filename, String revision) {
  29. this(filename, revision, null);
  30. }
  31. public CvsTagEntry(String filename, String revision,
  32. String prevRevision) {
  33. m_filename = filename;
  34. m_revision = revision;
  35. m_prevRevision = prevRevision;
  36. }
  37. public String getFile() {
  38. return m_filename;
  39. }
  40. public String getRevision() {
  41. return m_revision;
  42. }
  43. public String getPreviousRevision() {
  44. return m_prevRevision;
  45. }
  46. public String toString() {
  47. StringBuffer buffer = new StringBuffer();
  48. buffer.append(m_filename);
  49. if ((m_revision == null)) {
  50. buffer.append(" was removed");
  51. if(m_prevRevision != null) {
  52. buffer.append("; previous revision was ").append(m_prevRevision);
  53. }
  54. } else if (m_revision != null && m_prevRevision == null) {
  55. buffer.append(" is new; current revision is ")
  56. .append(m_revision);
  57. } else if (m_revision != null && m_prevRevision != null) {
  58. buffer.append(" has changed from ")
  59. .append(m_prevRevision).append(" to ").append(m_revision);
  60. }
  61. return buffer.toString();
  62. }
  63. }