diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-07-29 22:53:33 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-07-29 22:53:33 -0700 |
commit | b8de7f764e1a9f6e8dfb587a6145906394fa607d (patch) | |
tree | 43c913e5455026cfa8d721e47663acebd01bf5df /git-gui/lib/browser.tcl | |
parent | Makefile: use $(FIND) instead of find (diff) | |
parent | git-gui: Minor refactoring of merge command line in merge support (diff) | |
download | tgif-b8de7f764e1a9f6e8dfb587a6145906394fa607d.tar.xz |
Merge branch 'master' of git://repo.or.cz/git-gui
* 'master' of git://repo.or.cz/git-gui: (50 commits)
git-gui: Minor refactoring of merge command line in merge support
git-gui: Use more modern looking icons in the tree browser
git-gui: Don't offer to stage hunks from untracked files
git-gui: Make sure remotes are loaded when picking revisions
git-gui: Use progress bar while resetting/aborting files
git-gui: Honor core.excludesfile when listing extra files
git-gui: Unify wording to say "to stage" instead of "to add"
git-gui: Don't kill modified commit message buffer with merge templates
git-gui: Remove usernames from absolute SSH urls during merging
git-gui: Format tracking branch merges as though they were pulls
git-gui: Cleanup bindings within merge dialog
git-gui: Replace merge dialog with our revision picker widget
git-gui: Show ref last update times in revision chooser tooltips
git-gui: Display commit/tag/remote info in tooltip of revision picker
git-gui: Save remote urls obtained from config/remotes setup
git-gui: Avoid unnecessary symbolic-ref call during checkout
git-gui: Refactor current branch menu items to make i18n easier
git-gui: Refactor diff popup into a procedure to ease i18n work
git-gui: Paper bag fix quitting crash after commit
git-gui: Clarify meaning of add tracked menu option
...
Diffstat (limited to 'git-gui/lib/browser.tcl')
-rw-r--r-- | git-gui/lib/browser.tcl | 85 |
1 files changed, 78 insertions, 7 deletions
diff --git a/git-gui/lib/browser.tcl b/git-gui/lib/browser.tcl index 911e5af7f4..888db3c889 100644 --- a/git-gui/lib/browser.tcl +++ b/git-gui/lib/browser.tcl @@ -3,6 +3,13 @@ class browser { +image create photo ::browser::img_parent -data {R0lGODlhEAAQAIUAAPwCBBxSHBxO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IuY29tADs=} +image create photo ::browser::img_symlink -data {R0lGODlhEAAQAIQAAPwCBCwqLLSytLy+vERGRFRWVDQ2NKSmpAQCBKyurMTGxISChJyanHR2dIyKjGxubHRydGRmZIyOjFxeXHx6fAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAQABAAAAVbICACwWieY1CibCCsrBkMb0zchSEcNYskCtqBBzshFkOGQFk0IRqOxqPBODRHCMhCQKteRc9FI/KQWGOIyFYgkDC+gPR4snCcfRGKOIKIgSMQE31+f4OEYCZ+IQAh/mhDcmVhdGVkIGJ5IEJNUFRvR0lGIFBybyB2ZXJzaW9uIDIuNQ0KqSBEZXZlbENvciAxOTk3LDE5OTguIEFsbCByaWdodHMgcmVzZXJ2ZWQuDQpodHRwOi8vd3d3LmRldmVsY29yLmNvbQA7} +image create photo ::browser::img_unknown -data {R0lGODlhEAAQAIUAAPwCBFxaXIyKjNTW1Nze3LS2tJyanER2RGS+VPz+/PTu5GxqbPz69BQ6BCxeLFSqRPT29HRydMzOzDQyNERmPKSypCRWHIyKhERCRDyGPKz2nESiLBxGHCyCHGxubPz6/PTy7Ozi1Ly2rKSipOzm3LyqlKSWhCRyFOzizLymhNTKtNzOvOzaxOTStPz27OzWvOTOpLSupLyedMS+rMS6pMSulLyqjLymfLyifAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAAALAAAAAAQABAAAAamQIAQECgajcOkYEBoDgoBQyAJOCCuiENCsWBIh9aGw9F4HCARiXciRDQoBUnlYRlcIgsMG5CxXAgMGhscBRAEBRd7AB0eBBoIgxUfICEiikSPgyMMIAokJZcBkBybJgomIaBJAZoMpyCmqkMBFCcVCrgKKAwpoSorKqchKCwtvasIFBIhLiYvLzDHsxQNMcMKLDAwMqEz3jQ1NTY3ONyrE+jp6hN+QQAh/mhDcmVhdGVkIGJ5IEJNUFRvR0lGIFBybyB2ZXJzaW9uIDIuNQ0KqSBEZXZlbENvciAxOTk3LDE5OTguIEFsbCByaWdodHMgcmVzZXJ2ZWQuDQpodHRwOi8vd3d3LmRldmVsY29yLmNvbQA7} + field w field browser_commit field browser_path @@ -13,13 +20,13 @@ field browser_busy 1 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 \ @@ -73,7 +80,11 @@ constructor new {commit} { 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 } @@ -173,7 +184,7 @@ method _ls {tree_id {name {}}} { $w image create end \ -align center -padx 5 -pady 1 \ -name icon0 \ - -image file_uplevel + -image ::browser::img_parent $w insert end {[Up To Parent]} lappend browser_files parent } @@ -203,14 +214,21 @@ method _read {fd} { switch -- $type { blob { - set image file_mod + scan [lindex $info 0] %o mode + if {$mode == 0120000} { + set image ::browser::img_symlink + } elseif {($mode & 0100) != 0} { + set image ::browser::img_xblob + } else { + set image ::browser::img_rblob + } } tree { - set image file_dir + set image ::browser::img_tree append path / } default { - set image file_question + set image ::browser::img_unknown } } @@ -239,3 +257,56 @@ method _read {fd} { } } + +class browser_open { + +field w ; # widget path +field w_rev ; # mega-widget to pick the initial revision + +constructor dialog {} { + make_toplevel top w + wm title $top "[appname] ([reponame]): Browse Branch Files" + if {$top ne {.}} { + wm geometry $top "+[winfo rootx .]+[winfo rooty .]" + } + + label $w.header \ + -text {Browse Branch Files} \ + -font font_uibold + pack $w.header -side top -fill x + + frame $w.buttons + button $w.buttons.browse -text Browse \ + -default active \ + -command [cb _open] + pack $w.buttons.browse -side right + button $w.buttons.cancel -text {Cancel} \ + -command [list destroy $w] + pack $w.buttons.cancel -side right -padx 5 + pack $w.buttons -side bottom -fill x -pady 10 -padx 10 + + set w_rev [::choose_rev::new $w.rev {Revision}] + $w_rev bind_listbox <Double-Button-1> [cb _open] + pack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5 + + bind $w <Visibility> [cb _visible] + bind $w <Key-Escape> [list destroy $w] + bind $w <Key-Return> [cb _open]\;break + tkwait window $w +} + +method _open {} { + if {[catch {$w_rev commit_or_die} err]} { + return + } + set name [$w_rev get] + destroy $w + browser::new $name +} + +method _visible {} { + grab $w + $w_rev focus_filter +} + +} |