[Updated] D12408: bookmarks: use new function for getting first line of string

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed Apr 6 10:10:32 UTC 2022


Closed by commit rHGf808417db5cc: bookmarks: use new function for getting first line of string (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D12408?vs=32705&id=32808

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D12408/new/

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

AFFECTED FILES
  mercurial/bookmarks.py

CHANGE DETAILS

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



To: martinvonz, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220406/09bc8f9c/attachment-0002.html>


More information about the Mercurial-patches mailing list