Patchwork [1,of,3] branchmap: strip '\n' read from cache file as before

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 17, 2018, 1:57 a.m.
Message ID <b892df0766e164fca47d.1534471054@mimosa>
Download mbox | patch
Permalink /patch/33810/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 17, 2018, 1:57 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1534469069 -32400
#      Fri Aug 17 10:24:29 2018 +0900
# Node ID b892df0766e164fca47d3b04cbc9b774db097eb4
# Parent  485a3349d5eed5718cd93a5b3d598e11a5fa3673
branchmap: strip '\n' read from cache file as before

Follows up 2a4bfbb52111.
Pulkit Goyal - Aug. 17, 2018, 11:37 a.m.
On Fri, Aug 17, 2018 at 4:57 AM Yuya Nishihara <yuya@tcha.org> wrote:

> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1534469069 -32400
> #      Fri Aug 17 10:24:29 2018 +0900
> # Node ID b892df0766e164fca47d3b04cbc9b774db097eb4
> # Parent  485a3349d5eed5718cd93a5b3d598e11a5fa3673
> branchmap: strip '\n' read from cache file as before
>

Queued this series, many thanks!

Patch

diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -40,7 +40,7 @@  def _filename(repo):
 def read(repo):
     try:
         f = repo.cachevfs(_filename(repo))
-        cachekey = next(f).split(" ", 2)
+        cachekey = next(f).rstrip('\n').split(" ", 2)
         last, lrev = cachekey[:2]
         last, lrev = bin(last), int(lrev)
         filteredhash = None
@@ -53,6 +53,7 @@  def read(repo):
             raise ValueError(r'tip differs')
         cl = repo.changelog
         for l in f:
+            l = l.rstrip('\n')
             if not l:
                 continue
             node, state, label = l.split(" ", 2)