PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/Mercurial.Net/Hooks/MercurialPreCommitHook.cs

#
C# | 51 lines | 22 code | 3 blank | 26 comment | 0 complexity | 5125798ea1fc261fa882fb350e742071 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0
  1. namespace Mercurial.Hooks
  2. {
  3. /// <summary>
  4. /// This <see cref="MercurialHookBase"/> descendant implements the
  5. /// code necessary to handle the "precommit" hook:
  6. /// This is run before starting a commit (note, the commit command has started executing, and can have addes files, etc.
  7. /// See the MercurialPreCommitCommandHook for a way to intercept the entire commit command.)
  8. /// </summary>
  9. /// <remarks>
  10. /// As with all controlling hooks (descendants of <see cref="MercurialControllingHookBase"/>), you can
  11. /// prevent the command from continuing, or let it continue, by calling
  12. /// <see cref="MercurialControllingHookBase.TerminateHookAndCancelCommand(int)"/>
  13. /// or <see cref="MercurialControllingHookBase.TerminateHookAndProceed"/> respectively.
  14. /// </remarks>
  15. public class MercurialPreCommitHook : MercurialControllingHookBase
  16. {
  17. /// <summary>
  18. /// This is the backing field for the <see cref="LeftParentRevision"/> property.
  19. /// </summary>
  20. private readonly RevSpec _LeftParentRevision = LoadRevision("HG_PARENT1");
  21. /// <summary>
  22. /// This is the backing field for the <see cref="RightParentRevision"/> property.
  23. /// </summary>
  24. private readonly RevSpec _RightParentRevision = LoadRevision("HG_PARENT2");
  25. /// <summary>
  26. /// Gets the <see cref="RevSpec"/> identifying the left parent of the changeset
  27. /// that was committed.
  28. /// </summary>
  29. public RevSpec LeftParentRevision
  30. {
  31. get
  32. {
  33. return _LeftParentRevision;
  34. }
  35. }
  36. /// <summary>
  37. /// Gets the <see cref="RevSpec"/> identifying the left parent of the changeset
  38. /// that was committed; or <c>null</c> if this is not a merge changeset.
  39. /// </summary>
  40. public RevSpec RightParentRevision
  41. {
  42. get
  43. {
  44. return _RightParentRevision;
  45. }
  46. }
  47. }
  48. }