diff options
| author | Joey Hess <joey@kitenet.net> | 2014-08-19 19:22:54 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-08-19 19:22:54 -0400 |
| commit | ceb56ac32b777fd0949af94bc41ea749f93552ef (patch) | |
| tree | c5a81364850a4775650315b69ccc4c1d25d3e41e /src | |
| parent | 81544b37a8d4b50c920bab551c1ba16cd54c4a62 (diff) | |
keep warning of out of date after updating upstream/master, until it gets merged
Diffstat (limited to 'src')
| -rw-r--r-- | src/wrapper.hs | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/wrapper.hs b/src/wrapper.hs index 106591fc..304e833d 100644 --- a/src/wrapper.hs +++ b/src/wrapper.hs @@ -82,8 +82,13 @@ wrapper args propellordir propellorbin = do headknown <- catchMaybeIO $ withQuietOutput createProcessSuccess $ proc "git" ["log", headrev] - when (headknown == Nothing) $ - setupupstreammaster headrev propellordir + if (headknown == Nothing) + then setupupstreammaster headrev propellordir + else do + merged <- not . null <$> + readProcess "git" ["log", headrev ++ "..HEAD", "--ancestry-path"] + unless merged $ + warnoutofdate propellordir True buildruncfg = do changeWorkingDirectory propellordir ifM (boolSystem "make" [Param "build"]) @@ -117,7 +122,7 @@ setupupstreammaster newref propellordir = do changeWorkingDirectory propellordir go =<< catchMaybeIO getoldrev where - go Nothing = warnoutofdate False + go Nothing = warnoutofdate propellordir False go (Just oldref) = do let tmprepo = ".git/propellordisttmp" let cleantmprepo = void $ catchMaybeIO $ removeDirectoryRecursive tmprepo @@ -131,7 +136,7 @@ setupupstreammaster newref propellordir = do fetchUpstreamBranch propellordir tmprepo cleantmprepo - warnoutofdate True + warnoutofdate propellordir True getoldrev = takeWhile (/= '\n') <$> readProcess "git" ["show-ref", upstreambranch, "--hash"] @@ -139,15 +144,16 @@ setupupstreammaster newref propellordir = do git = run "git" run cmd ps = unlessM (boolSystem cmd (map Param ps)) $ error $ "Failed to run " ++ cmd ++ " " ++ show ps - - warnoutofdate havebranch = do - warningMessage ("** Your " ++ propellordir ++ " is out of date..") - let also s = hPutStrLn stderr (" " ++ s) - also ("A newer upstream version is available in " ++ distrepo) - if havebranch - then also ("To merge it, run: git merge " ++ upstreambranch) - else also ("To merge it, find the most recent commit in your repository's history that corresponds to an upstream release of propellor, and set refs/remotes/" ++ upstreambranch ++ " to it. Then run propellor again.") - also "" + +warnoutofdate :: FilePath -> Bool -> IO () +warnoutofdate propellordir havebranch = do + warningMessage ("** Your " ++ propellordir ++ " is out of date..") + let also s = hPutStrLn stderr (" " ++ s) + also ("A newer upstream version is available in " ++ distrepo) + if havebranch + then also ("To merge it, run: git merge " ++ upstreambranch) + else also ("To merge it, find the most recent commit in your repository's history that corresponds to an upstream release of propellor, and set refs/remotes/" ++ upstreambranch ++ " to it. Then run propellor again.") + also "" fetchUpstreamBranch :: FilePath -> FilePath -> IO () fetchUpstreamBranch propellordir repo = do |
