From: lennart spitzner <lsp@informatik.uni-kiel.de>
To: git@vger.kernel.org
Cc: Paul Mackerras <paulus@samba.org>
Subject: [PATCH 1/1] gitk: Add support for --author-date-order
Date: Fri, 14 Nov 2014 00:06:03 +0100 [thread overview]
Message-ID: <5465395B.5020807@informatik.uni-kiel.de> (raw)
gitk previously allowed sort-by-committer-date.
Now also allow sort-by-author-date.
Separate the three options for ordering in a new line in the
view-config-dialogue, using radio buttons.
Signed-off-by: Lennart Spitzner <lsp@informatik.uni-kiel.de>
---
Found this useful for displaying a history with a rebase-heavy workflow,
where the committer-timestamps were largely different from
author-timestamps; sort-by-author-date produces a much simpler graph.
I do not really know much tcl, so review closely :p
gitk | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/gitk b/gitk
index 78358a7..c176b79 100755
--- a/gitk
+++ b/gitk
@@ -155,11 +155,12 @@ proc unmerged_files {files} {
}
proc parseviewargs {n arglist} {
- global vdatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env
+ global vdatemode vauthordatemode vmergeonly vflags vdflags vrevs vfiltered vorigargs env
global vinlinediff
global worddiff git_version
set vdatemode($n) 0
+ set vauthordatemode($n) 0
set vmergeonly($n) 0
set vinlinediff($n) 0
set glflags {}
@@ -185,6 +186,12 @@ proc parseviewargs {n arglist} {
set origargs [lreplace $origargs $i $i]
incr i -1
}
+ "--author-date-order" {
+ set vauthordatemode($n) 1
+ # remove from origargs in case we hit an unknown option
+ set origargs [lreplace $origargs $i $i]
+ incr i -1
+ }
"-[puabwcrRBMC]" -
"--no-renames" - "--full-index" - "--binary" - "--abbrev=*" -
"--find-copies-harder" - "-l*" - "--ext-diff" - "--no-ext-diff" -
@@ -690,17 +697,21 @@ proc seeds {v} {
}
proc newvarc {view id} {
- global varcid varctok parents children vdatemode
+ global varcid varctok parents children vdatemode vauthordatemode
global vupptr vdownptr vleftptr vbackptr varcrow varcix varcstart
global commitdata commitinfo vseedcount varccommits vlastins
set a [llength $varctok($view)]
set vid $view,$id
- if {[llength $children($vid)] == 0 || $vdatemode($view)} {
+ if {[llength $children($vid)] == 0 || $vdatemode($view) || $vauthordatemode($view)} {
if {![info exists commitinfo($id)]} {
parsecommit $id $commitdata($id) 1
}
- set cdate [lindex [lindex $commitinfo($id) 4] 0]
+ if {$vauthordatemode($view)} {
+ set cdate [lindex [lindex $commitinfo($id) 2] 0]
+ } else {
+ set cdate [lindex [lindex $commitinfo($id) 4] 0]
+ }
if {![string is integer -strict $cdate]} {
set cdate 0
}
@@ -800,7 +811,7 @@ proc splitvarc {p v} {
proc renumbervarc {a v} {
global parents children varctok varcstart varccommits
- global vupptr vdownptr vleftptr vbackptr vlastins varcid vtokmod vdatemode
+ global vupptr vdownptr vleftptr vbackptr vlastins varcid vtokmod vdatemode vauthordatemode
set t1 [clock clicks -milliseconds]
set todo {}
@@ -836,7 +847,7 @@ proc renumbervarc {a v} {
$children($v,$id)]
}
set oldtok [lindex $varctok($v) $a]
- if {!$vdatemode($v)} {
+ if {!($vdatemode($v) || $vauthordatemode($v))} {
set tok {}
} else {
set tok $oldtok
@@ -1411,7 +1422,7 @@ proc check_interest {id scripts} {
proc getcommitlines {fd inst view updating} {
global cmitlisted leftover
- global commitidx commitdata vdatemode
+ global commitidx commitdata vdatemode vauthordatemode
global parents children curview hlview
global idpending ordertok
global varccommits varcid varctok vtokmod vfilelimit vshortids
@@ -1553,7 +1564,7 @@ proc getcommitlines {fd inst view updating} {
} elseif {$a == 0 && [llength $children($vid)] == 1} {
set k [lindex $children($vid) 0]
if {[llength $parents($view,$k)] == 1 &&
- (!$vdatemode($view) ||
+ (!($vdatemode($view) || $vauthordatemode($view)) ||
$varcid($view,$k) == [llength $varctok($view)] - 1)} {
set a $varcid($view,$k)
}
@@ -3987,8 +3998,11 @@ set known_view_options {
{limit_lbl l + {} {mc "Limit and/or skip a number of revisions (positive integer):"}}
{limit t10 *. "--max-count=*" {mc "Number to show:"}}
{skip t10 . "--skip=*" {mc "Number to skip:"}}
+ {order_l l + {} {mc "Ordering:"}}
+ {order_s r0 . {} {mc "Default order"}}
+ {order_c r1 . {"--date-order" "-d"} {mc "Strictly sort by (committer) date"}}
+ {order_a r2 . "--author-date-order" {mc "Strictly sort by author date"}}
{misc_lbl l + {} {mc "Miscellaneous options:"}}
- {dorder b *. {"--date-order" "-d"} {mc "Strictly sort by date"}}
{lright b . "--left-right" {mc "Mark branch sides"}}
{first b . "--first-parent" {mc "Limit to first parent"}}
{smplhst b . "--simplify-by-decoration" {mc "Simple history"}}
@@ -12308,6 +12322,7 @@ if {$cmdline_files ne {} || $revtreeargs ne {} || $revtreeargscmd ne {}} {
set viewargscmd(1) $revtreeargscmd
set viewperm(1) 0
set vdatemode(1) 0
+ set vauthordatemode(1) 0
addviewmenu 1
.bar.view entryconf [mca "Edit view..."] -state normal
.bar.view entryconf [mca "Delete view"] -state normal
--
2.1.3
reply other threads:[~2014-11-13 23:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5465395B.5020807@informatik.uni-kiel.de \
--to=lsp@informatik.uni-kiel.de \
--cc=git@vger.kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).