Patchwork D12408: bookmarks: use new function for getting first line of string

login
register
mail settings
Submitter phabricator
Date March 25, 2022, 5:38 a.m.
Message ID <differential-rev-PHID-DREV-7bhewz6qmpkgylkninqw-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50750/
State New
Headers show

Comments

phabricator - March 25, 2022, 5:38 a.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12408

AFFECTED FILES
  mercurial/bookmarks.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py
--- a/mercurial/bookmarks.py
+++ b/mercurial/bookmarks.py
@@ -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