# HG changeset patch # User Martin von Zweigbergk # Date 2022-03-25 05:04:38 # Node ID f808417db5cc9dd9dcd9cc3bb8c1527ed65e6e0c # Parent 7bd5f862b249bf6ba47f89bff9ef29c010db7555 bookmarks: use new function for getting first line of string Differential Revision: https://phab.mercurial-scm.org/D12408 diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -27,6 +27,7 @@ from . import ( util, ) from .utils import ( + stringutil, urlutil, ) @@ -342,7 +343,7 @@ def _readactive(repo, marks): # 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