login
Header Space

 
 

Re: git-gui Error

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Shawn O. Pearce <spearce@...>
Cc: <git@...>
Date: Wednesday, February 14, 2007 - 1:46 pm

On Wed, Feb 14, 2007 at 01:00:41AM -0500, Shawn O. Pearce wrote:

I'm missing the possibility to base a new branch on a tag.
The following adds a tag drop down to the new branch dialog:

--- git-gui.sh  2007-02-14 08:51:38.025781229 +0000
+++ git-gui     2007-02-14 10:50:13.618870598 +0000
@@ -1916,11 +1916,25 @@
        return [lsort -unique $all_trackings]
 }

+proc load_all_tags {} {
+       set all_tags [list]
+       set fd [open "| git for-each-ref --format=%(refname) refs/tags" r]
+       while {[gets $fd line] > 0} {
+               if {![regsub ^refs/tags/ $line {} name]} continue
+               lappend all_tags $name
+       }
+       close $fd
+
+       return [lsort $all_tags]
+}
+
+
 proc do_create_branch_action {w} {
        global all_heads null_sha1 repo_config
        global create_branch_checkout create_branch_revtype
        global create_branch_head create_branch_trackinghead
        global create_branch_name create_branch_revexp
+        global create_branch_tag

        set newbranch $create_branch_name
        if {$newbranch eq {}
@@ -1959,6 +1973,7 @@
        switch -- $create_branch_revtype {
        head {set rev $create_branch_head}
        tracking {set rev $create_branch_trackinghead}
+       tag {set rev $create_branch_tag}
        expression {set rev $create_branch_revexp}
        }
        if {[catch {set cmt [git rev-parse --verify "${rev}^0"]}]} {
@@ -2015,6 +2030,7 @@
        global create_branch_checkout create_branch_revtype
        global create_branch_head create_branch_trackinghead
        global create_branch_name create_branch_revexp
+        global create_branch_tag

        set w .branch_editor
        toplevel $w
@@ -2078,6 +2094,19 @@
                        $all_trackings
                grid $w.from.tracking_r $w.from.tracking_m -sticky w
        }
+       set all_tags [load_all_tags]
+       if {$all_tags ne {}} {
+               set create_branch_tag [lindex $all_tags 0]
+               radiobutton $w.from.tag_r \
+                       -text {Tag:} \
+                       -value tag \
+                       -variable create_branch_revtype \
+                       -font font_ui
+               eval tk_optionMenu $w.from.tag_m \
+                       create_branch_tag \
+                       $all_tags
+               grid $w.from.tag_r $w.from.tag_m -sticky w
+       }
        radiobutton $w.from.exp_r \
                -text {Revision Expression:} \
                -value expression \

mfg Martin K
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
git-gui Error, Martin Koegler, (Tue Feb 13, 2:56 am)
Re: git-gui Error, Shawn O. Pearce, (Tue Feb 13, 3:45 am)
Re: git-gui Error, Martin Koegler, (Tue Feb 13, 5:53 pm)
Re: git-gui Error, Shawn O. Pearce, (Tue Feb 13, 10:22 pm)
Re: git-gui Error, Martin Koegler, (Wed Feb 14, 2:09 pm)
Re: git-gui Error, Shawn O. Pearce, (Thu Feb 15, 12:07 am)
Re: git-gui Error, Shawn O. Pearce, (Wed Feb 14, 2:00 am)
Re: git-gui Error, Martin Koegler, (Wed Feb 14, 1:46 pm)
Re: git-gui Error, Shawn O. Pearce, (Wed Feb 14, 10:40 pm)
Re: git-gui Error, Martin Koegler, (Thu Feb 15, 2:07 am)
Re: git-gui Error, Shawn O. Pearce, (Thu Feb 15, 2:38 am)
speck-geostationary