summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c52c945)
raw | patch | inline | side by side (parent: c52c945)
author | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 18 Jul 2007 04:53:14 +0000 (00:53 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 18 Jul 2007 04:53:14 +0000 (00:53 -0400) |
Like our blame subcommand the browser subcommand now accepts both
a revision and a path, just a revision or just a path. This way
the user can start the subcommand on any branch, or on any subtree.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
a revision and a path, just a revision or just a path. This way
the user can start the subcommand on any branch, or on any subtree.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
git-gui.sh | patch | blob | history | |
lib/browser.tcl | patch | blob | history |
diff --git a/git-gui.sh b/git-gui.sh
index 9ddb61ea905289a8ddce86b0b51a5d25f2c8a185..267d6062187c368cf61f3ae9d9fa06d072b22769 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
# -- Not a normal commit type invocation? Do that instead!
#
switch -- $subcommand {
-browser {
- set subcommand_args {rev?}
- switch [llength $argv] {
- 0 { load_current_branch }
- 1 {
- set current_branch [lindex $argv 0]
- if {[regexp {^[0-9a-f]{1,39}$} $current_branch]} {
- if {[catch {
- set current_branch \
- [git rev-parse --verify $current_branch]
- } err]} {
- puts stderr $err
- exit 1
- }
- }
- }
- default usage
- }
- browser::new $current_branch
- return
-}
+browser -
blame {
set subcommand_args {rev? path}
if {$argv eq {}} usage
set current_branch $head
}
- if {$head eq {} && ![file exists $path]} {
- puts stderr "fatal: cannot stat path $path: No such file or directory"
- exit 1
+ switch -- $subcommand {
+ browser {
+ if {$head eq {}} {
+ if {$path ne {} && [file isdirectory $path]} {
+ set head $current_branch
+ } else {
+ set head $path
+ set path {}
+ }
+ }
+ browser::new $head $path
+ }
+ blame {
+ if {$head eq {} && ![file exists $path]} {
+ puts stderr "fatal: cannot stat path $path: No such file or directory"
+ exit 1
+ }
+ blame::new $head $path
+ }
}
-
- blame::new $head $path
return
}
citool -
diff --git a/lib/browser.tcl b/lib/browser.tcl
index 911e5af7f42f4059636a1a2c95234520f397331e..e8802d00118dba0d05dea109b69aecce3a39bfac 100644 (file)
--- a/lib/browser.tcl
+++ b/lib/browser.tcl
field ls_buf {}; # Buffered record output from ls-tree
-constructor new {commit} {
+constructor new {commit {path {}}} {
global cursor_ptr M1B
make_toplevel top w
wm title $top "[appname] ([reponame]): File Browser"
set browser_commit $commit
- set browser_path $browser_commit:
+ set browser_path $browser_commit:$path
label $w.path \
-textvariable @browser_path \
bind $w_list <Visibility> [list focus $w_list]
set w $w_list
- _ls $this $browser_commit
+ if {$path ne {}} {
+ _ls $this $browser_commit:$path $path
+ } else {
+ _ls $this $browser_commit $path
+ }
return $this
}