From 52a3e9a4ac76129c00b147276900eec9ed756479 Mon Sep 17 00:00:00 2001 From: svkalinin Date: Mon, 28 Nov 2022 16:27:06 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B=20git?= =?UTF-8?q?=20init=20=D0=B8=20git=20config=20(=D0=B7=D0=B0=D1=87=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D0=BA).=20=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=20=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=20=D0=BA=D0=BB?= =?UTF-8?q?=D0=BE=D0=BD=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D1=80=D0=B5=D0=BF=D0=BE=D0=B7=D0=B8=D1=82=D0=BE=D1=80=D0=B8?= =?UTF-8?q?=D1=8F=20(=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D0=A1=D0=BE?= =?UTF-8?q?=D0=B7=D0=B4=D0=B0=D1=82=D1=8C=20=D1=80=D0=B5=D0=BF=D0=BE=D0=B7?= =?UTF-8?q?=D0=B8=D1=82=D0=BE=D1=80=D0=B8=D0=B9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/git.tcl | 53 +++++++++++++++++++++++++++++++++++++++++-- lib/image_library.tcl | 16 +++++++++++++ lib/msgs/ru.msg | 2 ++ 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/lib/git.tcl b/lib/git.tcl index 2c3ed63..7b307bf 100644 --- a/lib/git.tcl +++ b/lib/git.tcl @@ -249,6 +249,10 @@ namespace eval Git { # puts "$cmd" catch $cmd pipe puts $pipe + if [regexp -nocase -- {^fatal:} $pipe match] { + ShowMessage "Command: '$cmd' error" $pipe + return + } foreach line [split $pipe "\n"] { # puts "$line" lappend res $line @@ -395,6 +399,40 @@ namespace eval Git { puts $pipe return } + proc Config {repo user email} { + global activeProject cfgVariables + # puts $values + set cmd exec + lappend cmd $cfgVariables(gitCommand) + lappend cmd "config" + lappend cmd $repo + lappend cmd $dir + puts $cmd + + # catch $cmd pipe + # puts $pipe + return + } + proc Init {} { + global activeProject cfgVariables + # puts $values + if [file isdirectory $activeProject] { + cd $activeProject + } else { + return false + } + set cmd exec + lappend cmd $cfgVariables(gitCommand) + lappend cmd "init" + lappend cmd $activeProject + puts $cmd + + catch $cmd pipe + if [regexp -nocase -- {^fatal:} $pipe match] { + ShowMessage "Command: '$cmd' error" $pipe + return + } + } proc Key {k fr} { # puts [Editor::Key $k] @@ -582,6 +620,7 @@ namespace eval Git { } proc CloneDialog {} { + global activeProject set win .clone set x [winfo rootx .frmWork] set y [winfo rooty .frmWork] @@ -618,10 +657,20 @@ namespace eval Git { ReadFilesFromDirectory $repoDir $repoDir destroy .clone } + + ttk::button $win.btnInit -compound left -image new_20x20 \ + -text [::msgcat::mc "Init repository"] -command { + Git::Init + FileOper::ReadFolder $activeProject + ReadFilesFromDirectory $activeProject $activeProject + destroy .clone + } + grid $win.entUrl -row 0 -column 0 -columnspan 2 -sticky new grid $win.entFolder -row 1 -column 0 -sticky new - grid $win.btnFolder -row 1 -column 1 -sticky e + grid $win.btnFolder -row 1 -column 1 -sticky ew grid $win.btnClone -row 2 -column 0 -columnspan 2 -sticky new + grid $win.btnInit -row 3 -column 0 -columnspan 2 -sticky new bind $win "destroy $win" @@ -649,7 +698,7 @@ namespace eval Git { } return } - if {[info exists activeProject] == 0} { + if {[info exists activeProject] == 0 || [file exists [file join $activeProject .git]] == 0} { Git::CloneDialog return } diff --git a/lib/image_library.tcl b/lib/image_library.tcl index 9fc6812..5de3ed7 100644 --- a/lib/image_library.tcl +++ b/lib/image_library.tcl @@ -1279,3 +1279,19 @@ image create photo folder_24x24 -data { LAKAPM8XA7qug+d5mAX4vh9qrdE0zUHXMgiCDz7d6QFxMQfU9aCtgH8EIIRo1xU8OgVYa43rCp7+ IuE4js+zT0Vd12dSymtK6UET3ff93fqP76VXznxN1iafwLQAAAAASUVORK5CYII= } +image create photo new_20x20 -data { + iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9 + kT1Iw0AcxV9TtVoqDlYQcchQHcSCqIijVqEIFUKt0KqDyaUfQpOGJMXFUXAtOPixWHVwcdbVwVUQ + BD9AHJ2cFF2kxP8lhRaxHhz34929x907QKgWmWa1jQGabpvJeExMZ1bEwCuC6EMXRtAhM8uYlaQE + Wo6ve/j4ehflWa3P/Tm61azFAJ9IPMMM0yZeJ57atA3O+8RhVpBV4nPiUZMuSPzIdcXjN855lwWe + GTZTyTniMLGYb2KliVnB1IgniSOqplO+kPZY5bzFWSuWWf2e/IWhrL68xHWag4hjAYuQIEJBGRso + wkaUVp0UC0naj7XwD7h+iVwKuTbAyDGPEjTIrh/8D353a+Umxr2kUAxof3GcjyEgsAvUKo7zfew4 + tRPA/wxc6Q1/qQpMf5JeaWiRI6BnG7i4bmjKHnC5A/Q/GbIpu5KfppDLAe9n9E0ZoPcWCK56vdX3 + cfoApKirxA1wcAgM5yl7rcW7O5t7+/dMvb8fS2tyl3d3iOIAAAAGYktHRAD/AP8A/6C9p5MAAAAJ + cEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfmChUJLAVnNEmdAAABEElEQVQ4y+2TsUoEMRRFz5sd + MwvaiD+xja0g+gnTz/b2NhZ+hY2dfyBMm6+wslCbbSSVIGy9EyZ5NhsYxB3jKmLhhRQhh5v3cl/g + X78ia+3cWjvPYcscSFXPQwhT4B5YAGETW2QWKX3f7wFHwM4YmGuIqspnZl8yzJV8FECM8UJEhmcz + VS299y/GmKWIRFXVoiiu6rq+HQ1FVTWEMA0h7KYLjTGlqkqMsfTe7yfOOXcKPAJPKSjZUPkMOE5v + 1rbtZYyxbJrmBlgCccDeAQ9APzY2C+A5baqqOuu67gB4BVpgNWD7ZDZmGIazJiIR0HVlq3eGW6Ws + 6/UzP0VErp1zJ1uNzYgOgckwgO9qktvR39YbIoJqCGWh7C4AAAAASUVORK5CYII= +} diff --git a/lib/msgs/ru.msg b/lib/msgs/ru.msg index efa8601..9804e38 100644 --- a/lib/msgs/ru.msg +++ b/lib/msgs/ru.msg @@ -32,6 +32,7 @@ ::msgcat::mcset ru "Comments" "Коментарии" ::msgcat::mcset ru "Comment selected" "Закоментировать" ::msgcat::mcset ru "Uncomment selected" "Раскоментировать" +::msgcat::mcset ru "Clone repository" "Клонировать репозиторий" ::msgcat::mcset ru "Column" "Столбец" ::msgcat::mcset ru "Commit" "Коммита" ::msgcat::mcset ru "Commit description" "Описание коммита" @@ -103,6 +104,7 @@ ::msgcat::mcset ru "Image dir" "Каталог изображений" ::msgcat::mcset ru "Indent foreground" "Подсветка отступа" ::msgcat::mcset ru "Indent background" "Подсветка отступа" +::msgcat::mcset ru "Init repository" "Создать репозиторий" ::msgcat::mcset ru "Insert" "Вставка" ::msgcat::mcset ru "In" "В" ::msgcat::mcset ru "Insert image" "Вставить изображение"