Permalink
Browse files

Ask to upgrade OPAM when a new version is available only if OPAM is i…

…nstalled using OPAM itself.

This should fix #297
  • Loading branch information...
1 parent 5cc5143 commit bde42d8f28708eb7e33dd31375702300a043fea8 @samoht samoht committed Nov 15, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/client/opamClient.ml
View
@@ -584,9 +584,11 @@ let check_opam_version () =
let max_version = OpamPackage.Version.Set.max_elt (OpamPackage.versions (Lazy.force t.available_packages) n) in
let max_version = OpamVersion.of_string (OpamPackage.Version.to_string max_version) in
if OpamVersion.compare max_version OpamVersion.current > 0 then (
- if OpamMisc.confirm "Your version of opam (%s) is not up-to-date. Do you want to upgrade to version %s ?"
+ OpamGlobals.warning "Your version of OPAM (%s) is not up-to-date! The latest version is %s."
(OpamVersion.to_string OpamVersion.current)
- (OpamVersion.to_string max_version)
+ (OpamVersion.to_string max_version);
+ if OpamState.mem_installed_package_by_name t n
+ && OpamMisc.confirm "Do you want to upgrade OPAM ?"
then
upgrade (OpamPackage.Name.Set.singleton n)
)

0 comments on commit bde42d8

Please sign in to comment.