Compare commits
10 Commits
gitgui-0.6
...
gitgui-0.6
Author | SHA1 | Date | |
---|---|---|---|
756d846fea | |||
bb616ddd15 | |||
56a7fde16e | |||
c7bafad10d | |||
0b5ea163d2 | |||
c3e8a0a4dd | |||
51bd9d7b8c | |||
fd234dfdb7 | |||
9b28a8b9c2 | |||
92446aba47 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,3 @@
|
|||||||
CREDITS-FILE
|
|
||||||
GIT-VERSION-FILE
|
GIT-VERSION-FILE
|
||||||
git-citool
|
git-citool
|
||||||
git-gui
|
git-gui
|
||||||
|
58
CREDITS-GEN
58
CREDITS-GEN
@ -1,58 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
CF=CREDITS-FILE
|
|
||||||
tip=
|
|
||||||
|
|
||||||
tree_search ()
|
|
||||||
{
|
|
||||||
head=$1
|
|
||||||
tree=$2
|
|
||||||
for p in $(git rev-list --parents --max-count=1 $head 2>/dev/null)
|
|
||||||
do
|
|
||||||
test $tree = $(git rev-parse $p^{tree} 2>/dev/null) &&
|
|
||||||
vn=$(git describe --abbrev=4 $p 2>/dev/null) &&
|
|
||||||
case "$vn" in
|
|
||||||
gitgui-[0-9]*) echo $p; break;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
generate_credits ()
|
|
||||||
{
|
|
||||||
tip=$1 &&
|
|
||||||
rm -f $CF &&
|
|
||||||
git shortlog -n -s $tip | sed 's/: .*$//' >$CF || exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# Always use the tarball credits file if found, just
|
|
||||||
# in case we are somehow contained in a larger git
|
|
||||||
# repository that doesn't actually track our state.
|
|
||||||
# (At least one package manager is doing this.)
|
|
||||||
#
|
|
||||||
# We may be a subproject, so try looking for the merge
|
|
||||||
# commit that supplied this directory content if we are
|
|
||||||
# not at the toplevel. We probably will always be the
|
|
||||||
# second parent in the commit, but we shouldn't rely on
|
|
||||||
# that fact.
|
|
||||||
#
|
|
||||||
|
|
||||||
if test -f credits
|
|
||||||
then
|
|
||||||
rm -f $CF &&
|
|
||||||
cp credits $CF || exit
|
|
||||||
elif prefix="$(git rev-parse --show-prefix 2>/dev/null)" &&
|
|
||||||
test -n "$prefix" &&
|
|
||||||
head=$(git rev-list --max-count=1 HEAD -- . 2>/dev/null) &&
|
|
||||||
tree=$(git rev-parse --verify "HEAD:$prefix" 2>/dev/null) &&
|
|
||||||
tip=$(tree_search $head $tree) &&
|
|
||||||
test -n "$tip"
|
|
||||||
then
|
|
||||||
generate_credits $tip || exit
|
|
||||||
elif tip="$(git rev-parse --verify HEAD 2>/dev/null)" &&
|
|
||||||
test -n "$tip"
|
|
||||||
then
|
|
||||||
generate_credits $tip || exit
|
|
||||||
else
|
|
||||||
echo "error: Cannot locate authorship information." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
39
Makefile
39
Makefile
@ -1,11 +1,15 @@
|
|||||||
all::
|
all::
|
||||||
|
|
||||||
|
# Define V=1 to have a more verbose compile.
|
||||||
|
#
|
||||||
|
|
||||||
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
|
||||||
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
||||||
-include GIT-VERSION-FILE
|
-include GIT-VERSION-FILE
|
||||||
|
|
||||||
|
SCRIPT_SH = git-gui.sh
|
||||||
GITGUI_BUILT_INS = git-citool
|
GITGUI_BUILT_INS = git-citool
|
||||||
ALL_PROGRAMS = git-gui $(GITGUI_BUILT_INS)
|
ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
|
||||||
|
|
||||||
ifndef SHELL_PATH
|
ifndef SHELL_PATH
|
||||||
SHELL_PATH = /bin/sh
|
SHELL_PATH = /bin/sh
|
||||||
@ -19,27 +23,28 @@ ifndef INSTALL
|
|||||||
INSTALL = install
|
INSTALL = install
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef V
|
||||||
|
QUIET_GEN = @echo ' ' GEN $@;
|
||||||
|
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
|
||||||
|
endif
|
||||||
|
|
||||||
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
|
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
|
||||||
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
|
gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
|
||||||
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
|
||||||
|
|
||||||
git-gui: git-gui.sh GIT-VERSION-FILE CREDITS-FILE
|
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
|
||||||
rm -f $@ $@+
|
$(QUIET_GEN)rm -f $@ $@+ && \
|
||||||
sed -n \
|
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
||||||
-e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
|
||||||
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
|
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
|
||||||
-e '1,/^set gitgui_credits /p' \
|
$@.sh >$@+ && \
|
||||||
$@.sh >$@+
|
chmod +x $@+ && \
|
||||||
cat CREDITS-FILE >>$@+
|
|
||||||
sed -e '1,/^set gitgui_credits /d' $@.sh >>$@+
|
|
||||||
chmod +x $@+
|
|
||||||
mv $@+ $@
|
mv $@+ $@
|
||||||
|
|
||||||
CREDITS-FILE: CREDITS-GEN .FORCE-CREDITS-FILE
|
|
||||||
$(SHELL_PATH) ./CREDITS-GEN
|
|
||||||
|
|
||||||
$(GITGUI_BUILT_INS): git-gui
|
$(GITGUI_BUILT_INS): git-gui
|
||||||
rm -f $@ && ln git-gui $@
|
$(QUIET_BUILT_IN)rm -f $@ && ln git-gui $@
|
||||||
|
|
||||||
|
# These can record GITGUI_VERSION
|
||||||
|
$(patsubst %.sh,%,$(SCRIPT_SH)): GIT-VERSION-FILE
|
||||||
|
|
||||||
all:: $(ALL_PROGRAMS)
|
all:: $(ALL_PROGRAMS)
|
||||||
|
|
||||||
@ -48,14 +53,12 @@ install: all
|
|||||||
$(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
|
$(INSTALL) git-gui '$(DESTDIR_SQ)$(gitexecdir_SQ)'
|
||||||
$(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
|
$(foreach p,$(GITGUI_BUILT_INS), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' && ln '$(DESTDIR_SQ)$(gitexecdir_SQ)/git-gui' '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p' ;)
|
||||||
|
|
||||||
dist-version: CREDITS-FILE
|
dist-version:
|
||||||
@mkdir -p $(TARDIR)
|
@mkdir -p $(TARDIR)
|
||||||
@echo $(GITGUI_VERSION) > $(TARDIR)/version
|
@echo $(GITGUI_VERSION) > $(TARDIR)/version
|
||||||
@cat CREDITS-FILE > $(TARDIR)/credits
|
|
||||||
|
|
||||||
clean::
|
clean::
|
||||||
rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE CREDITS-FILE
|
rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE
|
||||||
|
|
||||||
.PHONY: all install dist-version clean
|
.PHONY: all install dist-version clean
|
||||||
.PHONY: .FORCE-GIT-VERSION-FILE
|
.PHONY: .FORCE-GIT-VERSION-FILE
|
||||||
.PHONY: .FORCE-CREDITS-FILE
|
|
||||||
|
160
git-gui.sh
160
git-gui.sh
@ -19,9 +19,6 @@ GNU General Public License for more details.
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA}
|
||||||
set gitgui_credits {
|
|
||||||
Paul Mackerras
|
|
||||||
}
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
##
|
##
|
||||||
@ -302,6 +299,11 @@ proc ask_popup {msg} {
|
|||||||
##
|
##
|
||||||
## version check
|
## version check
|
||||||
|
|
||||||
|
if {{--version} eq $argv || {version} eq $argv} {
|
||||||
|
puts "git-gui version $appvers"
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
set req_maj 1
|
set req_maj 1
|
||||||
set req_min 5
|
set req_min 5
|
||||||
|
|
||||||
@ -1171,7 +1173,7 @@ File [short_path $path] cannot be committed by this program.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if {!$files_ready} {
|
if {!$files_ready && ![string match *merge $curType]} {
|
||||||
info_popup {No changes to commit.
|
info_popup {No changes to commit.
|
||||||
|
|
||||||
You must add at least 1 file before you can commit.
|
You must add at least 1 file before you can commit.
|
||||||
@ -1267,6 +1269,24 @@ proc commit_committree {fd_wt curHEAD msg} {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# -- Verify this wasn't an empty change.
|
||||||
|
#
|
||||||
|
if {$commit_type eq {normal}} {
|
||||||
|
set old_tree [git rev-parse "$PARENT^{tree}"]
|
||||||
|
if {$tree_id eq $old_tree} {
|
||||||
|
info_popup {No changes to commit.
|
||||||
|
|
||||||
|
No files were modified by this commit and it
|
||||||
|
was not a merge commit.
|
||||||
|
|
||||||
|
A rescan will be automatically started now.
|
||||||
|
}
|
||||||
|
unlock_index
|
||||||
|
rescan {set ui_status_value {No changes to commit.}}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# -- Build the message.
|
# -- Build the message.
|
||||||
#
|
#
|
||||||
set msg_p [gitdir COMMIT_EDITMSG]
|
set msg_p [gitdir COMMIT_EDITMSG]
|
||||||
@ -1281,14 +1301,8 @@ proc commit_committree {fd_wt curHEAD msg} {
|
|||||||
# -- Create the commit.
|
# -- Create the commit.
|
||||||
#
|
#
|
||||||
set cmd [list git commit-tree $tree_id]
|
set cmd [list git commit-tree $tree_id]
|
||||||
set parents [concat $PARENT $MERGE_HEAD]
|
foreach p [concat $PARENT $MERGE_HEAD] {
|
||||||
if {[llength $parents] > 0} {
|
lappend cmd -p $p
|
||||||
foreach p $parents {
|
|
||||||
lappend cmd -p $p
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
# git commit-tree writes to stderr during initial commit.
|
|
||||||
lappend cmd 2>/dev/null
|
|
||||||
}
|
}
|
||||||
lappend cmd <$msg_p
|
lappend cmd <$msg_p
|
||||||
if {[catch {set cmt_id [eval exec $cmd]} err]} {
|
if {[catch {set cmt_id [eval exec $cmd]} err]} {
|
||||||
@ -4480,61 +4494,6 @@ proc do_commit {} {
|
|||||||
commit_tree
|
commit_tree
|
||||||
}
|
}
|
||||||
|
|
||||||
proc do_credits {} {
|
|
||||||
global gitgui_credits
|
|
||||||
|
|
||||||
set w .credits_dialog
|
|
||||||
|
|
||||||
toplevel $w
|
|
||||||
wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
|
|
||||||
|
|
||||||
label $w.header -text {git-gui Contributors} -font font_uibold
|
|
||||||
pack $w.header -side top -fill x
|
|
||||||
|
|
||||||
frame $w.buttons
|
|
||||||
button $w.buttons.close -text {Close} \
|
|
||||||
-font font_ui \
|
|
||||||
-command [list destroy $w]
|
|
||||||
pack $w.buttons.close -side right
|
|
||||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
|
||||||
|
|
||||||
frame $w.credits
|
|
||||||
text $w.credits.t \
|
|
||||||
-background [$w.header cget -background] \
|
|
||||||
-yscrollcommand [list $w.credits.sby set] \
|
|
||||||
-width 20 \
|
|
||||||
-height 10 \
|
|
||||||
-wrap none \
|
|
||||||
-borderwidth 1 \
|
|
||||||
-relief solid \
|
|
||||||
-padx 5 -pady 5 \
|
|
||||||
-font font_ui
|
|
||||||
scrollbar $w.credits.sby -command [list $w.credits.t yview]
|
|
||||||
pack $w.credits.sby -side right -fill y
|
|
||||||
pack $w.credits.t -fill both -expand 1
|
|
||||||
pack $w.credits -side top -fill both -expand 1 -padx 5 -pady 5
|
|
||||||
|
|
||||||
label $w.desc \
|
|
||||||
-text "All portions are copyrighted by their respective authors
|
|
||||||
and are distributed under the GNU General Public License." \
|
|
||||||
-padx 5 -pady 5 \
|
|
||||||
-justify left \
|
|
||||||
-anchor w \
|
|
||||||
-borderwidth 1 \
|
|
||||||
-relief solid \
|
|
||||||
-font font_ui
|
|
||||||
pack $w.desc -side top -fill x -padx 5 -pady 5
|
|
||||||
|
|
||||||
$w.credits.t insert end "[string trim $gitgui_credits]\n"
|
|
||||||
$w.credits.t conf -state disabled
|
|
||||||
$w.credits.t see 1.0
|
|
||||||
|
|
||||||
bind $w <Visibility> "grab $w; focus $w"
|
|
||||||
bind $w <Key-Escape> [list destroy $w]
|
|
||||||
wm title $w [$w.header cget -text]
|
|
||||||
tkwait window $w
|
|
||||||
}
|
|
||||||
|
|
||||||
proc do_about {} {
|
proc do_about {} {
|
||||||
global appvers copyright
|
global appvers copyright
|
||||||
global tcl_patchLevel tk_patchLevel
|
global tcl_patchLevel tk_patchLevel
|
||||||
@ -4551,10 +4510,6 @@ proc do_about {} {
|
|||||||
button $w.buttons.close -text {Close} \
|
button $w.buttons.close -text {Close} \
|
||||||
-font font_ui \
|
-font font_ui \
|
||||||
-command [list destroy $w]
|
-command [list destroy $w]
|
||||||
button $w.buttons.credits -text {Contributors} \
|
|
||||||
-font font_ui \
|
|
||||||
-command do_credits
|
|
||||||
pack $w.buttons.credits -side left
|
|
||||||
pack $w.buttons.close -side right
|
pack $w.buttons.close -side right
|
||||||
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
pack $w.buttons -side bottom -fill x -pady 10 -padx 10
|
||||||
|
|
||||||
@ -5104,8 +5059,6 @@ enable_option branch
|
|||||||
enable_option transport
|
enable_option transport
|
||||||
|
|
||||||
switch -- $subcommand {
|
switch -- $subcommand {
|
||||||
--version -
|
|
||||||
version -
|
|
||||||
browser -
|
browser -
|
||||||
blame {
|
blame {
|
||||||
disable_option multicommit
|
disable_option multicommit
|
||||||
@ -5256,6 +5209,12 @@ if {[is_enabled branch]} {
|
|||||||
-font font_ui
|
-font font_ui
|
||||||
lappend disable_on_lock [list .mbar.branch entryconf \
|
lappend disable_on_lock [list .mbar.branch entryconf \
|
||||||
[.mbar.branch index last] -state]
|
[.mbar.branch index last] -state]
|
||||||
|
|
||||||
|
.mbar.branch add command -label {Reset...} \
|
||||||
|
-command do_reset_hard \
|
||||||
|
-font font_ui
|
||||||
|
lappend disable_on_lock [list .mbar.branch entryconf \
|
||||||
|
[.mbar.branch index last] -state]
|
||||||
}
|
}
|
||||||
|
|
||||||
# -- Commit Menu
|
# -- Commit Menu
|
||||||
@ -5330,6 +5289,34 @@ if {[is_enabled multicommit] || [is_enabled singlecommit]} {
|
|||||||
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
[list .mbar.commit entryconf [.mbar.commit index last] -state]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# -- Merge Menu
|
||||||
|
#
|
||||||
|
if {[is_enabled branch]} {
|
||||||
|
menu .mbar.merge
|
||||||
|
.mbar.merge add command -label {Local Merge...} \
|
||||||
|
-command do_local_merge \
|
||||||
|
-font font_ui
|
||||||
|
lappend disable_on_lock \
|
||||||
|
[list .mbar.merge entryconf [.mbar.merge index last] -state]
|
||||||
|
.mbar.merge add command -label {Abort Merge...} \
|
||||||
|
-command do_reset_hard \
|
||||||
|
-font font_ui
|
||||||
|
lappend disable_on_lock \
|
||||||
|
[list .mbar.merge entryconf [.mbar.merge index last] -state]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# -- Transport Menu
|
||||||
|
#
|
||||||
|
if {[is_enabled transport]} {
|
||||||
|
menu .mbar.fetch
|
||||||
|
|
||||||
|
menu .mbar.push
|
||||||
|
.mbar.push add command -label {Push...} \
|
||||||
|
-command do_push_anywhere \
|
||||||
|
-font font_ui
|
||||||
|
}
|
||||||
|
|
||||||
if {[is_MacOSX]} {
|
if {[is_MacOSX]} {
|
||||||
# -- Apple Menu (Mac OS X only)
|
# -- Apple Menu (Mac OS X only)
|
||||||
#
|
#
|
||||||
@ -5442,11 +5429,6 @@ bind all <$M1B-Key-W> {destroy [winfo toplevel %W]}
|
|||||||
# -- Not a normal commit type invocation? Do that instead!
|
# -- Not a normal commit type invocation? Do that instead!
|
||||||
#
|
#
|
||||||
switch -- $subcommand {
|
switch -- $subcommand {
|
||||||
--version -
|
|
||||||
version {
|
|
||||||
puts "git-gui version $appvers"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
browser {
|
browser {
|
||||||
if {[llength $argv] != 1} {
|
if {[llength $argv] != 1} {
|
||||||
puts stderr "usage: $argv0 browser commit"
|
puts stderr "usage: $argv0 browser commit"
|
||||||
@ -5502,28 +5484,6 @@ pack .branch.l1 -side left
|
|||||||
pack .branch.cb -side left -fill x
|
pack .branch.cb -side left -fill x
|
||||||
pack .branch -side top -fill x
|
pack .branch -side top -fill x
|
||||||
|
|
||||||
if {[is_enabled branch]} {
|
|
||||||
menu .mbar.merge
|
|
||||||
.mbar.merge add command -label {Local Merge...} \
|
|
||||||
-command do_local_merge \
|
|
||||||
-font font_ui
|
|
||||||
lappend disable_on_lock \
|
|
||||||
[list .mbar.merge entryconf [.mbar.merge index last] -state]
|
|
||||||
.mbar.merge add command -label {Abort Merge...} \
|
|
||||||
-command do_reset_hard \
|
|
||||||
-font font_ui
|
|
||||||
lappend disable_on_lock \
|
|
||||||
[list .mbar.merge entryconf [.mbar.merge index last] -state]
|
|
||||||
|
|
||||||
|
|
||||||
menu .mbar.fetch
|
|
||||||
|
|
||||||
menu .mbar.push
|
|
||||||
.mbar.push add command -label {Push...} \
|
|
||||||
-command do_push_anywhere \
|
|
||||||
-font font_ui
|
|
||||||
}
|
|
||||||
|
|
||||||
# -- Main Window Layout
|
# -- Main Window Layout
|
||||||
#
|
#
|
||||||
panedwindow .vpane -orient vertical
|
panedwindow .vpane -orient vertical
|
||||||
|
Reference in New Issue
Block a user