Добавлены команды git init и git config (зачаток). Изменен диалог клонирования репозитория (добавлена кнопка Создать репозиторий)

This commit is contained in:
svkalinin 2022-11-28 16:27:06 +03:00
parent b10b1802a5
commit 52a3e9a4ac
3 changed files with 69 additions and 2 deletions

View File

@ -249,6 +249,10 @@ namespace eval Git {
# puts "$cmd" # puts "$cmd"
catch $cmd pipe catch $cmd pipe
puts $pipe puts $pipe
if [regexp -nocase -- {^fatal:} $pipe match] {
ShowMessage "Command: '$cmd' error" $pipe
return
}
foreach line [split $pipe "\n"] { foreach line [split $pipe "\n"] {
# puts "$line" # puts "$line"
lappend res $line lappend res $line
@ -395,6 +399,40 @@ namespace eval Git {
puts $pipe puts $pipe
return 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} { proc Key {k fr} {
# puts [Editor::Key $k] # puts [Editor::Key $k]
@ -582,6 +620,7 @@ namespace eval Git {
} }
proc CloneDialog {} { proc CloneDialog {} {
global activeProject
set win .clone set win .clone
set x [winfo rootx .frmWork] set x [winfo rootx .frmWork]
set y [winfo rooty .frmWork] set y [winfo rooty .frmWork]
@ -618,10 +657,20 @@ namespace eval Git {
ReadFilesFromDirectory $repoDir $repoDir ReadFilesFromDirectory $repoDir $repoDir
destroy .clone 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.entUrl -row 0 -column 0 -columnspan 2 -sticky new
grid $win.entFolder -row 1 -column 0 -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.btnClone -row 2 -column 0 -columnspan 2 -sticky new
grid $win.btnInit -row 3 -column 0 -columnspan 2 -sticky new
bind $win <Escape> "destroy $win" bind $win <Escape> "destroy $win"
@ -649,7 +698,7 @@ namespace eval Git {
} }
return return
} }
if {[info exists activeProject] == 0} { if {[info exists activeProject] == 0 || [file exists [file join $activeProject .git]] == 0} {
Git::CloneDialog Git::CloneDialog
return return
} }

View File

@ -1279,3 +1279,19 @@ image create photo folder_24x24 -data {
LAKAPM8XA7qug+d5mAX4vh9qrdE0zUHXMgiCDz7d6QFxMQfU9aCtgH8EIIRo1xU8OgVYa43rCp7+ LAKAPM8XA7qug+d5mAX4vh9qrdE0zUHXMgiCDz7d6QFxMQfU9aCtgH8EIIRo1xU8OgVYa43rCp7+
IuE4js+zT0Vd12dSymtK6UET3ff93fqP76VXznxN1iafwLQAAAAASUVORK5CYII= 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=
}

View File

@ -32,6 +32,7 @@
::msgcat::mcset ru "Comments" "Коментарии" ::msgcat::mcset ru "Comments" "Коментарии"
::msgcat::mcset ru "Comment selected" "Закоментировать" ::msgcat::mcset ru "Comment selected" "Закоментировать"
::msgcat::mcset ru "Uncomment selected" "Раскоментировать" ::msgcat::mcset ru "Uncomment selected" "Раскоментировать"
::msgcat::mcset ru "Clone repository" "Клонировать репозиторий"
::msgcat::mcset ru "Column" "Столбец" ::msgcat::mcset ru "Column" "Столбец"
::msgcat::mcset ru "Commit" "Коммита" ::msgcat::mcset ru "Commit" "Коммита"
::msgcat::mcset ru "Commit description" "Описание коммита" ::msgcat::mcset ru "Commit description" "Описание коммита"
@ -103,6 +104,7 @@
::msgcat::mcset ru "Image dir" "Каталог изображений" ::msgcat::mcset ru "Image dir" "Каталог изображений"
::msgcat::mcset ru "Indent foreground" "Подсветка отступа" ::msgcat::mcset ru "Indent foreground" "Подсветка отступа"
::msgcat::mcset ru "Indent background" "Подсветка отступа" ::msgcat::mcset ru "Indent background" "Подсветка отступа"
::msgcat::mcset ru "Init repository" "Создать репозиторий"
::msgcat::mcset ru "Insert" "Вставка" ::msgcat::mcset ru "Insert" "Вставка"
::msgcat::mcset ru "In" "В" ::msgcat::mcset ru "In" "В"
::msgcat::mcset ru "Insert image" "Вставить изображение" ::msgcat::mcset ru "Insert image" "Вставить изображение"