Skip to content

Commit f2298cd

Browse files
committed
Merge branch 'bugfix'
# Conflicts: # RELEASE_NOTES.md # src/LockFileComparer/AssemblyInfo.fs # src/Paket.Bootstrapper/Properties/AssemblyInfo.cs # src/Paket.Core/AssemblyInfo.fs # src/Paket/AssemblyInfo.fs
2 parents f3b2e48 + 1319c7a commit f2298cd

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
#### 6.0.0-alpha005 - 2019-12-05
1+
#### 6.0.0-alpha006 - 2019-12-05
22
* Full .NET Core / SDK compatible version
33

4+
#### 5.241.1 - 2019-12-05
5+
* Added IgnoreConflict option for paket push - https://github.com/fsprojects/Paket/pull/3741
6+
47
#### 5.240.1 - 2019-12-05
58
* SECURITY: Check against zip leak in the workaround case of 5.240.0 - https://github.com/fsprojects/Paket/pull/3747
69

src/Paket.Core/Dependencies/RemoteUpload.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ let GetUrlWithEndpoint (url: string option) (endPoint: string option) =
2929
| Some whyIsThisNeeded , _ -> failwith "Url and endpoint combination not supported"
3030
urlWithEndpoint.ToString ()
3131

32-
33-
let Push maxTrials url apiKey clientVersion packageFileName =
32+
let Push maxTrials url apiKey clientVersion packageFileName ignoreConflicts =
3433
let tracefnVerbose m = Printf.kprintf traceVerbose m
3534
#if USE_WEB_CLIENT_FOR_UPLOAD
3635
let useHttpClient = Environment.GetEnvironmentVariable "PAKET_PUSH_HTTPCLIENT" = "true"
@@ -72,6 +71,10 @@ let Push maxTrials url apiKey clientVersion packageFileName =
7271
#endif
7372
tracefn "Pushing %s complete." packageFileName
7473
with
74+
| :? RequestFailedException as rfe when rfe.Info.IsSome && rfe.Info.Value.StatusCode = HttpStatusCode.Conflict && ignoreConflicts ->
75+
tracefn "Package %s already exists. - Conflict (409) status ignored!" packageFileName
76+
| exn when exn.Message.Contains("(409)") && ignoreConflicts ->
77+
tracefn "Package %s already exists. - Conflict (409) status ignored!" packageFileName
7578
| :? RequestFailedException as rfe when rfe.Info.IsSome && rfe.Info.Value.StatusCode = HttpStatusCode.Conflict ->
7679
rethrowf Exception rfe "Package %s already exists" packageFileName
7780
| exn when exn.Message.Contains("(409)") ->

src/Paket.Core/PublicAPI.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ type Dependencies(dependenciesFileName: string) =
753753
PackageProcess.Pack(workingDir, dependenciesFile, outputPath, buildConfig, buildPlatform, version, specificVersions, releaseNotes, templateFile, excludedTemplates, lockDependencies, minimumFromLockFile, pinProjectReferences, interprojectReferencesConstraint, symbols, includeReferencedProjects, projectUrl)
754754

755755
/// Pushes a nupkg file.
756-
static member Push(packageFileName, ?url, ?apiKey, (?endPoint: string), ?paketVersion, ?maxTrials) =
756+
static member Push(packageFileName, ?url, ?apiKey, (?endPoint: string), ?paketVersion, ?maxTrials, ?ignoreConflicts) =
757757
let urlWithEndpoint = RemoteUpload.GetUrlWithEndpoint url endPoint
758758
let envKey =
759759
match Environment.GetEnvironmentVariable("NUGET_KEY") |> Option.ofObj with
@@ -783,12 +783,14 @@ type Dependencies(dependenciesFileName: string) =
783783
failwithf "Could not push package %s due to missing credentials for the url %s. Please specify a NuGet API key via the command line, the environment variable \"nugetkey\", or by using 'paket config add-token'." packageFileName urlWithEndpoint
784784
| Some apiKey ->
785785
let maxTrials = defaultArg maxTrials 5
786+
let ignoreConflicts = defaultArg ignoreConflicts false
786787
RemoteUpload.Push
787788
maxTrials
788789
urlWithEndpoint
789790
apiKey
790791
"4.1.0" // see https://github.com/NuGet/NuGetGallery/issues/4315 - maybe us (defaultArg paketVersion "4.1.0")
791792
packageFileName
793+
ignoreConflicts
792794

793795
/// Lists all paket.template files in the current solution.
794796
member this.ListTemplateFiles() : TemplateFile list =

src/Paket/Commands.fs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ type PushArgs =
592592

593593
| [<Unique>] Endpoint of path:string
594594
| [<Hidden;Unique;CustomCommandLine("endpoint")>] Endpoint_Legacy of path:string
595+
596+
| [<Unique;CustomCommandLine("--ignoreConflicts")>] Ignore_Conflicts
595597
with
596598
interface IArgParserTemplate with
597599
member this.Usage =
@@ -608,6 +610,8 @@ with
608610
| Endpoint(_) -> "API endpoint to push to (default: /api/v2/package)"
609611
| Endpoint_Legacy(_) -> "[obsolete]"
610612

613+
| Ignore_Conflicts -> "Ignore any HTTP409 (Conflict) errors and treat as success"
614+
611615
type GenerateLoadScriptsArgs =
612616
| [<AltCommandLine("-g")>] Group of name:string
613617
| [<Hidden;CustomCommandLine("groups")>] Group_Legacy of name:string list

src/Paket/Program.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,11 +739,13 @@ let push paketVersion (results : ParseResults<_>) =
739739
(results.TryGetResult <@ PushArgs.Api_Key @>,
740740
results.TryGetResult <@ PushArgs.Api_Key_Legacy @>)
741741
|> legacyOption results (ReplaceArgument("--api-key", "apikey"))
742+
let ignoreConflicts = results.Contains <@ PushArgs.Ignore_Conflicts @>
742743

743744
Dependencies.Push(fileName,
744745
?url = url,
745746
?endPoint = endpoint,
746-
?apiKey = apiKey)
747+
?apiKey = apiKey,
748+
ignoreConflicts = ignoreConflicts)
747749

748750
let generateLoadScripts (results : ParseResults<GenerateLoadScriptsArgs>) =
749751
let providedFrameworks =

0 commit comments

Comments
 (0)