PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/Mercurial.Net/Hooks/MercurialPreCommitHook.cs

#
C# | 51 lines | 22 code | 3 blank | 26 comment | 0 complexity | 5125798ea1fc261fa882fb350e742071 MD5 | raw file
 1namespace 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
22        /// <summary>
23        /// This is the backing field for the <see cref="RightParentRevision"/> property.
24        /// </summary>
25        private readonly RevSpec _RightParentRevision = LoadRevision("HG_PARENT2");
26
27        /// <summary>
28        /// Gets the <see cref="RevSpec"/> identifying the left parent of the changeset
29        /// that was committed.
30        /// </summary>
31        public RevSpec LeftParentRevision
32        {
33            get
34            {
35                return _LeftParentRevision;
36            }
37        }
38
39        /// <summary>
40        /// Gets the <see cref="RevSpec"/> identifying the left parent of the changeset
41        /// that was committed; or <c>null</c> if this is not a merge changeset.
42        /// </summary>
43        public RevSpec RightParentRevision
44        {
45            get
46            {
47                return _RightParentRevision;
48            }
49        }
50    }
51}