Skip to content

Commit

Permalink
Project.save with forceTouch=true to only touch last-write-date inste…
Browse files Browse the repository at this point in the history
…ad of content if unchanged
  • Loading branch information
cdrnet committed Mar 1, 2016
1 parent 933c9b9 commit a9b6eca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Paket.Core/FindReferences.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ let TouchReferencesOfPackages packages environment = trial {
|> List.distinctBy (fun project-> project.FileName)
|> List.iter (fun project ->
verbosefn "Touching project %s" project.FileName
ProjectFile.touch project)
ProjectFile.save true project)
}

let ShowReferencesFor packages environment = trial {
Expand Down
11 changes: 2 additions & 9 deletions src/Paket.Core/ProjectFile.fs
Original file line number Diff line number Diff line change
Expand Up @@ -942,16 +942,11 @@ module ProjectFile =
)

let save forceTouch project =
if forceTouch then
project.Document.Save(project.FileName)
elif Utils.normalizeXml project.Document <> project.OriginalText then
if Utils.normalizeXml project.Document <> project.OriginalText || not (File.Exists(project.FileName)) then
verbosefn "Project %s changed" project.FileName
project.Document.Save(project.FileName)

let touch (project:ProjectFile) =
if File.Exists(project.FileName) then
elif forceTouch then
File.SetLastWriteTimeUtc(project.FileName, DateTime.UtcNow)
else save true project

let getPaketFileItems project =
findPaketNodes "Content" project
Expand Down Expand Up @@ -1310,8 +1305,6 @@ type ProjectFile with

member this.UpdateReferences (completeModel, usedPackages, hard) = ProjectFile.updateReferences completeModel usedPackages hard this

member this.Touch () = ProjectFile.touch this

member this.Save(forceTouch) = ProjectFile.save forceTouch this

member this.GetPaketFileItems () = ProjectFile.getPaketFileItems this
Expand Down

0 comments on commit a9b6eca

Please sign in to comment.