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

Andrew Shadura bugzilla at tut.by
Sun Mar 10 11:24:50 CDT 2013


# HG changeset patch
# User Andrew Shadura <bugzilla at 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.

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


More information about the Mercurial-devel mailing list