PageRenderTime 34ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/Mercurial.Net/Hooks/MercurialOutgoingHook.cs

#
C# | 62 lines | 33 code | 6 blank | 23 comment | 0 complexity | 242dfaaed9ce6805bfa5da6ed81d030d MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
  1. using System;
  2. using System.Diagnostics.CodeAnalysis;
  3. namespace Mercurial.Hooks
  4. {
  5. /// <summary>
  6. /// This <see cref="MercurialHookBase"/> descendant implements the
  7. /// code necessary to handle the "outgoing" hook:
  8. /// This is run after sending changes from local repository to another.
  9. /// </summary>
  10. public class MercurialOutgoingHook : MercurialHookBase
  11. {
  12. /// <summary>
  13. /// This is the backing field for the <see cref="Source"/> property.
  14. /// </summary>
  15. private readonly string _Source = Environment.GetEnvironmentVariable("HG_SOURCE") ?? string.Empty;
  16. /// <summary>
  17. /// This is the backing field for the <see cref="FirstRevision"/> property.
  18. /// </summary>
  19. private readonly RevSpec _FirstRevision = LoadRevision("HG_NODE");
  20. /// <summary>
  21. /// This is the backing field for the <see cref="Url"/> property.
  22. /// </summary>
  23. private readonly string _Url = Environment.GetEnvironmentVariable("HG_URL") ?? string.Empty;
  24. /// <summary>
  25. /// Gets the source of the operation.
  26. /// </summary>
  27. public string Source
  28. {
  29. get
  30. {
  31. return _Source;
  32. }
  33. }
  34. /// <summary>
  35. /// Gets the <see cref="RevSpec"/> of the first changeset that was sent.
  36. /// </summary>
  37. public RevSpec FirstRevision
  38. {
  39. get
  40. {
  41. return _FirstRevision;
  42. }
  43. }
  44. /// <summary>
  45. /// Gets the url of the remote repository, if known.
  46. /// </summary>
  47. [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings", Justification = "Cannot guarantee this is a valid Uri, but it is still given as an Url from Mercurial")]
  48. public string Url
  49. {
  50. get
  51. {
  52. return _Url;
  53. }
  54. }
  55. }
  56. }