From 28521763a9630a6fd83db9c7484d64f89a3ba3eb Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Thu, 19 Jan 2017 21:12:01 +0100 Subject: [PATCH] e2-fetch-sources: plugins handle fetch & update - remove WC checks Signed-off-by: Tobias Ulmer --- local/e2-fetch-sources.lua | 40 +++++++++++++------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/local/e2-fetch-sources.lua b/local/e2-fetch-sources.lua index 5381d9b..204e221 100644 --- a/local/e2-fetch-sources.lua +++ b/local/e2-fetch-sources.lua @@ -113,50 +113,38 @@ local function e2_fetch_source(arg) -- @return bool -- @return nil, an error string on error local function fetch_sources(info, opts, sel) - local rc1 = true -- global return code - local nfail = 0 -- failure counter + local rc, re + local nfail local e = err.new() -- no message yet, append the summary later on -- fetch for sourcename, _ in pairs(source.sources) do - local has_wc = scm.has_working_copy(info, sourcename) - local wc_avail = scm.working_copy_available(info, sourcename) if opts.fetch and sel[sourcename] then - if wc_avail then - e2lib.logf(1, - "working copy for %s is already available", sourcename) - else - e2lib.logf(1, "fetching working copy for source %s", sourcename) - local rc, re = scm.fetch_source(info, sourcename) - if not rc then - e:cat(re) - end + e2lib.logf(1, "fetching working copy for source %s", sourcename) + rc, re = scm.fetch_source(info, sourcename) + if not rc then + e:cat(re) end end end -- update for sourcename, _ in pairs(source.sources) do - local has_wc = scm.has_working_copy(info, sourcename) - local wc_avail = scm.working_copy_available(info, sourcename) - if opts.update and has_wc and sel[sourcename] then - if not wc_avail then - e2lib.logf(1, "working copy for %s is not available", sourcename) - else - e2lib.logf(1, "updating working copy for %s", sourcename) - local rc, re = scm.update(info, sourcename) - if not rc then - e:cat(re) - end + if opts.update and sel[sourcename] then + e2lib.logf(1, "updating working copy for %s", sourcename) + rc, re = scm.update(info, sourcename) + if not rc then + e:cat(re) end end end - local nfail = e:getcount() + + nfail = e:getcount() if nfail > 0 then e:append("There were errors fetching %d sources", nfail) return false, e end - return true, nil + return true end local sel = {} -- selected sources -- 2.39.5