PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/Mercurial.Net/Hooks/MercurialPostCommandHook.cs

#
C# | 77 lines | 40 code | 8 blank | 29 comment | 0 complexity | fcc521052277b65822f9a69a34b54241 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
  1. using System;
  2. using System.Globalization;
  3. namespace Mercurial.Hooks
  4. {
  5. /// <summary>
  6. /// This <see cref="MercurialControllingHookBase"/> descendant implements the
  7. /// code necessary to handle the "post-command" hook:
  8. /// This is run after the command itself has finished executing.
  9. /// </summary>
  10. public class MercurialPostCommandHook : MercurialControllingHookBase
  11. {
  12. /// <summary>
  13. /// This is the backing field for the <see cref="Arguments"/> property.
  14. /// </summary>
  15. private readonly MercurialCommandHookArgumentsCollection _Arguments = new MercurialCommandHookArgumentsCollection();
  16. /// <summary>
  17. /// This is the backing field for the <see cref="Options"/> property.
  18. /// </summary>
  19. private readonly MercurialCommandHookDictionary _Options = new MercurialCommandHookDictionary(Environment.GetEnvironmentVariable("HG_OPTS") ?? "{}");
  20. /// <summary>
  21. /// This is the backing field for the <see cref="Patterns"/> property.
  22. /// </summary>
  23. private readonly MercurialCommandHookPatternCollection _Patterns = new MercurialCommandHookPatternCollection(Environment.GetEnvironmentVariable("HG_PATS") ?? "[]");
  24. /// <summary>
  25. /// This is the backing field for the <see cref="ExitCode"/> property.
  26. /// </summary>
  27. private readonly int _ExitCode = int.Parse(Environment.GetEnvironmentVariable("HG_RESULT") ?? "0", CultureInfo.InvariantCulture);
  28. /// <summary>
  29. /// Gets the collection of arguments to the command.
  30. /// </summary>
  31. public MercurialCommandHookArgumentsCollection Arguments
  32. {
  33. get
  34. {
  35. return _Arguments;
  36. }
  37. }
  38. /// <summary>
  39. /// Gets the exit code of the Mercurial command that finished executing.
  40. /// </summary>
  41. public int ExitCode
  42. {
  43. get
  44. {
  45. return _ExitCode;
  46. }
  47. }
  48. /// <summary>
  49. /// Gets the collection of options to the command.
  50. /// </summary>
  51. public MercurialCommandHookDictionary Options
  52. {
  53. get
  54. {
  55. return _Options;
  56. }
  57. }
  58. /// <summary>
  59. /// Gets the collection of patterns given to the command.
  60. /// </summary>
  61. public MercurialCommandHookPatternCollection Patterns
  62. {
  63. get
  64. {
  65. return _Patterns;
  66. }
  67. }
  68. }
  69. }