changeset 49090:f808417db5cc

bookmarks: use new function for getting first line of string Differential Revision: https://phab.mercurial-scm.org/D12408
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 24 Mar 2022 22:04:38 -0700
parents 7bd5f862b249
children 2d519511c5c3
files mercurial/bookmarks.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bookmarks.py	Thu Mar 24 20:31:44 2022 -0700
+++ b/mercurial/bookmarks.py	Thu Mar 24 22:04:38 2022 -0700
@@ -27,6 +27,7 @@
     util,
 )
 from .utils import (
+    stringutil,
     urlutil,
 )
 
@@ -342,7 +343,7 @@
     # No readline() in osutil.posixfile, reading everything is
     # cheap.
     content = repo.vfs.tryread(b'bookmarks.current')
-    mark = encoding.tolocal((content.splitlines() or [b''])[0])
+    mark = encoding.tolocal(stringutil.firstline(content))
     if mark == b'' or mark not in marks:
         mark = None
     return mark