LEFT | RIGHT |
(no file at all) | |
1 /* | 1 /* |
2 Copyright 2011 Google Inc | 2 Copyright 2011 Google Inc |
3 | 3 |
4 Licensed under the Apache License, Version 2.0 (the "License"); | 4 Licensed under the Apache License, Version 2.0 (the "License"); |
5 you may not use this file except in compliance with the License. | 5 you may not use this file except in compliance with the License. |
6 You may obtain a copy of the License at | 6 You may obtain a copy of the License at |
7 | 7 |
8 http://www.apache.org/licenses/LICENSE-2.0 | 8 http://www.apache.org/licenses/LICENSE-2.0 |
9 | 9 |
10 Unless required by applicable law or agreed to in writing, software | 10 Unless required by applicable law or agreed to in writing, software |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 /// <summary> | 91 /// <summary> |
92 /// Constructs a new repository. It creates a new repository if the fold
er doesn't exists, otherwise it gets | 92 /// Constructs a new repository. It creates a new repository if the fold
er doesn't exists, otherwise it gets |
93 /// the current status of the repository. | 93 /// the current status of the repository. |
94 /// </summary> | 94 /// </summary> |
95 /// <param name="repositoryUri">The URI of this repository</param> | 95 /// <param name="repositoryUri">The URI of this repository</param> |
96 /// <param name="localDir">The local directory which contains the reposi
tory files</param> | 96 /// <param name="localDir">The local directory which contains the reposi
tory files</param> |
97 public Hg(Uri repositoryUri, string localDir) | 97 public Hg(Uri repositoryUri, string localDir) |
98 { | 98 { |
99 RepositoryUri = repositoryUri; | 99 RepositoryUri = repositoryUri; |
100 WorkingDirectory = Path.GetFullPath(localDir); | 100 WorkingDirectory = string.IsNullOrEmpty(localDir) ? Environment.Curr
entDirectory : |
| 101 Path.GetFullPath(localDir); |
101 Name = repositoryUri.Segments.Last(); | 102 Name = repositoryUri.Segments.Last(); |
102 | 103 |
103 if (!Directory.Exists(WorkingDirectory)) | 104 if (!Directory.Exists(WorkingDirectory)) |
104 { | 105 { |
105 TraceSource.TraceEvent(TraceEventType.Information, "[{0}] Fetchi
ng {1}", Name, repositoryUri); | 106 TraceSource.TraceEvent(TraceEventType.Information, "[{0}] Fetchi
ng {1}", Name, repositoryUri); |
106 Directory.CreateDirectory(WorkingDirectory); | 107 Directory.CreateDirectory(WorkingDirectory); |
107 RunHg(string.Format("clone {0} {1}", repositoryUri.ToString(), W
orkingDirectory)); | 108 RunHg(string.Format("clone {0} {1}", repositoryUri.ToString(), W
orkingDirectory)); |
108 } | 109 } |
109 else | 110 else |
110 { | 111 { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 return msgs.ToArray(); | 262 return msgs.ToArray(); |
262 } | 263 } |
263 | 264 |
264 public void Dispose() | 265 public void Dispose() |
265 { | 266 { |
266 TraceSource.TraceEvent(TraceEventType.Information, "[{0}] Cleaning u
p", Name); | 267 TraceSource.TraceEvent(TraceEventType.Information, "[{0}] Cleaning u
p", Name); |
267 Directory.Delete(WorkingDirectory, true); | 268 Directory.Delete(WorkingDirectory, true); |
268 } | 269 } |
269 } | 270 } |
270 } | 271 } |
LEFT | RIGHT |