Skip to content

Commit

Permalink
Merge pull request #2720 from gdziadkiewicz/Add_paket_push_ignoreConf…
Browse files Browse the repository at this point in the history
…licts

Add ignoreConflicts parameter to paket push
  • Loading branch information
yazeedobaid authored Dec 21, 2022
2 parents 30702ba + 7531ac8 commit 4b53a2d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/app/Fake.DotNet.Paket/Paket.fs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ module Paket =

/// API key for the URL (default: value of the NUGET_KEY environment variable)
ApiKey: string

/// Ignore any HTTP409 (Conflict) errors and treat as success (default: false)
IgnoreConflicts: bool
}

/// Paket push default parameters
Expand All @@ -143,7 +146,8 @@ module Paket =
EndPoint = null
WorkingDir = "./temp"
DegreeOfParallelism = 8
ApiKey = null }
ApiKey = null
IgnoreConflicts = false }

/// <summary>
/// Paket restore packages type
Expand Down Expand Up @@ -206,6 +210,7 @@ module Paket =
|> Arguments.appendNotEmpty "--url" parameters.PublishUrl
|> Arguments.appendNotEmpty "--endpoint" parameters.EndPoint
|> Arguments.appendNotEmpty "--api-key" parameters.ApiKey
|> Arguments.appendIf parameters.IgnoreConflicts "--ignoreConflicts"
|> Arguments.append [ file ]
|> startPaket parameters.ToolType parameters.ToolPath parameters.WorkingDir parameters.TimeOut
| Pack parameters ->
Expand Down
18 changes: 17 additions & 1 deletion src/test/Fake.Core.UnitTests/Fake.DotNet.Paket.fs
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,20 @@ let tests =

let cmd = args |> Arguments.toStartInfo
Expect.stringContains (file.ToLower()) "paket" "Expected paket"
Expect.equal cmd "push testfile" "expected push command line" ]
Expect.equal cmd "push testfile" "expected push command line"
testCase "Test push --ignoreConflicts is not missing"
<| fun _ ->
let cp =
Paket.createProcess (
Paket.StartType.PushFile({ Paket.PaketPushDefaults() with IgnoreConflicts = true }, "testfile")
)

let file, args =
match cp.Command with
| RawCommand (file, args) -> file, args
| _ -> failwithf "expected RawCommand"
|> ArgumentHelper.checkIfMono

let cmd = args |> Arguments.toStartInfo
Expect.stringContains (file.ToLower()) "paket" "Expected paket"
Expect.equal cmd "push --ignoreConflicts testfile" "expected push command line" ]

0 comments on commit 4b53a2d

Please sign in to comment.