]> Git repositories of Nishi - koakuma.git/commitdiff
add git component
authorNishi <nishi@nishi.boats>
Wed, 2 Oct 2024 08:21:51 +0000 (08:21 +0000)
committerNishi <nishi@nishi.boats>
Wed, 2 Oct 2024 08:21:51 +0000 (08:21 +0000)
git-svn-id: file:///raid/svn-personal/koakuma/trunk@26 219d0f9c-2d94-d447-890a-813e76b88fe9

Component/vcs_git.tcl [new file with mode: 0644]

diff --git a/Component/vcs_git.tcl b/Component/vcs_git.tcl
new file mode 100644 (file)
index 0000000..a182723
--- /dev/null
@@ -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   "<table border=\"0\">"
+       tputs   "       <tr>"
+       tputs   "               <th>"
+       tputs   "                       Version"
+       tputs   "               </th>"
+       tputs   "               <td>"
+       tputs   "                       $version"
+       tputs   "               </td>"
+       tputs   "       </tr>"
+       tputs   "</table>"
+}
+
+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
+       }
+}