From ac92335ba53ce36eb0955567dd65dae03e2924e4 Mon Sep 17 00:00:00 2001 From: svkalinin Date: Fri, 18 Nov 2022 12:40:00 +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=D0=B0=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D0=B0=20Git?= =?UTF-8?q?::Reset=20(git=20reset=20=5Ffile=5F)=20=D0=BD=D0=B0=20=D0=BA?= =?UTF-8?q?=D0=BD=D0=BE=D0=BF=D0=BA=D0=B5=20=D0=B2=20=D0=B4=D0=B8=D0=B0?= =?UTF-8?q?=D0=BB=D0=BE=D0=B3=D0=B5.=20=D0=94=D0=BB=D1=8F=20=D0=BE=D1=82?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=8B=20'git=20add'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/git.tcl | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/git.tcl b/lib/git.tcl index 675ad65..9f2af56 100644 --- a/lib/git.tcl +++ b/lib/git.tcl @@ -169,6 +169,7 @@ namespace eval Git { append cmd " $cfgVariables(gitCommand)" append cmd " commit" append cmd " -m" + regsub -all {\"|\'} $description {'} description append cmd " \"$description\"" append cmd " --" foreach item [$listBox get 0 [$listBox size]] { @@ -183,6 +184,7 @@ namespace eval Git { } } else { puts $cmd + puts $description catch $cmd pipe puts $pipe if [regexp -nocase -- {^fatal:} $pipe match] { @@ -258,7 +260,28 @@ namespace eval Git { return $res } - # git show --pretty=format:"%h;%ad;%s" + proc Reset {w} { + global activeProject cfgVariables + # puts $values + set selectedItems [$w.body.lCommit curselection] + if {$selectedItems eq ""} {return} + set cmd exec + lappend cmd $cfgVariables(gitCommand) + lappend cmd "reset" + foreach itemNumber [lsort -integer -increasing $selectedItems] { + set fileName [$w.body.lCommit get $itemNumber] + $w.body.lBox insert end $fileName + lappend cmd [file join $activeProject $fileName] + } + foreach itemNumber [lsort -integer -decreasing $selectedItems] { + $w.body.lCommit delete $itemNumber + } + catch $cmd pipe + puts $cmd + $w.body.t delete 1.0 end + } + +# git show --pretty=format:"%h;%ad;%s" proc Show {w} { global cfgVariables activeProject set commitString [$w.body.lLog get [$w.body.lLog curselection]] @@ -562,7 +585,8 @@ namespace eval Git { ttk::button $fr.body.bAdd -image forward_20x20 -compound center \ -command "Git::CommitAdd $fr" - ttk::button $fr.body.bRemove -compound center -image backward_20x20 + ttk::button $fr.body.bRemove -compound center -image backward_20x20 \ + -command "Git::Reset $fr" ttk::label $fr.body.lblCommitText -padding {3 3} \ -text "[::msgcat::mc "Commit description"]:"