lib/git_cli.rb in git_cli-0.8.0 vs lib/git_cli.rb in git_cli-0.9.0
- old
+ new
@@ -116,17 +116,25 @@
include GitCli::Log
include GitCli::Tags
include GitCli::Repos
include GitCli::Stash
+ include TR::CondUtils
+
attr_accessor :repos
- def initialize(vcs, path)
+ def initialize(path, vcs = nil)
- raise_if_empty(vcs , "VCS cannot be empty", GitCliException)
+ #raise_if_empty(vcs , "VCS cannot be empty", GitCliException)
raise_if_empty(path, "Workspace path cannot be empty", GitCliException)
-
- @vcs = vcs
+
+ if is_empty?(vcs)
+ @vcs = Gvcs::Vcs.new
+ else
+ @vcs = vcs
+ end
+
+ #@vcs = vcs
@givenPath = path
@wsPath = File.expand_path(@givenPath)
@repos = []
@@ -149,22 +157,30 @@
raise_if_empty(@repos, "Repositories should not be empty", GitCliException)
end # check_repos
def is_repos_exist?(name)
found = false
+ load_remote_to_repos
@repos.each do |re|
if re.name == name
found = true
break
end
end
found
end # is_repos_exist?
def is_workspace?
- st, res = status
- st
+ begin
+ status
+ true
+ rescue GitDeltaError => ex
+ log_debug ex.message
+ false
+ end
+ #st, res = status
+ #st
end
def workspace_root
if (@wsRoot.nil? or (@wsRoot[0] == false))
@@ -193,10 +209,20 @@
@wsRoot
end # workspace_root
+ def load_remote_to_repos
+ conf = remote_config
+ conf.each do |k,v|
+ repo = Gvcs::Repository.new(k, v.values.first)
+ repo.support_fetch if v.keys.include?("fetch")
+ repo.support_push if v.keys.include?("push")
+ add_repos(repo)
+ end
+ end
+
end # Gvcs::Workspace
class Gvcs::Repository
@@ -206,13 +232,30 @@
def initialize(name, url) #, branches = [])
@name = name
@url = url
#@branches = branches
@sslVerify = true
+
+ @fetch = false
+ @push = false
end
def ssl_verify(bool)
@sslVerify = bool
+ end
+
+ def support_fetch
+ @fetch = true
+ end
+ def is_fetch_supported?
+ @fetch
+ end
+
+ def support_push
+ @push = true
+ end
+ def is_push_supported?
+ @push
end
end # repository
end