/plugins/SVNPlugin/branches/1.2.0_svn1.4/src/ise/plugin/svn/data/DiffData.java

# · Java · 111 lines · 55 code · 14 blank · 42 comment · 6 complexity · 56e3f218dca0693322426e21ac7dcbc1 MD5 · raw file

  1. /*
  2. Copyright (c) 2007, Dale Anson
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without modification,
  5. are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright notice,
  7. this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright notice,
  9. this list of conditions and the following disclaimer in the documentation
  10. and/or other materials provided with the distribution.
  11. * Neither the name of the author nor the names of its contributors
  12. may be used to endorse or promote products derived from this software without
  13. specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  18. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  21. ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. package ise.plugin.svn.data;
  26. import java.util.List;
  27. import org.tmatesoft.svn.core.wc.SVNRevision;
  28. /**
  29. * Data object to represent 2 revisions used for a diff on a single file.
  30. * Revision 1 is always for a remote file, revision 2 may be a local file
  31. * or a remote file.
  32. *
  33. * Can also be used to represent 2 remote files for diff. Revision 1 corresponds
  34. * to getPaths().get(0), revision 2 corresponds to getPaths().get(1).
  35. */
  36. public class DiffData extends SVNData {
  37. private static final long serialVersionUID = 42L;
  38. private String repositoryUrl = null;
  39. private SVNRevision revision1 = SVNRevision.HEAD;
  40. private SVNRevision revision2 = null;
  41. private boolean svnDiff = false;
  42. public void setURL( String url ) {
  43. repositoryUrl = url;
  44. }
  45. public String getURL() {
  46. return repositoryUrl;
  47. }
  48. /**
  49. * Sets the value of revision.
  50. * @param revision The value to assign revision.
  51. */
  52. public void setRevision1( SVNRevision revision ) {
  53. this.revision1 = revision;
  54. }
  55. public SVNRevision getRevision1() {
  56. return revision1;
  57. }
  58. public void setRevision2( SVNRevision revision ) {
  59. this.revision2 = revision;
  60. }
  61. public SVNRevision getRevision2() {
  62. return revision2;
  63. }
  64. /**
  65. * @return true if the user is requesting an svn diff rather than a jdiff diff.
  66. */
  67. public boolean getSvnDiff() {
  68. return svnDiff;
  69. }
  70. public void setSvnDiff( boolean svnDiff ) {
  71. this.svnDiff = svnDiff;
  72. }
  73. public String toString() {
  74. StringBuffer sb = new StringBuffer();
  75. sb.append( "DiffData[\n" );
  76. List paths = getPaths();
  77. if ( paths != null && paths.size() > 0 ) {
  78. sb.append( "\n\tpath1=" );
  79. sb.append( getPaths().get( 0 ) );
  80. }
  81. if ( paths != null && paths.size() > 1 ) {
  82. sb.append( "\n\tpath2=" );
  83. sb.append( getPaths().get( 1 ) );
  84. }
  85. sb.append( "\n\turl=" );
  86. sb.append( repositoryUrl );
  87. sb.append( "\n\trev1=" );
  88. sb.append( revision1 );
  89. sb.append( "\n\trev2=" );
  90. sb.append( revision2 );
  91. sb.append( "\n]" );
  92. return sb.toString();
  93. }
  94. }