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