/Mercurial.Net/Gui/DiffGuiCommand.cs

# · C# · 125 lines · 55 code · 9 blank · 61 comment · 0 complexity · 7c9ad1269cffd8a5a9306cf0cd1afa9a MD5 · raw file

  1. using System.ComponentModel;
  2. using Mercurial.Attributes;
  3. namespace Mercurial.Gui
  4. {
  5. /// <summary>
  6. /// Implements the TortoiseHg "vdiff" command:
  7. /// Launch the visual diff tool.
  8. /// </summary>
  9. public sealed class DiffGuiCommand : FilesBasedGuiCommandBase<DiffGuiCommand>
  10. {
  11. /// <summary>
  12. /// This is the backing field for the <see cref="BundleFile"/> property.
  13. /// </summary>
  14. private string _BundleFile = string.Empty;
  15. /// <summary>
  16. /// Initializes a new instance of the <see cref="DiffGuiCommand"/> class.
  17. /// </summary>
  18. public DiffGuiCommand()
  19. : base("vdiff")
  20. {
  21. // Do nothing here
  22. }
  23. /// <summary>
  24. /// Gets or sets the bundle file to preview.
  25. /// </summary>
  26. [NullableArgument(NonNullOption = "--bundle")]
  27. [DefaultValue("")]
  28. public string BundleFile
  29. {
  30. get
  31. {
  32. return _BundleFile;
  33. }
  34. set
  35. {
  36. _BundleFile = value;
  37. }
  38. }
  39. /// <summary>
  40. /// Sets the <see cref="BundleFile"/> property to the specified value and
  41. /// returns this <see cref="DiffGuiCommand"/> instance.
  42. /// </summary>
  43. /// <param name="value">
  44. /// The new value for the <see cref="BundleFile"/> property.
  45. /// </param>
  46. /// <returns>
  47. /// This <see cref="DiffGuiCommand"/> instance.
  48. /// </returns>
  49. /// <remarks>
  50. /// This method is part of the fluent interface.
  51. /// </remarks>
  52. public DiffGuiCommand WithBundleFile(string value)
  53. {
  54. BundleFile = value;
  55. return this;
  56. }
  57. /// <summary>
  58. /// Gets or sets the specific changeset to view in the diff tool.
  59. /// </summary>
  60. [NullableArgument(NonNullOption = "--change")]
  61. [DefaultValue(null)]
  62. public RevSpec Changeset
  63. {
  64. get;
  65. set;
  66. }
  67. /// <summary>
  68. /// Sets the <see cref="Changeset"/> property to the specified value and
  69. /// returns this <see cref="DiffGuiCommand"/> instance.
  70. /// </summary>
  71. /// <param name="value">
  72. /// The new value for the <see cref="Changeset"/> property.
  73. /// </param>
  74. /// <returns>
  75. /// This <see cref="DiffGuiCommand"/> instance.
  76. /// </returns>
  77. /// <remarks>
  78. /// This method is part of the fluent interface.
  79. /// </remarks>
  80. public DiffGuiCommand WithChangeset(RevSpec value)
  81. {
  82. Changeset = value;
  83. return this;
  84. }
  85. /// <summary>
  86. /// Gets or sets the revision <see cref="RevSpec"/> that identifies the revision or the
  87. /// revision range to view a diff of.
  88. /// Default value is <c>null</c>.
  89. /// </summary>
  90. [NullableArgument(NonNullOption = "--rev")]
  91. [DefaultValue(null)]
  92. public RevSpec Revisions
  93. {
  94. get;
  95. set;
  96. }
  97. /// <summary>
  98. /// Sets the <see cref="Revisions"/> property to the specified value and
  99. /// returns this <see cref="DiffGuiCommand"/> instance.
  100. /// </summary>
  101. /// <param name="value">
  102. /// The new value for the <see cref="Revisions"/> property.
  103. /// </param>
  104. /// <returns>
  105. /// This <see cref="DiffGuiCommand"/> instance.
  106. /// </returns>
  107. /// <remarks>
  108. /// This method is part of the fluent interface.
  109. /// </remarks>
  110. public DiffGuiCommand WithRevisions(RevSpec value)
  111. {
  112. Revisions = value;
  113. return this;
  114. }
  115. }
  116. }