From: Tobias Ulmer Date: Fri, 13 Jan 2017 16:25:01 +0000 (+0100) Subject: source plugins: transition has_working_copy() from scm interface to source class X-Git-Tag: e2factory-2.3.16~1 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=faf4c589a00a86a0195388132ba50937a4e1b1fc;p=e2factory.git source plugins: transition has_working_copy() from scm interface to source class Signed-off-by: Tobias Ulmer --- diff --git a/plugins/cvs.lua b/plugins/cvs.lua index ab2651e..a23d1bf 100644 --- a/plugins/cvs.lua +++ b/plugins/cvs.lua @@ -264,6 +264,10 @@ function cvs.cvs_source:display() return d end +function cvs.cvs_source:has_working_copy() + return true +end + --- Build the cvsroot string. -- @param info Info table. -- @param sourcename Source name. @@ -410,7 +414,7 @@ function cvs.working_copy_available(info, sourcename) end function cvs.has_working_copy(info, sourcename) - return true + return source.sources[sourcename]:has_working_copy() end function cvs.toresult(info, sourcename, sourceset, directory) diff --git a/plugins/files.lua b/plugins/files.lua index 651dcd7..2dc029a 100644 --- a/plugins/files.lua +++ b/plugins/files.lua @@ -278,6 +278,10 @@ function files.files_source:display() return d end +function files.files_source:has_working_copy() + return false +end + --- cache files for a source -- @param info the info structure -- @param sourcename name of the source @@ -317,7 +321,7 @@ function files.working_copy_available(info, sourcename) end function files.has_working_copy(info, sourcename) - return false + return source.sources[sourcename]:has_working_copy() end --- Handle file:copy() in a way that appears intuitive to the user. Returns diff --git a/plugins/git.lua b/plugins/git.lua index 949f80a..f168be1 100644 --- a/plugins/git.lua +++ b/plugins/git.lua @@ -256,6 +256,10 @@ function git.git_source:display() return d end +function git.git_source:has_working_copy() + return true +end + --- Return the git commit ID of the specified source configuration. Specific to -- sources of type git, useful for writing plugins. -- @param info Info table. @@ -613,8 +617,8 @@ function git.working_copy_available(info, sourcename) return true end -function git.has_working_copy(info, sname) - return true +function git.has_working_copy(info, sourcename) + return source.sources[sourcename]:has_working_copy() end --- turn server:location into a git-style url diff --git a/plugins/gitrepo.lua b/plugins/gitrepo.lua index 8334697..977d14e 100644 --- a/plugins/gitrepo.lua +++ b/plugins/gitrepo.lua @@ -205,6 +205,10 @@ function gitrepo_source:display() return d end +function gitrepo_source:has_working_copy() + return true +end + -------------------------------------------------------------------------------- --- Check if a working copy for a git repository is available @@ -229,7 +233,7 @@ end function gitrepo.has_working_copy(info, sourcename) assertIsTable(info) assertIsStringN(sourcename) - return true + return source.sources[sourcename]:has_working_copy() end --- Fetch a gitrepo source. Adapted from git plugin. diff --git a/plugins/svn.lua b/plugins/svn.lua index eafe469..fb10abc 100644 --- a/plugins/svn.lua +++ b/plugins/svn.lua @@ -350,6 +350,10 @@ function svn.svn_source:display() return d end +function svn.svn_source:has_working_copy() + return true +end + function svn.fetch_source(info, sourcename) local rc, re local e = err.new("fetching source failed: %s", sourcename) @@ -452,8 +456,8 @@ function svn.check_workingcopy(info, sourcename) return true end -function svn.has_working_copy(info, sname) - return true +function svn.has_working_copy(info, sourcename) + return source.sources[sourcename]:has_working_copy() end function svn.toresult(info, sourcename, sourceset, directory)