Skip to content

Commit aafb285

Browse files
committed
Merge branch 'release-2.1.0' of https://github.com/Azure/azure-powershell into dev
# Conflicts: # src/ResourceManager/Compute/Commands.Compute/Microsoft.Azure.Commands.Compute.dll-Help.xml
2 parents 2aa9614 + a2cec82 commit aafb285

File tree

365 files changed

+22297
-9603
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

365 files changed

+22297
-9603
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1+
## Comments
2+
3+
---
4+
15
This checklist is used to make sure that common issues in a pull request are covered by the creator. You can find a more complete discussion of PowerShell cmdlet best practices [here](https://msdn.microsoft.com/en-us/library/dd878270(v=vs.85).aspx).
26

3-
Below in **Overall Changes**, check off the boxes that apply to your PR. Within each of the categories that you select, make sure that you can check off **all** of the boxes.
7+
Below in **Overall Changes**, check off the boxes that apply to your PR. For the categories that you did not check off, you can remove them from this body. Within each of the categories that you did select, make sure that you can check off **all** of the boxes.
8+
9+
For information on cleaning up the commits in your pull request, click [here](../documentation/cleaning-up-commits.md).
410

511
## Overall Changes
612
- [ ] [**MANDATORY** - General changes](#general)

documentation/cleaning-up-commits.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
## Cleaning up commits
2+
3+
### Best practices for keeping commits clean
4+
5+
During development, to make sure that your commit history stays clean while the branch you're based off of is changing, follow some of these rules:
6+
7+
1. **Rebase instead of merging**
8+
- When you need to update your branch with the changes made to the base branch, [rebasing](#rebasing) will change the commit that your branch is based off of, allowing you to add the changes from the base branch and not gain an extra commit that you would with merging
9+
2. **Large number of changes**
10+
- If you create a pull request that contains a large number of changes (*e.g.,* re-recording tests) that won't be able to be displayed on GitHub, separate your changes into multiple pull requests that reference each other.
11+
12+
### Number of commits
13+
14+
It can be difficult to follow the changes in a pull request when the number of commits that come with it become too large:
15+
- If a bug fix is being addressed, a single commit should be submitted
16+
- If a new feature is being introduced, then the pull request can have multiple logical commits with each commit clearly describing what it does
17+
18+
### Rebasing
19+
20+
Sometimes a pull request can be based on a much earlier commit in the branch that you are trying to merge into it, causing a large amount of commits and file changes to litter the pull request. In this case, it would be better to **rebase** (move branches around by changing the commit that they are based on). After rebasing, you will want to close the pull request and open a new one, which will now have fewer commits.
21+
22+
For example, if you're working from the branch **feature** and are trying to rebase with **master**, you may run one of the following commands:
23+
> `git rebase master`
24+
> `git rebase master feature`
25+
26+
You can also rebase with the following command:
27+
> `git pull --rebase`
28+
29+
A normal `git pull` is equivalent to `git fetch` followed by `git merge FETCH_HEAD`, but when you run `git pull --rebase`, it runs `git rebase` instead of `git merge`.
30+
31+
For more information on rebasing, click [here](https://git-scm.com/docs/git-rebase).
32+
33+
### Squashing
34+
35+
When your pull request has a group of commits that can be condensed into one, logical commit, use **squashing**. This will clean up the number of commits your pull request has while also grouping together common commits.
36+
37+
For example, if you wanted to squash the last three commits into one, you may run the following command:
38+
> `git rebase -i HEAD~3`
39+
40+
This will bring up an editor showing your last three commits. Pick a commit to keep (as the message), and squash the other two into it.
41+
42+
For more information on squashing, click [here](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Squashing-Commits).
43+
44+
### Cherry-picking
45+
46+
If you want to merge specific commits from another branch into the current one you are working from, use **cherry-picking**.
47+
48+
For example, if you're working on the **master** branch and want to pull commit X (the commit-hash) from the **feature** branch, you may run the following commands:
49+
> `git checkout master`
50+
> `git cherry-pick X -n`
51+
52+
The `-n`, or `--no-commit`, is recommended for cherry-picking because it won't automatically create a commit for the cherry-picked change; this will allow you to view the changes first and make sure that you want to add all everything from the cherry-picked commit.
53+
54+
Now, if you want to cherry-pick a range of commits, say X through Y, from the **feature** branch, you may run the following commands:
55+
> `git checkout -b temp-branch X`
56+
> `git rebase --onto master Y^`
57+
58+
For more information on cherry-picking, click [here](https://git-scm.com/docs/git-cherry-pick).

setup/azurecmd.wxs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
33

4-
<?define productName="Microsoft Azure PowerShell - August 2016" ?>
4+
<?define productName="Microsoft Azure PowerShell - September 2016" ?>
55
<?define sourceDir="$(var.SolutionDir)..\src\Package\$(var.Configuration)" ?>
66
<?define caSourceDir="$(var.SolutionDir)setup\bin\$(var.Configuration)" ?>
77

8-
<?define version="2.0.1" ?>
8+
<?define version="2.1.0" ?>
99

1010
<Product Id="*"
1111
Name="$(var.productName)"

src/Common/Commands.Common.Authentication.Test/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828

2929
[assembly: ComVisible(false)]
3030
[assembly: CLSCompliant(false)]
31-
[assembly: AssemblyVersion("2.0.1")]
32-
[assembly: AssemblyFileVersion("2.0.1")]
31+
[assembly: AssemblyVersion("2.1.0")]
32+
[assembly: AssemblyFileVersion("2.1.0")]
3333
[assembly: CollectionBehavior(DisableTestParallelization = true)]

src/Common/Commands.Common.Authentication/Factories/ClientFactory.cs

Lines changed: 86 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
using Microsoft.Azure.Commands.Common.Authentication.Models;
1717
using Microsoft.Azure.Commands.Common.Authentication.Properties;
1818
using System;
19+
using System.Collections.Concurrent;
1920
using System.Collections.Generic;
2021
using System.Collections.Specialized;
22+
using System.Linq;
2123
using System.Net;
2224
using System.Net.Http;
2325
using System.Net.Http.Headers;
26+
using System.Threading;
2427

2528
namespace Microsoft.Azure.Commands.Common.Authentication.Factories
2629
{
@@ -30,12 +33,16 @@ public class ClientFactory : IClientFactory
3033

3134
private Dictionary<Type, IClientAction> _actions;
3235
private OrderedDictionary _handlers;
36+
private ReaderWriterLockSlim _actionsLock;
37+
private ReaderWriterLockSlim _handlersLock;
3338

3439
public ClientFactory()
3540
{
3641
_actions = new Dictionary<Type, IClientAction>();
42+
_actionsLock = new ReaderWriterLockSlim();
3743
UserAgents = new HashSet<ProductInfoHeaderValue>();
3844
_handlers = new OrderedDictionary();
45+
_handlersLock = new ReaderWriterLockSlim();
3946
}
4047

4148
public virtual TClient CreateArmClient<TClient>(AzureContext context, AzureEnvironment.Endpoint endpoint) where TClient : Microsoft.Rest.ServiceClient<TClient>
@@ -108,8 +115,7 @@ public virtual TClient CreateClient<TClient>(AzureContext context, AzureEnvironm
108115
public virtual TClient CreateClient<TClient>(AzureSMProfile profile, AzureEnvironment.Endpoint endpoint) where TClient : ServiceClient<TClient>
109116
{
110117
TClient client = CreateClient<TClient>(profile.Context, endpoint);
111-
112-
foreach (IClientAction action in _actions.Values)
118+
foreach (IClientAction action in GetActions())
113119
{
114120
action.Apply<TClient>(client, profile, endpoint);
115121
}
@@ -154,7 +160,7 @@ public virtual TClient CreateClient<TClient>(AzureSMProfile profile, AzureSubscr
154160

155161
TClient client = CreateClient<TClient>(context, endpoint);
156162

157-
foreach (IClientAction action in _actions.Values)
163+
foreach (IClientAction action in GetActions())
158164
{
159165
action.Apply<TClient>(client, profile, endpoint);
160166
}
@@ -242,34 +248,82 @@ public static HttpClientHandler CreateHttpClientHandler(string endpoint, ICreden
242248

243249
public void AddAction(IClientAction action)
244250
{
245-
if (action != null)
251+
_actionsLock.EnterWriteLock();
252+
try
253+
{
254+
if (action != null)
255+
{
256+
action.ClientFactory = this;
257+
_actions[action.GetType()] = action;
258+
}
259+
}
260+
finally
246261
{
247-
action.ClientFactory = this;
248-
_actions[action.GetType()] = action;
262+
_actionsLock.ExitWriteLock();
249263
}
250264
}
251265

252266
public void RemoveAction(Type actionType)
253267
{
254-
if (_actions.ContainsKey(actionType))
268+
_actionsLock.EnterWriteLock();
269+
try
255270
{
256-
_actions.Remove(actionType);
271+
if (_actions.ContainsKey(actionType))
272+
{
273+
_actions.Remove(actionType);
274+
}
275+
}
276+
finally
277+
{
278+
_actionsLock.ExitWriteLock();
257279
}
258280
}
259281

282+
private IClientAction[] GetActions()
283+
{
284+
IClientAction[] result = null;
285+
_actionsLock.EnterReadLock();
286+
try
287+
{
288+
result = _actions.Values.ToArray();
289+
}
290+
finally
291+
{
292+
_actionsLock.ExitReadLock();
293+
}
294+
295+
return result;
296+
}
297+
260298
public void AddHandler<T>(T handler) where T : DelegatingHandler, ICloneable
261299
{
262-
if (handler != null)
300+
_handlersLock.EnterWriteLock();
301+
try
263302
{
264-
_handlers[handler.GetType()] = handler;
303+
if (handler != null)
304+
{
305+
_handlers[handler.GetType()] = handler;
306+
}
307+
}
308+
finally
309+
{
310+
_handlersLock.ExitWriteLock();
265311
}
266312
}
267313

268314
public void RemoveHandler(Type handlerType)
269315
{
270-
if (_handlers.Contains(handlerType))
316+
_handlersLock.EnterWriteLock();
317+
try
318+
{
319+
if (_handlers.Contains(handlerType))
320+
{
321+
_handlers.Remove(handlerType);
322+
}
323+
}
324+
finally
271325
{
272-
_handlers.Remove(handlerType);
326+
_handlersLock.ExitWriteLock();
273327
}
274328
}
275329

@@ -296,24 +350,32 @@ public void AddUserAgent(string productName)
296350

297351
public DelegatingHandler[] GetCustomHandlers()
298352
{
299-
List<DelegatingHandler> newHandlers = new List<DelegatingHandler>();
300-
var enumerator = _handlers.GetEnumerator();
301-
while (enumerator.MoveNext())
353+
_handlersLock.EnterReadLock();
354+
try
302355
{
303-
var handler = enumerator.Value;
304-
ICloneable cloneableHandler = handler as ICloneable;
305-
if (cloneableHandler != null)
356+
List<DelegatingHandler> newHandlers = new List<DelegatingHandler>();
357+
var enumerator = _handlers.GetEnumerator();
358+
while (enumerator.MoveNext())
306359
{
307-
var newHandler = cloneableHandler.Clone();
308-
DelegatingHandler convertedHandler = newHandler as DelegatingHandler;
309-
if (convertedHandler != null)
360+
var handler = enumerator.Value;
361+
ICloneable cloneableHandler = handler as ICloneable;
362+
if (cloneableHandler != null)
310363
{
311-
newHandlers.Add(convertedHandler);
364+
var newHandler = cloneableHandler.Clone();
365+
DelegatingHandler convertedHandler = newHandler as DelegatingHandler;
366+
if (convertedHandler != null)
367+
{
368+
newHandlers.Add(convertedHandler);
369+
}
312370
}
313371
}
314-
}
315372

316-
return newHandlers.ToArray();
373+
return newHandlers.ToArray();
374+
}
375+
finally
376+
{
377+
_handlersLock.ExitReadLock();
378+
}
317379
}
318380
}
319381
}

src/Common/Commands.Common.Authentication/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@
4646
// You can specify all the values or you can default the Build and Revision Numbers
4747
// by using the '*' as shown below:
4848
// [assembly: AssemblyVersion("1.0.*")]
49-
[assembly: AssemblyVersion("2.0.1")]
50-
[assembly: AssemblyFileVersion("2.0.1")]
49+
[assembly: AssemblyVersion("2.1.0")]
50+
[assembly: AssemblyFileVersion("2.1.0")]

src/Common/Commands.Common.Storage/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
[assembly: ComVisible(false)]
2525
[assembly: CLSCompliant(false)]
2626
[assembly: Guid("c565107e-98a9-4703-85cd-a7efc3d8da7b")]
27-
[assembly: AssemblyVersion("2.0.1")]
28-
[assembly: AssemblyFileVersion("2.0.1")]
27+
[assembly: AssemblyVersion("2.1.0")]
28+
[assembly: AssemblyFileVersion("2.1.0")]

src/Common/Commands.Common/AzurePowerShell.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ public class AzurePowerShell
2626

2727
public const string AssemblyCopyright = "Copyright © Microsoft";
2828

29-
public const string AssemblyVersion = "2.0.1";
29+
public const string AssemblyVersion = "2.1.0";
3030

31-
public const string AssemblyFileVersion = "2.0.1";
31+
public const string AssemblyFileVersion = "2.1.0";
3232

3333
public const string ProfileFile = "AzureProfile.json";
3434

src/Common/Commands.Common/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
[assembly: ComVisible(false)]
2626
[assembly: CLSCompliant(false)]
2727
[assembly: Guid("4f3ab2e4-cc7a-43ac-bb15-f481fcf94d58")]
28-
[assembly: AssemblyVersion("2.0.1")]
29-
[assembly: AssemblyFileVersion("2.0.1")]
28+
[assembly: AssemblyVersion("2.1.0")]
29+
[assembly: AssemblyFileVersion("2.1.0")]
3030
#if SIGN
3131
[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.Commands, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
3232
[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.Commands.CloudService, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]

src/Common/Commands.ScenarioTests.Common/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("2.0.1")]
36-
[assembly: AssemblyFileVersion("2.0.1")]
35+
[assembly: AssemblyVersion("2.1.0")]
36+
[assembly: AssemblyFileVersion("2.1.0")]
3737
[assembly: CollectionBehavior(DisableTestParallelization = true)]

src/ResourceManager/ApiManagement/AzureRM.ApiManagement.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
@{
1010

1111
# Version number of this module.
12-
ModuleVersion = '2.0.1'
12+
ModuleVersion = '2.1.0'
1313

1414
# ID used to uniquely identify this module
1515
GUID = 'f875725d-8ce4-423f-a6af-ea880bc63f13'
@@ -45,7 +45,7 @@ CLRVersion='4.0'
4545
ProcessorArchitecture = 'None'
4646

4747
# Modules that must be imported into the global environment prior to importing this module
48-
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '2.0.1'})
48+
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '2.1.0'})
4949

5050
# Assemblies that must be loaded prior to importing this module
5151
RequiredAssemblies = @()

src/ResourceManager/ApiManagement/Commands.ApiManagement.ServiceManagement/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,5 @@
4242
// You can specify all the values or you can default the Build and Revision Numbers
4343
// by using the '*' as shown below:
4444

45-
[assembly: AssemblyVersion("2.0.1")]
46-
[assembly: AssemblyFileVersion("2.0.1")]
45+
[assembly: AssemblyVersion("2.1.0")]
46+
[assembly: AssemblyFileVersion("2.1.0")]

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@
4141
// You can specify all the values or you can default the Build and Revision Numbers
4242
// by using the '*' as shown below:
4343

44-
[assembly: AssemblyVersion("2.0.1")]
45-
[assembly: AssemblyFileVersion("2.0.1")]
44+
[assembly: AssemblyVersion("2.1.0")]
45+
[assembly: AssemblyFileVersion("2.1.0")]

src/ResourceManager/ApiManagement/Commands.ApiManagement/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@
4141
// You can specify all the values or you can default the Build and Revision Numbers
4242
// by using the '*' as shown below:
4343

44-
[assembly: AssemblyVersion("2.0.1")]
45-
[assembly: AssemblyFileVersion("2.0.1")]
44+
[assembly: AssemblyVersion("2.1.0")]
45+
[assembly: AssemblyFileVersion("2.1.0")]

src/ResourceManager/ApiManagement/Commands.SMAPI.Test/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@
4242
// You can specify all the values or you can default the Build and Revision Numbers
4343
// by using the '*' as shown below:
4444

45-
[assembly: AssemblyVersion("2.0.1")]
46-
[assembly: AssemblyFileVersion("2.0.1")]
45+
[assembly: AssemblyVersion("2.1.0")]
46+
[assembly: AssemblyFileVersion("2.1.0")]
4747
[assembly: CollectionBehavior(DisableTestParallelization = true)]

0 commit comments

Comments
 (0)