Patchwork [9,of,9] hgk: remove regsub, split on \r instead

login
register
mail settings
Submitter Andrew Shadura
Date March 10, 2013, 4:24 p.m.
Message ID <1bed7812afb93f8186f1.1362932690@localhost.localdomain>
Download mbox | patch
Permalink /patch/1107/
State Accepted
Commit 3131c9da8bf604539e01a60fe706e3dd6d2880d0
Headers show

Comments

Andrew Shadura - March 10, 2013, 4:24 p.m.
# HG changeset patch
# User Andrew Shadura <bugzilla@tut.by>
# Date 1350420254 -7200
# Node ID 1bed7812afb93f8186f14a59ad4e831cb9ffe9ec
# Parent  30be85ab65b1784810b95eb38774dddf94a5d09b
hgk: remove regsub, split on \r instead

No need to regsub all \r\n's to \n's,
we can just split on \r as well; this may
produce extra empty elements in the list,
but they won't match anyway.

Patch

diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -472,9 +472,8 @@  proc readrefs {} {
             exit 2
         }
     }
-    regsub -all "\r\n" $heads "\n" heads
-
-    set lines [split $heads "\n"]
+
+    set lines [split $heads \r\n]
     foreach f $lines {
         set match ""
         regexp {changeset:\s+(\S+):(\S+)$} $f match id sha