changeset 24531:18ee81b37928

hgk: use switch instead of a less efficient if/elseif/if
author Andrew Shadura <andrew@shadura.me>
date Sun, 29 Mar 2015 19:15:04 +0200
parents 2ace3b77aaef
children f5de208a635c
files contrib/hgk
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/hgk	Sun Mar 29 19:12:08 2015 +0200
+++ b/contrib/hgk	Sun Mar 29 19:15:04 2015 +0200
@@ -375,25 +375,25 @@
 		set inhdr 0
 	    } else {
 		set tag [lindex $line 0]
-		if {$tag == "author"} {
+		switch -- $tag "author" {
 		    set x [expr {[llength $line] - 2}]
 		    set audate [lindex $line $x]
 		    set auname [join [lrange $line 1 [expr {$x - 1}]]]
-		} elseif {$tag == "committer"} {
+		} "committer" {
 		    set x [expr {[llength $line] - 2}]
 		    set comdate [lindex $line $x]
 		    set comname [join [lrange $line 1 [expr {$x - 1}]]]
-		} elseif {$tag == "revision"} {
+		} "revision" {
 		    set rev [lindex $line 1]
-        } elseif {$tag == "branch"} {
+		} "branch" {
 		    set branch [join [lrange $line 1 end]]
-        } elseif {$tag == "bookmark"} {
+		} "bookmark" {
 		    set bookmark [join [lrange $line 1 end]]
-        } elseif {$tag == "obsolete"} {
+		} "obsolete" {
 		    set obsolete($id) ""
-        } elseif {$tag == "phase"} {
+		} "phase" {
 		    set phase [lindex $line 1 end]
-        }
+		}
 	    }
 	} else {
 	    if {$comment == {}} {