~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/ngit/NGit/NGit/PersonIdent.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
                /// from the configuration.
78
78
                /// </remarks>
79
79
                /// <param name="repo"></param>
80
 
                public PersonIdent(Repository repo)
 
80
                public PersonIdent(Repository repo) : this(repo.GetConfig().Get(UserConfig.KEY))
81
81
                {
82
 
                        UserConfig config = repo.GetConfig().Get(UserConfig.KEY);
83
 
                        name = config.GetCommitterName();
84
 
                        emailAddress = config.GetCommitterEmail();
85
 
                        when = SystemReader.GetInstance().GetCurrentTime();
86
 
                        tzOffset = SystemReader.GetInstance().GetTimezone(when);
87
82
                }
88
83
 
89
84
                /// <summary>
107
102
                /// </summary>
108
103
                /// <param name="aName"></param>
109
104
                /// <param name="aEmailAddress"></param>
110
 
                public PersonIdent(string aName, string aEmailAddress)
 
105
                public PersonIdent(string aName, string aEmailAddress) : this(aName, aEmailAddress
 
106
                        , SystemReader.GetInstance().GetCurrentTime())
111
107
                {
112
 
                        name = aName;
113
 
                        emailAddress = aEmailAddress;
114
 
                        when = SystemReader.GetInstance().GetCurrentTime();
115
 
                        tzOffset = SystemReader.GetInstance().GetTimezone(when);
116
108
                }
117
109
 
118
110
                /// <summary>Copy a PersonIdent, but alter the clone's time stamp</summary>
137
129
                /// <see cref="PersonIdent">PersonIdent</see>
138
130
                /// </param>
139
131
                /// <param name="aWhen">local time</param>
140
 
                public PersonIdent(NGit.PersonIdent pi, DateTime aWhen)
 
132
                public PersonIdent(NGit.PersonIdent pi, DateTime aWhen) : this(pi.GetName(), pi.GetEmailAddress
 
133
                        (), aWhen.GetTime(), pi.tzOffset)
141
134
                {
142
 
                        name = pi.GetName();
143
 
                        emailAddress = pi.GetEmailAddress();
144
 
                        when = aWhen.GetTime();
145
 
                        tzOffset = pi.tzOffset;
146
135
                }
147
136
 
148
137
                /// <summary>Construct a PersonIdent from simple data</summary>
151
140
                /// <param name="aWhen">local time stamp</param>
152
141
                /// <param name="aTZ">time zone</param>
153
142
                public PersonIdent(string aName, string aEmailAddress, DateTime aWhen, TimeZoneInfo
154
 
                         aTZ)
155
 
                {
156
 
                        name = aName;
157
 
                        emailAddress = aEmailAddress;
158
 
                        when = aWhen.GetTime();
159
 
                        tzOffset = aTZ.GetOffset(when) / (60 * 1000);
 
143
                         aTZ) : this(aName, aEmailAddress, aWhen.GetTime(), aTZ.GetOffset(aWhen.GetTime(
 
144
                        )) / (60 * 1000))
 
145
                {
 
146
                }
 
147
 
 
148
                /// <summary>Copy a PersonIdent, but alter the clone's time stamp</summary>
 
149
                /// <param name="pi">
 
150
                /// original
 
151
                /// <see cref="PersonIdent">PersonIdent</see>
 
152
                /// </param>
 
153
                /// <param name="aWhen">local time stamp</param>
 
154
                /// <param name="aTZ">time zone</param>
 
155
                public PersonIdent(NGit.PersonIdent pi, long aWhen, int aTZ) : this(pi.GetName(), 
 
156
                        pi.GetEmailAddress(), aWhen, aTZ)
 
157
                {
 
158
                }
 
159
 
 
160
                private PersonIdent(string aName, string aEmailAddress, long when) : this(aName, 
 
161
                        aEmailAddress, when, SystemReader.GetInstance().GetTimezone(when))
 
162
                {
 
163
                }
 
164
 
 
165
                private PersonIdent(UserConfig config) : this(config.GetCommitterName(), config.GetCommitterEmail
 
166
                        ())
 
167
                {
160
168
                }
161
169
 
162
170
                /// <summary>
169
177
                /// <param name="aTZ">time zone</param>
170
178
                public PersonIdent(string aName, string aEmailAddress, long aWhen, int aTZ)
171
179
                {
 
180
                        if (aName == null)
 
181
                        {
 
182
                                throw new ArgumentException("Name of PersonIdent must not be null.");
 
183
                        }
 
184
                        if (aEmailAddress == null)
 
185
                        {
 
186
                                throw new ArgumentException("E-mail address of PersonIdent must not be null.");
 
187
                        }
172
188
                        name = aName;
173
189
                        emailAddress = aEmailAddress;
174
190
                        when = aWhen;
175
191
                        tzOffset = aTZ;
176
192
                }
177
193
 
178
 
                /// <summary>Copy a PersonIdent, but alter the clone's time stamp</summary>
179
 
                /// <param name="pi">
180
 
                /// original
181
 
                /// <see cref="PersonIdent">PersonIdent</see>
182
 
                /// </param>
183
 
                /// <param name="aWhen">local time stamp</param>
184
 
                /// <param name="aTZ">time zone</param>
185
 
                public PersonIdent(NGit.PersonIdent pi, long aWhen, int aTZ)
186
 
                {
187
 
                        name = pi.GetName();
188
 
                        emailAddress = pi.GetEmailAddress();
189
 
                        when = aWhen;
190
 
                        tzOffset = aTZ;
191
 
                }
192
 
 
193
194
                /// <returns>Name of person</returns>
194
195
                public virtual string GetName()
195
196
                {