diff --git a/git-gui/.gitignore b/git-gui/.gitignore index 020b86deae..a7cfd6d5a0 100644 --- a/git-gui/.gitignore +++ b/git-gui/.gitignore @@ -1,5 +1,7 @@ +.DS_Store +Git Gui.app* +git-gui.tcl GIT-VERSION-FILE GIT-GUI-VARS -git-citool git-gui lib/tclIndex diff --git a/git-gui/Makefile b/git-gui/Makefile index b9affa4d7c..818a0ab45c 100644 --- a/git-gui/Makefile +++ b/git-gui/Makefile @@ -2,16 +2,21 @@ all:: # Define V=1 to have a more verbose compile. # +# Define NO_MSGFMT if you do not have msgfmt from the GNU gettext +# package and want to use our rough pure Tcl po->msg translator. +# TCL_PATH must be vaild for this to work. +# GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @$(SHELL_PATH) ./GIT-VERSION-GEN -include GIT-VERSION-FILE +uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') SCRIPT_SH = git-gui.sh +GITGUI_MAIN := git-gui GITGUI_BUILT_INS = git-citool -ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH)) ALL_LIBFILES = $(wildcard lib/*.tcl) PRELOAD_FILES = lib/class.tcl @@ -31,7 +36,7 @@ ifndef INSTALL INSTALL = install endif -RM_F ?= rm -f +RM_RF ?= rm -rf RMDIR ?= rmdir INSTALL_D0 = $(INSTALL) -d -m755 # space is required here @@ -40,6 +45,8 @@ INSTALL_R0 = $(INSTALL) -m644 # space is required here INSTALL_R1 = INSTALL_X0 = $(INSTALL) -m755 # space is required here INSTALL_X1 = +INSTALL_A0 = find # space is required here +INSTALL_A1 = | cpio -pud INSTALL_L0 = rm -f # space is required here INSTALL_L1 = && ln # space is required here INSTALL_L2 = @@ -47,14 +54,13 @@ INSTALL_L3 = REMOVE_D0 = $(RMDIR) # space is required here REMOVE_D1 = || true -REMOVE_F0 = $(RM_F) # space is required here +REMOVE_F0 = $(RM_RF) # space is required here REMOVE_F1 = CLEAN_DST = true ifndef V QUIET = @ - QUIET_GEN = $(QUIET)echo ' ' GEN $@ && - QUIET_BUILT_IN = $(QUIET)echo ' ' BUILTIN $@ && + QUIET_GEN = $(QUIET)echo ' ' GEN '$@' && QUIET_INDEX = $(QUIET)echo ' ' INDEX $(dir $@) && QUIET_MSGFMT0 = $(QUIET)printf ' MSGFMT %12s ' $@ && v=` QUIET_MSGFMT1 = 2>&1` && echo "$$v" | sed -e 's/fuzzy translations/fuzzy/' | sed -e 's/ messages//g' @@ -66,6 +72,8 @@ ifndef V INSTALL_R1 = && echo ' ' INSTALL 644 `basename $$src` && $(INSTALL) -m644 $$src INSTALL_X0 = src= INSTALL_X1 = && echo ' ' INSTALL 755 `basename $$src` && $(INSTALL) -m755 $$src + INSTALL_A0 = src= + INSTALL_A1 = && echo ' ' INSTALL ' ' `basename "$$src"` && find "$$src" | cpio -pud INSTALL_L0 = dst= INSTALL_L1 = && src= @@ -76,15 +84,15 @@ ifndef V REMOVE_D0 = dir= REMOVE_D1 = && echo ' ' REMOVE $$dir && test -d "$$dir" && $(RMDIR) "$$dir" || true REMOVE_F0 = dst= - REMOVE_F1 = && echo ' ' REMOVE `basename "$$dst"` && $(RM_F) "$$dst" + REMOVE_F1 = && echo ' ' REMOVE `basename "$$dst"` && $(RM_RF) "$$dst" endif TCL_PATH ?= tclsh TCLTK_PATH ?= wish +TKFRAMEWORK = /Library/Frameworks/Tk.framework/Resources/Wish.app ifeq ($(findstring $(MAKEFLAGS),s),s) QUIET_GEN = -QUIET_BUILT_IN = endif DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) @@ -101,6 +109,7 @@ exedir = $(dir $(gitexecdir))share/git-gui/lib GITGUI_SCRIPT := $$0 GITGUI_RELATIVE := +GITGUI_MACOSXAPP := ifeq ($(exedir),$(gg_libdir)) GITGUI_RELATIVE := 1 @@ -112,8 +121,51 @@ ifeq ($(uname_O),Cygwin) gg_libdir := $(shell cygpath --windows --absolute "$(gg_libdir)") endif endif +ifeq ($(uname_S),Darwin) + ifeq ($(shell test -d $(TKFRAMEWORK) && echo y),y) + GITGUI_MACOSXAPP := YesPlease + endif +endif -$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh +ifdef GITGUI_MACOSXAPP +GITGUI_MAIN := git-gui.tcl + +git-gui: GIT-VERSION-FILE GIT-GUI-VARS + $(QUIET_GEN)rm -f $@ $@+ && \ + echo '#!$(SHELL_PATH_SQ)' >$@+ && \ + echo 'if test "z$$*" = zversion ||' >>$@+ && \ + echo ' test "z$$*" = z--version' >>$@+ && \ + echo then >>$@+ && \ + echo ' 'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \ + echo else >>$@+ && \ + echo ' 'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/Wish'\' \ + '"$$0" "$$@"' >>$@+ && \ + echo fi >>$@+ && \ + chmod +x $@+ && \ + mv $@+ $@ + +Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \ + macosx/Info.plist \ + macosx/git-gui.icns \ + macosx/AppMain.tcl \ + $(TKFRAMEWORK)/Contents/MacOS/Wish + $(QUIET_GEN)rm -rf '$@' '$@'+ && \ + mkdir -p '$@'+/Contents/MacOS && \ + mkdir -p '$@'+/Contents/Resources/Scripts && \ + cp '$(subst ','\'',$(TKFRAMEWORK))/Contents/MacOS/Wish' \ + '$@'+/Contents/MacOS && \ + cp macosx/git-gui.icns '$@'+/Contents/Resources && \ + sed -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \ + macosx/Info.plist \ + >'$@'+/Contents/Info.plist && \ + sed -e 's|@@gitexecdir@@|$(gitexecdir_SQ)|' \ + -e 's|@@GITGUI_LIBDIR@@|$(libdir_SED)|' \ + macosx/AppMain.tcl \ + >'$@'+/Contents/Resources/Scripts/AppMain.tcl && \ + mv '$@'+ '$@' +endif + +$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-VARS $(QUIET_GEN)rm -f $@ $@+ && \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ -e '1,30s|^ argv0=$$0| argv0=$(GITGUI_SCRIPT)|' \ @@ -121,15 +173,17 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \ -e 's|@@GITGUI_RELATIVE@@|$(GITGUI_RELATIVE)|' \ -e '$(GITGUI_RELATIVE)s|@@GITGUI_LIBDIR@@|$(libdir_SED)|' \ - $@.sh >$@+ && \ + git-gui.sh >$@+ && \ chmod +x $@+ && \ mv $@+ $@ -$(GITGUI_BUILT_INS): git-gui - $(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@ - XGETTEXT ?= xgettext -MSGFMT ?= po/po2msg.sh +ifdef NO_MSGFMT + MSGFMT ?= $(TCL_PATH) po/po2msg.sh +else + MSGFMT ?= msgfmt +endif + msgsdir = $(gg_libdir)/msgs msgsdir_SQ = $(subst ','\'',$(msgsdir)) PO_TEMPLATE = po/git-gui.pot @@ -143,7 +197,7 @@ update-po:: $(PO_TEMPLATE) $(ALL_MSGFILES): %.msg : %.po $(QUIET_MSGFMT0)$(MSGFMT) --statistics --tcl $< -l $(basename $(notdir $<)) -d $(dir $@) $(QUIET_MSGFMT1) -lib/tclIndex: $(ALL_LIBFILES) +lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS $(QUIET_INDEX)if echo \ $(foreach p,$(PRELOAD_FILES),source $p\;) \ auto_mkindex lib '*.tcl' \ @@ -157,16 +211,13 @@ lib/tclIndex: $(ALL_LIBFILES) echo >>$@ ; \ fi -# These can record GITGUI_VERSION -$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE GIT-GUI-VARS -lib/tclIndex: GIT-GUI-VARS - TRACK_VARS = \ $(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ)') \ $(subst ','\'',TCL_PATH='$(TCL_PATH_SQ)') \ $(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \ $(subst ','\'',gitexecdir='$(gitexecdir_SQ)') \ $(subst ','\'',gg_libdir='$(libdir_SQ)') \ + GITGUI_MACOSXAPP=$(GITGUI_MACOSXAPP) \ #end TRACK_VARS GIT-GUI-VARS: .FORCE-GIT-GUI-VARS @@ -176,7 +227,10 @@ GIT-GUI-VARS: .FORCE-GIT-GUI-VARS echo 1>$@ "$$VARS"; \ fi -all:: $(ALL_PROGRAMS) lib/tclIndex $(ALL_MSGFILES) +ifdef GITGUI_MACOSXAPP +all:: git-gui Git\ Gui.app +endif +all:: $(GITGUI_MAIN) lib/tclIndex $(ALL_MSGFILES) install: all $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1) @@ -184,6 +238,11 @@ install: all $(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(INSTALL_L0)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L1)'$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' $(INSTALL_L2)'$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' $(INSTALL_L3) &&) true $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(libdir_SQ)' $(INSTALL_D1) $(QUIET)$(INSTALL_R0)lib/tclIndex $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' + $(QUIET)$(INSTALL_R0)lib/git-gui.ico $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' +ifdef GITGUI_MACOSXAPP + $(QUIET)$(INSTALL_A0)'Git Gui.app' $(INSTALL_A1) '$(DESTDIR_SQ)$(libdir_SQ)' + $(QUIET)$(INSTALL_X0)git-gui.tcl $(INSTALL_X1) '$(DESTDIR_SQ)$(libdir_SQ)' +endif $(QUIET)$(foreach p,$(ALL_LIBFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(libdir_SQ)' &&) true $(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(msgsdir_SQ)' $(INSTALL_D1) $(QUIET)$(foreach p,$(ALL_MSGFILES), $(INSTALL_R0)$p $(INSTALL_R1) '$(DESTDIR_SQ)$(msgsdir_SQ)' &&) true @@ -194,6 +253,11 @@ uninstall: $(QUIET)$(foreach p,$(GITGUI_BUILT_INS), $(REMOVE_F0)'$(DESTDIR_SQ)$(gitexecdir_SQ)'/$p $(REMOVE_F1) &&) true $(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(libdir_SQ)' $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/tclIndex $(REMOVE_F1) + $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/git-gui.ico $(REMOVE_F1) +ifdef GITGUI_MACOSXAPP + $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)/Git Gui.app' $(REMOVE_F1) + $(QUIET)$(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/git-gui.tcl $(REMOVE_F1) +endif $(QUIET)$(foreach p,$(ALL_LIBFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(libdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true $(QUIET)$(CLEAN_DST) '$(DESTDIR_SQ)$(msgsdir_SQ)' $(QUIET)$(foreach p,$(ALL_MSGFILES), $(REMOVE_F0)'$(DESTDIR_SQ)$(msgsdir_SQ)'/$(notdir $p) $(REMOVE_F1) &&) true @@ -207,8 +271,11 @@ dist-version: @echo $(GITGUI_VERSION) > $(TARDIR)/version clean:: - rm -f $(ALL_PROGRAMS) lib/tclIndex po/*.msg - rm -f GIT-VERSION-FILE GIT-GUI-VARS + $(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg + $(RM_RF) GIT-VERSION-FILE GIT-GUI-VARS +ifdef GITGUI_MACOSXAPP + $(RM_RF) 'Git Gui.app'* git-gui +endif .PHONY: all install uninstall dist-version clean .PHONY: .FORCE-GIT-VERSION-FILE diff --git a/git-gui/git-gui.pot b/git-gui/git-gui.pot index 991efea5f3..b352302572 100644 --- a/git-gui/git-gui.pot +++ b/git-gui/git-gui.pot @@ -1216,7 +1216,7 @@ msgstr "" #: lib/status_bar.tcl:58 #, tcl-format -msgid "%s ... %i of %i %s (%2i%%)" +msgid "%s ... %*i of %*i %s (%3i%%)" msgstr "" #: lib/transport.tcl:7 diff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh index 37da8fde3b..3f5927fb29 100755 --- a/git-gui/git-gui.sh +++ b/git-gui/git-gui.sh @@ -108,7 +108,7 @@ unset oguimsg ## ## read only globals -set _appname [lindex [file split $argv0] end] +set _appname {Git Gui} set _gitdir {} set _gitexec {} set _reponame {} @@ -527,6 +527,10 @@ bind . { set root_exists 1 } +if {[is_Windows]} { + wm iconbitmap . -default $oguilib/git-gui.ico +} + ###################################################################### ## ## config defaults @@ -785,7 +789,7 @@ unset -nocomplain idx fd ## ## feature option selection -if {[regexp {^git-(.+)$} [appname] _junk subcommand]} { +if {[regexp {^git-(.+)$} [file tail $argv0] _junk subcommand]} { unset _junk } else { set subcommand gui @@ -1239,11 +1243,17 @@ proc mapdesc {state path} { } proc ui_status {msg} { - $::main_status show $msg + global main_status + if {[info exists main_status]} { + $main_status show $msg + } } proc ui_ready {{test {}}} { - $::main_status show [mc "Ready."] $test + global main_status + if {[info exists main_status]} { + $main_status show [mc "Ready."] $test + } } proc escape_path {path} { @@ -1573,7 +1583,27 @@ proc do_gitk {revs} { if {! [file exists $exe]} { error_popup [mc "Unable to start gitk:\n\n%s does not exist" $exe] } else { + global env + + if {[info exists env(GIT_DIR)]} { + set old_GIT_DIR $env(GIT_DIR) + } else { + set old_GIT_DIR {} + } + + set pwd [pwd] + cd [file dirname [gitdir]] + set env(GIT_DIR) [file tail [gitdir]] + eval exec $cmd $revs & + + if {$old_GIT_DIR eq {}} { + unset env(GIT_DIR) + } else { + set env(GIT_DIR) $old_GIT_DIR + } + cd $pwd + ui_status $::starting_gitk_msg after 10000 { ui_ready $starting_gitk_msg @@ -2136,7 +2166,8 @@ citool - gui { if {[llength $argv] != 0} { puts -nonewline stderr "usage: $argv0" - if {$subcommand ne {gui} && [appname] ne "git-$subcommand"} { + if {$subcommand ne {gui} + && [file tail $argv0] ne "git-$subcommand"} { puts -nonewline stderr " $subcommand" } puts stderr {} diff --git a/git-gui/lib/blame.tcl b/git-gui/lib/blame.tcl index a911c3c77d..00ecf21333 100644 --- a/git-gui/lib/blame.tcl +++ b/git-gui/lib/blame.tcl @@ -905,7 +905,7 @@ method _open_tooltip {cur_w} { set author_time {} catch {set author_name $header($cmit,author)} catch {set summary $header($cmit,summary)} - catch {set author_time [foramt_date $header($cmit,author-time)]} + catch {set author_time [format_date $header($cmit,author-time)]} $tooltip_t insert end [strcat [mc "Originally By:"] "\n"] section_header $tooltip_t insert end "commit $cmit\n" diff --git a/git-gui/lib/choose_repository.tcl b/git-gui/lib/choose_repository.tcl index 5f2d12fd07..16bf67c34f 100644 --- a/git-gui/lib/choose_repository.tcl +++ b/git-gui/lib/choose_repository.tcl @@ -3,19 +3,36 @@ class choose_repository { +# Henrik Nyh's alternative Git logo, from his blog post +# http://henrik.nyh.se/2007/06/alternative-git-logo-and-favicon +# image create photo ::choose_repository::git_logo -data { -R0lGODlh3wA9AMIHAMAAAMIKCsMKCgCAAN/v3/319f///wAAACH5BAEKAAcALAAAAADfAD0AAAP+ -aLrc/jDKSau9OOvNu/9gKI5kaZ5oqq5s675wLM90bd94ru987//AoHBILBqPyKSSFGg6n9BoUwCR -Wq3Ux3X7zC4Xg7B4HN4Bzui0eo2GsN9wN3ye/jLI+IGZzpfz535/b3ZgeWN7goMPiXGLjGyECoaH -Oo+QjpZ1mJlnkQaTYhigZR6cmg6mbZucnqN6F64fqZ2rmYGskbGwo7Kzt7a1lq28u6AfBcjJysvM -yRDN0NHP0dTKniS619pG2dveQd3f4jzh40eu3eh5EOrq5kPtk3fxoQ/0xO9A93jz9+z7hvKBA1hP -0r5/BMkIJIfvU0OE8opFXDjQWCGLE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UryqfkKkBu +v/0prxD//kR63YnqB8AeqcdoBRxU/1zAuwRaaX4reJ4DSSRAHUhwgrgqwgUx2B94EWGDHISPBzUY +QgSNcAn6K6F4fscDCtBOhdoRwPW6kIHDwZA7vWoDBF44Qd/tIUAEBCACbIeG4AXxfmFrQ4B4OCYE +JBEQELChmgbAACJioj4JOCKCCLCABZ6EAg1IHwDlyLYAB1gRJhSYgHUQAD9WnQ9+CWBAA+wknTpC +JwQAOw== } field top @@ -66,7 +83,6 @@ constructor pick {} { -command do_about } - _center $top 500 350 wm protocol $top WM_DELETE_WINDOW exit bind $top <$M1B-q> exit bind $top <$M1B-Q> exit @@ -81,7 +97,7 @@ constructor pick {} { -relief sunken \ -background white \ -image ::choose_repository::git_logo - pack $w.git_logo -side top -fill x -padx 20 -pady 20 + pack $w.git_logo -side left -fill y -padx 10 -pady 10 set w_body $w.body frame $w_body @@ -103,7 +119,7 @@ constructor pick {} { pack $w_body.new -anchor w -fill x pack $w_body.clone -anchor w -fill x pack $w_body.open -anchor w -fill x - pack $w_body -fill x -padx 10 + pack $w_body -fill x -padx 10 -pady 10 frame $w.buttons set w_next $w.buttons.next @@ -120,15 +136,16 @@ constructor pick {} { bind $top [cb _invoke_next] bind $top " + [cb _center] grab $top focus $top + bind $top {} " wm deiconify $top tkwait variable @done if {$top eq {.}} { eval destroy [winfo children $top] - _center $top 500 600 } } @@ -140,10 +157,12 @@ proc _home {} { return $h } -proc _center {top nx ny} { - set rx [expr {([winfo screenwidth $top] - $nx) / 2}] - set ry [expr {([winfo screenheight $top] - $ny) / 2}] - wm geometry $top [format {%dx%d+%d+%d} $nx $ny $rx $ry] +method _center {} { + set nx [winfo reqwidth $top] + set ny [winfo reqheight $top] + set rx [expr {([winfo screenwidth $top] - $nx) / 3}] + set ry [expr {([winfo screenheight $top] - $ny) / 3}] + wm geometry $top [format {+%d+%d} $rx $ry] } method _invoke_next {} { @@ -462,20 +481,68 @@ method _do_clone2 {} { switch -exact -- $clone_type { hardlink { + set o_cons [status_bar::two_line $w_body] + pack $w_body -fill x -padx 10 -pady 10 + + $o_cons start \ + [mc "Counting objects"] \ + [mc "buckets"] + update + + if {[file exists [file join $objdir info alternates]]} { + set pwd [pwd] + if {[catch { + file mkdir [gitdir objects info] + set f_in [open [file join $objdir info alternates] r] + set f_cp [open [gitdir objects info alternates] w] + fconfigure $f_in -translation binary -encoding binary + fconfigure $f_cp -translation binary -encoding binary + cd $objdir + while {[gets $f_in line] >= 0} { + if {[is_Cygwin]} { + puts $f_cp [exec cygpath --unix --absolute $line] + } else { + puts $f_cp [file normalize $line] + } + } + close $f_in + close $f_cp + cd $pwd + } err]} { + catch {cd $pwd} + _clone_failed $this [mc "Unable to copy objects/info/alternates: %s" $err] + return + } + } + set tolink [list] + set buckets [glob \ + -tails \ + -nocomplain \ + -directory [file join $objdir] ??] + set bcnt [expr {[llength $buckets] + 2}] + set bcur 1 + $o_cons update $bcur $bcnt + update + file mkdir [file join .git objects pack] foreach i [glob -tails -nocomplain \ -directory [file join $objdir pack] *] { lappend tolink [file join pack $i] } - foreach i [glob -tails -nocomplain \ - -directory [file join $objdir] ??] { + $o_cons update [incr bcur] $bcnt + update + + foreach i $buckets { file mkdir [file join .git objects $i] foreach j [glob -tails -nocomplain \ -directory [file join $objdir $i] *] { lappend tolink [file join $i $j] } + $o_cons update [incr bcur] $bcnt + update } + $o_cons stop if {$tolink eq {}} { info_popup [strcat \ @@ -483,23 +550,18 @@ method _do_clone2 {} { "\n" \ [mc "The 'master' branch has not been initialized."] \ ] + destroy $w_body set done 1 return } - set o_cons [status_bar::new $w_body] - pack $w_body -fill x -padx 10 - set i [lindex $tolink 0] if {[catch { file link -hard \ [file join .git objects $i] \ [file join $objdir $i] } err]} { - info_popup [strcat \ - [mc "Hardlinks are unavailable. Falling back to copying."] \ - "\n" \ - $err] + info_popup [mc "Hardlinks are unavailable. Falling back to copying."] set i [_copy_files $this $objdir $tolink] } else { set i [_link_files $this $objdir [lrange $tolink 1 end]] @@ -718,8 +780,8 @@ method _do_clone_checkout {HEAD} { return } - set o_cons [status_bar::new $w_body] - pack $w_body -fill x -padx 10 + set o_cons [status_bar::two_line $w_body] + pack $w_body -fill x -padx 10 -pady 10 $o_cons start \ [mc "Creating working directory"] \ [mc "files"] diff --git a/git-gui/lib/console.tcl b/git-gui/lib/console.tcl index cde9a09268..2075374683 100644 --- a/git-gui/lib/console.tcl +++ b/git-gui/lib/console.tcl @@ -179,34 +179,31 @@ method insert {txt} { method done {ok} { if {$ok} { if {[winfo exists $w.m.s]} { + bind $w.m.s [list delete_this $this] $w.m.s conf -background green -text [mc "Success"] if {$is_toplevel} { $w.ok conf -state normal focus $w.ok } + } else { + delete_this } } else { if {![winfo exists $w.m.s]} { _init $this } + bind $w.m.s [list delete_this $this] $w.m.s conf -background red -text [mc "Error: Command Failed"] if {$is_toplevel} { $w.ok conf -state normal focus $w.ok } } - delete_this } method _sb_set {sb orient first last} { - if {$first == 0 && $last == 1} { - if {[winfo exists $sb]} { - destroy $sb - } - return - } - if {![winfo exists $sb]} { + if {$first == $last || ($first == 0 && $last == 1)} return if {$orient eq {h}} { scrollbar $sb -orient h -command [list $w_t xview] pack $sb -fill x -side bottom -before $w_t @@ -215,7 +212,7 @@ method _sb_set {sb orient first last} { pack $sb -fill y -side right -before $w_t } } - catch {$sb set $first $last} + $sb set $first $last } } diff --git a/git-gui/lib/git-gui.ico b/git-gui/lib/git-gui.ico new file mode 100644 index 0000000000..563dd66238 Binary files /dev/null and b/git-gui/lib/git-gui.ico differ diff --git a/git-gui/lib/status_bar.tcl b/git-gui/lib/status_bar.tcl index 769ef81c4b..5c5bf7c731 100644 --- a/git-gui/lib/status_bar.tcl +++ b/git-gui/lib/status_bar.tcl @@ -6,6 +6,7 @@ class status_bar { field w ; # our own window path field w_l ; # text widget we draw messages into field w_c ; # canvas we draw a progress bar into +field c_pack ; # script to pack the canvas with field status {}; # single line of text we show field prefix {}; # text we format into status field units {}; # unit of progress @@ -24,6 +25,29 @@ constructor new {path} { -anchor w \ -justify left pack $w_l -side left + set c_pack [cb _oneline_pack] + + bind $w [cb _delete %W] + return $this +} + +method _oneline_pack {} { + $w_c conf -width 100 + pack $w_c -side right +} + +constructor two_line {path} { + set w $path + set w_l $w.l + set w_c $w.c + + frame $w + label $w_l \ + -textvariable @status \ + -anchor w \ + -justify left + pack $w_l -anchor w -fill x + set c_pack [list pack $w_c -fill x] bind $w [cb _delete %W] return $this @@ -34,13 +58,12 @@ method start {msg uds} { $w_c coords bar 0 0 0 20 } else { canvas $w_c \ - -width 100 \ -height [expr {int([winfo reqheight $w_l] * 0.6)}] \ -borderwidth 1 \ -relief groove \ -highlightt 0 $w_c create rectangle 0 0 0 20 -tags bar -fill navy - pack $w_c -side right + eval $c_pack } set status $msg @@ -53,11 +76,16 @@ method update {have total} { set pdone 0 if {$total > 0} { set pdone [expr {100 * $have / $total}] + set cdone [expr {[winfo width $w_c] * $have / $total}] } - set status [mc "%s ... %i of %i %s (%2i%%)" \ - $prefix $have $total $units $pdone] - $w_c coords bar 0 0 $pdone 20 + set prec [string length [format %i $total]] + set status [mc "%s ... %*i of %*i %s (%3i%%)" \ + $prefix \ + $prec $have \ + $prec $total \ + $units $pdone] + $w_c coords bar 0 0 $cdone 20 } method update_meter {buf} { diff --git a/git-gui/lib/transport.tcl b/git-gui/lib/transport.tcl index 3b05b8fc2c..8e6a9d0a60 100644 --- a/git-gui/lib/transport.tcl +++ b/git-gui/lib/transport.tcl @@ -32,6 +32,7 @@ proc push_to {remote} { proc start_push_anywhere_action {w} { global push_urltype push_remote push_url push_thin push_tags + global push_force set r_url {} switch -- $push_urltype { @@ -45,6 +46,9 @@ proc start_push_anywhere_action {w} { if {$push_thin} { lappend cmd --thin } + if {$push_force} { + lappend cmd --force + } if {$push_tags} { lappend cmd --tags } @@ -76,6 +80,7 @@ trace add variable push_remote write \ proc do_push_anywhere {} { global all_remotes current_branch global push_urltype push_remote push_url push_thin push_tags + global push_force set w .push_setup toplevel $w @@ -151,6 +156,10 @@ proc do_push_anywhere {} { pack $w.dest -anchor nw -fill x -pady 5 -padx 5 labelframe $w.options -text [mc "Transfer Options"] + checkbutton $w.options.force \ + -text [mc "Force overwrite existing branch (may discard changes)"] \ + -variable push_force + grid $w.options.force -columnspan 2 -sticky w checkbutton $w.options.thin \ -text [mc "Use thin pack (for slow network connections)"] \ -variable push_thin @@ -163,6 +172,7 @@ proc do_push_anywhere {} { pack $w.options -anchor nw -fill x -pady 5 -padx 5 set push_url {} + set push_force 0 set push_thin 0 set push_tags 0 diff --git a/git-gui/macosx/AppMain.tcl b/git-gui/macosx/AppMain.tcl new file mode 100644 index 0000000000..41ca08e2b7 --- /dev/null +++ b/git-gui/macosx/AppMain.tcl @@ -0,0 +1,22 @@ +set gitexecdir {@@gitexecdir@@} +set gitguilib {@@GITGUI_LIBDIR@@} +set env(PATH) "$gitexecdir:$env(PATH)" + +if {[string first -psn [lindex $argv 0]] == 0} { + lset argv 0 [file join $gitexecdir git-gui] +} + +if {[file tail [lindex $argv 0]] eq {gitk}} { + set argv0 [file join $gitexecdir gitk] + set AppMain_source $argv0 +} else { + set argv0 [file join $gitexecdir [file tail [lindex $argv 0]]] + set AppMain_source [file join $gitguilib git-gui.tcl] + if {[pwd] eq {/}} { + cd $env(HOME) + } +} + +unset gitexecdir gitguilib +set argv [lrange $argv 1 end] +source $AppMain_source diff --git a/git-gui/macosx/Info.plist b/git-gui/macosx/Info.plist new file mode 100644 index 0000000000..99913ec57a --- /dev/null +++ b/git-gui/macosx/Info.plist @@ -0,0 +1,28 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + Wish + CFBundleGetInfoString + Git Gui @@GITGUI_VERSION@@ © 2006-2007 Shawn Pearce, et. al. + CFBundleIconFile + git-gui.icns + CFBundleIdentifier + cz.or.repo.git-gui + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Git Gui + CFBundlePackageType + APPL + CFBundleShortVersionString + @@GITGUI_VERSION@@ + CFBundleSignature + GITg + CFBundleVersion + @@GITGUI_VERSION@@ + + diff --git a/git-gui/macosx/git-gui.icns b/git-gui/macosx/git-gui.icns new file mode 100644 index 0000000000..77d88a77a7 Binary files /dev/null and b/git-gui/macosx/git-gui.icns differ diff --git a/git-gui/po/de.po b/git-gui/po/de.po index 7d57dd15f9..94b7463ca3 100644 --- a/git-gui/po/de.po +++ b/git-gui/po/de.po @@ -1350,8 +1350,8 @@ msgstr "Fehler beim Erstellen des Icons:" #: lib/status_bar.tcl:58 #, tcl-format -msgid "%s ... %i of %i %s (%2i%%)" -msgstr "%s ... %i von %i %s (%2i%%)" +msgid "%s ... %*i of %*i %s (%3i%%)" +msgstr "%s ... %*i von %*i %s (%3i%%)" #: lib/transport.tcl:7 #, tcl-format diff --git a/git-gui/po/hu.po b/git-gui/po/hu.po index faac58f810..1e189b6086 100644 --- a/git-gui/po/hu.po +++ b/git-gui/po/hu.po @@ -1344,8 +1344,8 @@ msgstr "Nem sikerült írni az ikont:" #: lib/status_bar.tcl:58 #, tcl-format -msgid "%s ... %i of %i %s (%2i%%)" -msgstr "%s ... %i / %i %s (%2i%%)" +msgid "%s ... %*i of %*i %s (%3i%%)" +msgstr "%s ... %*i / %*i %s (%3i%%)" #: lib/transport.tcl:7 #, tcl-format diff --git a/git-gui/po/it.po b/git-gui/po/it.po index 17a5c21882..ad5cd9e5da 100644 --- a/git-gui/po/it.po +++ b/git-gui/po/it.po @@ -1344,8 +1344,8 @@ msgstr "Impossibile scrivere icona:" #: lib/status_bar.tcl:58 #, tcl-format -msgid "%s ... %i of %i %s (%2i%%)" -msgstr "%s ... %i di %i %s (%2i%%)" +msgid "%s ... %*i of %*i %s (%3i%%)" +msgstr "%s ... %*i di %*i %s (%3i%%)" #: lib/transport.tcl:7 #, tcl-format diff --git a/git-gui/po/ja.po b/git-gui/po/ja.po index 17139080ec..cdbc981ca5 100644 --- a/git-gui/po/ja.po +++ b/git-gui/po/ja.po @@ -1333,8 +1333,8 @@ msgstr "アイコンが書けません:" #: lib/status_bar.tcl:58 #, tcl-format -msgid "%s ... %i of %i %s (%2i%%)" -msgstr "%1$s ... %3$i %4$s 中の %$2i (%5$2i%%)" +msgid "%s ... %*i of %*i %s (%3i%%)" +msgstr "%1$s ... %3$*i %4$s 中の %$2*i (%5$3i%%)" #: lib/transport.tcl:7 #, tcl-format diff --git a/git-gui/po/ru.po b/git-gui/po/ru.po index c44d30af0a..20080338c8 100644 --- a/git-gui/po/ru.po +++ b/git-gui/po/ru.po @@ -1434,8 +1434,8 @@ msgstr "Невозможно записать значок:" #: lib/status_bar.tcl:58 #, tcl-format -msgid "%s ... %i of %i %s (%2i%%)" -msgstr "%s ... %i из %i %s (%2i%%)" +msgid "%s ... %*i of %*i %s (%3i%%)" +msgstr "%s ... %*i из %*i %s (%3i%%)" #: lib/transport.tcl:7 #, tcl-format diff --git a/git-gui/po/zh_cn.po b/git-gui/po/zh_cn.po index 45eb5b5f98..d1ed94f8a9 100644 --- a/git-gui/po/zh_cn.po +++ b/git-gui/po/zh_cn.po @@ -1238,7 +1238,7 @@ msgstr "" #: lib/status_bar.tcl:58 #, tcl-format -msgid "%s ... %i of %i %s (%2i%%)" +msgid "%s ... %*i of %*i %s (%3i%%)" msgstr "" #: lib/transport.tcl:7