]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/auxiliar/lily-git.tcl
translation-status.py: Use factory for [Un]TranslatedTely.
[lilypond.git] / scripts / auxiliar / lily-git.tcl
index 02f1040caf629f09f2bb64ed26af0da9c43d8c6b..966ae823c7bb3c7be9a5ee4037de464f72e96222 100755 (executable)
@@ -1,14 +1,18 @@
 #!/usr/bin/wish
 
 # GUI interface for common LilyPond git repository commands
-# Copyright 2009 by Johannes Schindelin and Carl Sorensen
+# Copyright 2009--2010 by Johannes Schindelin and Carl Sorensen
 #
 
-set version 0.59
+set version 0.64
 
 # set to 1 to set up for translation, to 0 for other
 set translator 0
 
+# location of lilypond git
+set lily_dir $env(HOME)/lilypond-git
+
+
 if {$translator == 1} {
         set windowTitle \
           "LilyPond Translator's Git Interface version $version"
@@ -26,9 +30,46 @@ if {$translator == 1} {
 }
 package require Tk
 
+
+##  Entry limit routine from jeff at hobbs org, downloaded from
+##  http://www.purl.org/net/hobbs/tcl/tclet/entrylimit.html
+
+## For those who aren't using Tk4 with these, make a bell noop:
+if [string match {} [info commands bell]] { proc bell args {} }
+
+proc forceLen {len name el op} {
+    global $name ${name}_len
+    if [string comp $el {}] {
+        set old  ${name}_len\($el)
+        set name $name\($el)
+    } else { set old ${name}_len }
+    if {[string length [set $name]] > $len} {
+        set $name [set $old]
+        bell; return
+    }
+    set $old [set $name]
+}
+
+## Here is a wish example to use the routines.  Remember that with
+## write traces, a valid value must be set for each variable both
+## before AND after the trace is established.
+
+## The order must be:
+## 1) variable init
+## 1) textvariable specification
+## 3) set trace
+## 4) variable reinit
+
+set commit_header {}
+trace variable commit_header w {forceLen 50}
+set commit_header {}
+
+
+## End of entry limit code
+
+
 # Helper functions
 
-set lily_dir $env(HOME)/lilypond
 if {[file exists $lily_dir]} {
        cd $lily_dir
 }
@@ -103,15 +144,13 @@ proc commit {} {
     } else {
       git commit -a -m $commit_message
       git rebase --whitespace=fix HEAD^
-    set commit_message ""
+      set commit_message ""
     }
   }
 }
 
-# This won't work, because --amend needs an editor
-#  lilyconfig users are on their own.
 proc commit_amend {} {
-  git commit -a --amend
+  git commit -a --amend -C HEAD
   git rebase --whitespace=fix HEAD^
 }
 
@@ -145,7 +184,8 @@ proc update_lilypond {rebase} {
                git reset --hard origin/$originHead
                git config branch.$originHead.remote origin
                git config branch.$originHead.merge refs/heads/$originHead
-                .buttons.commit configure -state normal
+                .buttons.commitFrame.commit configure -state normal
+                .buttons.commitFrame.amend configure -state normal
                 .buttons.update configure -text buttonUpdateText
                 .buttons.patch configure -state normal
                 .buttons.panic configure -state normal
@@ -301,19 +341,26 @@ wm title . $windowTitle
 # Buttons
 
 panedwindow .buttons
-button .buttons.commit -text "2. Make local commit" -command commit
+
+frame  .buttons.commitFrame
+button .buttons.commitFrame.commit -text "2a. New local commit" -command commit
+button .buttons.commitFrame.amend -text "2b. Amend previous commit" -command commit_amend
+pack .buttons.commitFrame.commit -fill x
+pack .buttons.commitFrame.amend -fill x
+
 button .buttons.update -text $updateButtonText \
           -command update_lilypond_with_rebase
-toggle_rebase
 button .buttons.patch -text "3. Make patch set" \
           -command patch_from_origin
+toggle_rebase
 button .buttons.panic -text "Abort changes -- Reset to origin" \
           -command abort_changes -fg Blue -bg Red
 label   .buttons.spacer -text "                         "
 if {![file exists $lily_dir]} {
        .buttons.update configure \
             -text $initializeButtonText
-        .buttons.commit configure -state disabled
+        .buttons.commitFrame.commit configure -state disabled
+        .buttons.commitFrame.amend configure -state disabled
         .buttons.patch configure -state disabled
         .buttons.panic configure -state disabled
 }
@@ -321,10 +368,10 @@ if {![file exists $lily_dir]} {
 #  Operating buttons
 
 pack .buttons.update -side left
-pack .buttons.commit -side left
+pack .buttons.commitFrame -side left
 pack .buttons.patch -side left
 pack .buttons.spacer -side left
-pack .buttons.panic -side left
+pack .buttons.panic -side right
 
 
 # Output text box