changeset 20154:970394b6bd97 stable

hgk: fix tag list parser (issue4101) As tags may have embedded spaces, and "hg tags" command doesn't escape them, the output of the command doesn't make a well-formed list, so we can't just iterate over it. Instead, apply a simple regexp to transform it to a list which we actually use. Line boundary matching should be enabled.
author Andrew Shadura <andrew@shadura.me>
date Sun, 01 Dec 2013 13:53:24 -0600
parents 35bfe5405fb4
children 28fe5abc906f 9d8a9901d4c0
files contrib/hgk
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/hgk	Sun Dec 01 13:45:00 2013 -0600
+++ b/contrib/hgk	Sun Dec 01 13:53:24 2013 -0600
@@ -457,12 +457,10 @@
         }
     }
 
-    foreach {tag rev} $tags {
+    foreach {- tag rev id} [regexp -inline -all -line {^(.+\S)\s+(\d+):(\S+)} $tags] {
         # we use foreach as Tcl8.4 doesn't support lassign
-        foreach {- id} [split $rev :] {
-            lappend tagids($tag) $id
-            lappend idtags($id) $tag
-        }
+        lappend tagids($tag) $id
+        lappend idtags($id) $tag
     }
 
     set status [catch {exec $env(HG) --config ui.report_untrusted=false heads} heads]