From: Nishi Date: Wed, 2 Oct 2024 08:21:51 +0000 (+0000) Subject: add git component X-Git-Url: https://git.chaotic.ninja/gitweb/nishi/?a=commitdiff_plain;h=29ac79871b8ad8da04e3e2ea99b26e07c41d8f39;p=koakuma.git add git component git-svn-id: file:///raid/svn-personal/koakuma/trunk@26 219d0f9c-2d94-d447-890a-813e76b88fe9 --- diff --git a/Component/vcs_git.tcl b/Component/vcs_git.tcl new file mode 100644 index 0000000..a182723 --- /dev/null +++ b/Component/vcs_git.tcl @@ -0,0 +1,35 @@ +# $Id$ +lappend components "Git" "Git Integration" "1.00" "VCS" + +proc Git_info {} { + regexp {[0-9]+\.[0-9]+\.[0-9]+} "[exec git --version]" version + add_toc2 "Git" + tputs "" + tputs " " + tputs " " + tputs " " + tputs " " + tputs "
" + tputs " Version" + tputs " " + tputs " $version" + tputs "
" +} + +proc Git_repository {url ws} { + if { [file exists "$ws"] } { + set old "[pwd]" + cd "$ws" + if { [catch {exec git pull >@stdout 2>@1}] } { + cd "$old" + return 1 + } + cd "$old" + return 0 + } else { + if { [catch {exec git clone --recursive "$url" "$ws" >@stdout 2>@1}] } { + return 1 + } + return 0 + } +}