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" "Вставить изображение"