git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gitk: Add "Refs" menu
@ 2005-10-06  0:38 Pavel Roskin
  2005-10-06  4:11 ` [PATCH] gitk: Add "Refs" menu - revised Pavel Roskin
  2005-10-11 12:17 ` [PATCH] gitk: Add "Refs" menu Paul Mackerras
  0 siblings, 2 replies; 9+ messages in thread
From: Pavel Roskin @ 2005-10-06  0:38 UTC (permalink / raw)
  To: git, Paul Mackerras

Hello, Paul!

This patch adds "Refs" menu to gitk.  It makes all branches, tags and
other ref objects appear as menu items.  Selecting one of the items
selects the corresponding line in the view.

Known limitation: it's only possible to go to the refs present in the
current view.  Otherwise, gitk would have to re-run git-rev-list.

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff --git a/gitk b/gitk
--- a/gitk
+++ b/gitk
@@ -285,6 +285,7 @@ proc readrefs {} {
 	}
     }
     readotherrefs refs {} {tags heads}
+    setrefsmenu
 }
 
 proc readotherrefs {base dname excl} {
@@ -538,6 +539,62 @@ proc makewindow {} {
     $rowctxmenu add command -label "Write commit to file" -command writecommit
 }
 
+proc gotocommit_menu {sha1} {
+    global idline
+
+    if {[info exists idline($sha1)]} {
+	selectline $idline($sha1) 1
+	return
+    } else {
+	# Should we re-run git-rev-list?
+	error_popup "$sha1 is not in the current view"
+    }
+}
+
+proc setrefsmenu {} {
+    global headids tagids otherrefids
+
+    if {[winfo exists .bar.refs]} {
+	foreach w [winfo children .bar.refs] {
+	    destroy $w
+	}
+	.bar.refs delete 1 3
+    } else {
+	.bar add cascade -label "Refs" -menu .bar.refs
+	menu .bar.refs
+    }
+
+    set refids [lsort -unique [concat [array names headids]]]
+    if {[llength $refids] > 0} {
+	.bar.refs add cascade -label "Branches" -menu .bar.refs.heads
+	menu .bar.refs.heads
+	foreach v $refids {
+	    .bar.refs.heads add command -label $v \
+		-command "gotocommit_menu $headids($v)"
+	}
+    }
+
+    set refids [lsort -unique [concat [array names tagids]]]
+    if {[llength $refids] > 0} {
+	.bar.refs add cascade -label "Tags" -menu .bar.refs.tags
+	menu .bar.refs.tags
+	foreach v $refids {
+	    .bar.refs.tags add command -label $v \
+		-command "gotocommit_menu $tagids($v)"
+	}
+    }
+
+    set refids [lsort -unique [concat [array names otherrefids]]]
+    if {[llength $refids] > 0} {
+	.bar.refs add cascade -label "Other" -menu .bar.refs.other
+	menu .bar.refs.other
+	foreach v $refids {
+	    .bar.refs.other add command -label $v \
+		-command "gotocommit_menu $otherrefids($v)"
+	}
+    }
+}
+
 # when we make a key binding for the toplevel, make sure
 # it doesn't get triggered when that key is pressed in the
 # find string entry widget.


-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] gitk: Add "Refs" menu - revised
  2005-10-06  0:38 [PATCH] gitk: Add "Refs" menu Pavel Roskin
@ 2005-10-06  4:11 ` Pavel Roskin
  2005-10-11 12:17 ` [PATCH] gitk: Add "Refs" menu Paul Mackerras
  1 sibling, 0 replies; 9+ messages in thread
From: Pavel Roskin @ 2005-10-06  4:11 UTC (permalink / raw)
  To: git; +Cc: Paul Mackerras

Hello!

This is an updated revision of the original patch.  Unneeded concat has
been removed.  Error message uses name, not SHA1 ID.  If there is
information for the tag, it's displayed even in the ID is not in the
list.  Thanks to Brett Schwarz for help.

---------------------------------

This patch adds "Refs" menu to gitk.  It makes all branches, tags and
other ref objects appear as menu items.  Selecting one of the items
selects the corresponding line in the view.

It's only possible to go to the refs present in the current view.
However, information for tags is shown even if the corresponding ID is
not available.

Signed-off-by: Pavel Roskin <proski@gnu.org>

diff -u b/gitk b/gitk
--- b/gitk
+++ b/gitk
@@ -285,6 +285,7 @@
 	}
     }
     readotherrefs refs {} {tags heads}
+    setrefsmenu
 }
 
 proc readotherrefs {base dname excl} {
@@ -538,6 +539,65 @@
     $rowctxmenu add command -label "Write commit to file" -command writecommit
 }
 
+proc gotocommit_menu {sha1 name} {
+    global idline tagids tagcontents
+
+    if {[info exists idline($sha1)]} {
+	selectline $idline($sha1) 1
+    } else {
+	# Should we re-run git-rev-list?
+	error_popup "$name is not in the current view"
+    }
+
+    if {[info exists tagcontents($name)]} {
+	showtag $name 1
+    }
+}
+
+proc setrefsmenu {} {
+    global headids tagids otherrefids
+
+    if {[winfo exists .bar.refs]} {
+	foreach w [winfo children .bar.refs] {
+	    destroy $w
+	}
+	.bar.refs delete 1 3
+    } else {
+	.bar add cascade -label "Refs" -menu .bar.refs
+	menu .bar.refs
+    }
+
+    set refids [lsort -unique [array names headids]]
+    if {[llength $refids] > 0} {
+	.bar.refs add cascade -label "Branches" -menu .bar.refs.heads
+	menu .bar.refs.heads
+	foreach v $refids {
+	    .bar.refs.heads add command -label $v \
+		-command [list gotocommit_menu $headids($v) $v]
+	}
+    }
+
+    set refids [lsort -unique [array names tagids]]
+    if {[llength $refids] > 0} {
+	.bar.refs add cascade -label "Tags" -menu .bar.refs.tags
+	menu .bar.refs.tags
+	foreach v $refids {
+	    .bar.refs.tags add command -label $v \
+		-command [list gotocommit_menu $tagids($v) $v]
+	}
+    }
+
+    set refids [lsort -unique [array names otherrefids]]
+    if {[llength $refids] > 0} {
+	.bar.refs add cascade -label "Other" -menu .bar.refs.other
+	menu .bar.refs.other
+	foreach v $refids {
+	    .bar.refs.other add command -label $v \
+		-command [list gotocommit_menu $otherrefids($v) $v]
+	}
+    }
+}
+
 # when we make a key binding for the toplevel, make sure
 # it doesn't get triggered when that key is pressed in the
 # find string entry widget.


-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gitk: Add "Refs" menu
  2005-10-06  0:38 [PATCH] gitk: Add "Refs" menu Pavel Roskin
  2005-10-06  4:11 ` [PATCH] gitk: Add "Refs" menu - revised Pavel Roskin
@ 2005-10-11 12:17 ` Paul Mackerras
  2005-10-12  1:26   ` Pavel Roskin
  1 sibling, 1 reply; 9+ messages in thread
From: Paul Mackerras @ 2005-10-11 12:17 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: git

Pavel Roskin writes:

> This patch adds "Refs" menu to gitk.  It makes all branches, tags and
> other ref objects appear as menu items.  Selecting one of the items
> selects the corresponding line in the view.

Sorry I haven't responded before - I have got way behind with my email
due to a vacation and to concentrating on the merge of the ppc32 and
ppc64 kernel sources.  It will probably be a bit longer before I can
get to look at this.

Thanks,
Paul.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gitk: Add "Refs" menu
  2005-10-11 12:17 ` [PATCH] gitk: Add "Refs" menu Paul Mackerras
@ 2005-10-12  1:26   ` Pavel Roskin
  2005-10-12  7:31     ` Sven Verdoolaege
  2005-10-12 11:55     ` Marco Costalba
  0 siblings, 2 replies; 9+ messages in thread
From: Pavel Roskin @ 2005-10-12  1:26 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

Hi, Paul!

On Tue, 2005-10-11 at 22:17 +1000, Paul Mackerras wrote:
> Pavel Roskin writes:
> 
> > This patch adds "Refs" menu to gitk.  It makes all branches, tags and
> > other ref objects appear as menu items.  Selecting one of the items
> > selects the corresponding line in the view.
> 
> Sorry I haven't responded before - I have got way behind with my email
> due to a vacation and to concentrating on the merge of the ppc32 and
> ppc64 kernel sources.  It will probably be a bit longer before I can
> get to look at this.

No problem.  Thank you for letting me know.

I'm not a GUI designer and I'm not experienced in Tcl/Tk, so I'll
appreciate critical look at the patches.

I think that gitk should move away from being just a frontend to
git-rev-list.  There is more information in the repository, such as
tags, branches, stgit patches etc.  All this information needs to be
represented in some way, and using the menu was just the first approach.

Browsing trees and opening files for a given commit would be great and
helpful from developers migrating from CVS.

And making gitk cooperate with stgit would be a killer application not
just for gitk and stgit, but for git itself (i.e. it could be the reason
why git is chosen for development over e.g. Mercurial for new projects).

I don't want to distract you from PPC work, but your return to gitk
development would be very welcome :-)

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gitk: Add "Refs" menu
  2005-10-12  1:26   ` Pavel Roskin
@ 2005-10-12  7:31     ` Sven Verdoolaege
  2005-10-12 14:34       ` Pavel Roskin
  2005-10-12 11:55     ` Marco Costalba
  1 sibling, 1 reply; 9+ messages in thread
From: Sven Verdoolaege @ 2005-10-12  7:31 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: Paul Mackerras, git

On Tue, Oct 11, 2005 at 09:26:20PM -0400, Pavel Roskin wrote:
> Browsing trees and opening files for a given commit would be great and
> helpful from developers migrating from CVS.

Something like this ?

    From: Ingo Bormuth <ibormuth@efil.de>
    To: git@vger.kernel.org
    Cc: paulus@samba.org
    Subject: [PATCH] Gitk tree view (correction)
    Message-ID: <20050824223550.GA23693@kruemel>

skimo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gitk: Add "Refs" menu
  2005-10-12  1:26   ` Pavel Roskin
  2005-10-12  7:31     ` Sven Verdoolaege
@ 2005-10-12 11:55     ` Marco Costalba
  2005-10-12 16:03       ` Pavel Roskin
  2005-10-12 17:47       ` H. Peter Anvin
  1 sibling, 2 replies; 9+ messages in thread
From: Marco Costalba @ 2005-10-12 11:55 UTC (permalink / raw)
  To: Pavel Roskin; +Cc: git

 
> And making gitk cooperate with stgit would be a killer application not
> just for gitk and stgit, but for git itself (i.e. it could be the reason
> why git is chosen for development over e.g. Mercurial for new projects).
> 

Not to advertise, but qgit (http://digilander.libero.it/mcostalba/) already offers 
stgit integration, among other things.

I plan to release a new version implementing various suggestion from the list this week, there are
also important stgit fixes and upgrades. 

To have a look at new features check the git arcihve: cg-clone
http://digilander.libero.it/mcostalba/qgit.git


  Marco




		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free.
http://music.yahoo.com/unlimited/

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gitk: Add "Refs" menu
  2005-10-12  7:31     ` Sven Verdoolaege
@ 2005-10-12 14:34       ` Pavel Roskin
  0 siblings, 0 replies; 9+ messages in thread
From: Pavel Roskin @ 2005-10-12 14:34 UTC (permalink / raw)
  To: skimo; +Cc: Paul Mackerras, git

On Wed, 2005-10-12 at 09:31 +0200, Sven Verdoolaege wrote:
> On Tue, Oct 11, 2005 at 09:26:20PM -0400, Pavel Roskin wrote:
> > Browsing trees and opening files for a given commit would be great and
> > helpful from developers migrating from CVS.
> 
> Something like this ?
> 
>     From: Ingo Bormuth <ibormuth@efil.de>
>     To: git@vger.kernel.org
>     Cc: paulus@samba.org
>     Subject: [PATCH] Gitk tree view (correction)
>     Message-ID: <20050824223550.GA23693@kruemel>

That's pretty good, thank you.  Although I think "Tree" and "Commit"
should be links on top of the view pane rather than a button.  "Commit"
button is especially confusing - one could think that it would commit
something.

Also, it would be really great to put line numbers in a separate widget
so that they are never selected with the text.  When done correctly,
most users will never want to turn the line numbers off.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gitk: Add "Refs" menu
  2005-10-12 11:55     ` Marco Costalba
@ 2005-10-12 16:03       ` Pavel Roskin
  2005-10-12 17:47       ` H. Peter Anvin
  1 sibling, 0 replies; 9+ messages in thread
From: Pavel Roskin @ 2005-10-12 16:03 UTC (permalink / raw)
  To: Marco Costalba; +Cc: git

On Wed, 2005-10-12 at 04:55 -0700, Marco Costalba wrote:
>  > And making gitk cooperate with stgit would be a killer application not
> > just for gitk and stgit, but for git itself (i.e. it could be the reason
> > why git is chosen for development over e.g. Mercurial for new projects).
> > 
> 
> Not to advertise, but qgit (http://digilander.libero.it/mcostalba/) already offers 
> stgit integration, among other things.

Very nice.

But it doesn't show correctly in the qt theme I was using (which must be
the default theme in Fedora Core 4 because I never changed it):

http://red-bean.com/proski/qgit.png

The blame for the ugly default gray background should be on Qt or on
Fedora, but it seems to me that qgit is hardcoding white and light gray
(see ODD_LINE_COL and EVEN_LINE_COL in src/mainimpl.cpp).

The style selector in kcontrol has "Standard Background" and "Alternate
Background for Lists".  I don't know if it has an equivalent in qt.
Maybe you could use the standard background and a slightly darkened
version.

Also, please use months names on the homepage.  I thought qgit 0.94 was
released on October 9th.

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] gitk: Add "Refs" menu
  2005-10-12 11:55     ` Marco Costalba
  2005-10-12 16:03       ` Pavel Roskin
@ 2005-10-12 17:47       ` H. Peter Anvin
  1 sibling, 0 replies; 9+ messages in thread
From: H. Peter Anvin @ 2005-10-12 17:47 UTC (permalink / raw)
  To: Marco Costalba; +Cc: Pavel Roskin, git

Marco Costalba wrote:
>  
> 
>>And making gitk cooperate with stgit would be a killer application not
>>just for gitk and stgit, but for git itself (i.e. it could be the reason
>>why git is chosen for development over e.g. Mercurial for new projects).
>>
> 
> 
> Not to advertise, but qgit (http://digilander.libero.it/mcostalba/) already offers 
> stgit integration, among other things.
> 
> I plan to release a new version implementing various suggestion from the list this week, there are
> also important stgit fixes and upgrades. 
> 
> To have a look at new features check the git arcihve: cg-clone
> http://digilander.libero.it/mcostalba/qgit.git
> 

I looked at qgit at one time, and I find its UI to be much less pleasant 
to look at that gitk, which is unfortunate, because it's much faster. 
Both the graph and the color scheme are much less pleasant, which 
distracts from the information conveyed.

	-hpa

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-10-12 17:48 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-06  0:38 [PATCH] gitk: Add "Refs" menu Pavel Roskin
2005-10-06  4:11 ` [PATCH] gitk: Add "Refs" menu - revised Pavel Roskin
2005-10-11 12:17 ` [PATCH] gitk: Add "Refs" menu Paul Mackerras
2005-10-12  1:26   ` Pavel Roskin
2005-10-12  7:31     ` Sven Verdoolaege
2005-10-12 14:34       ` Pavel Roskin
2005-10-12 11:55     ` Marco Costalba
2005-10-12 16:03       ` Pavel Roskin
2005-10-12 17:47       ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).