diff mercurial/branchmap.py @ 31380:7dd2f51f38ac

rbc: empty (and invalid) rbc-names file should give an empty name list An empty file (if it somehow should exist) used to give a list with an empty name. That didn't do any harm, but it was "wrong". Fix that.
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 12 Mar 2017 12:17:30 -0700
parents 906be86990c4
children 7359157b9e46
line wrap: on
line diff
--- a/mercurial/branchmap.py	Wed Oct 19 02:46:35 2016 +0200
+++ b/mercurial/branchmap.py	Sun Mar 12 12:17:30 2017 -0700
@@ -360,7 +360,9 @@
         try:
             bndata = repo.vfs.read(_rbcnames)
             self._rbcsnameslen = len(bndata) # for verification before writing
-            self._names = [encoding.tolocal(bn) for bn in bndata.split('\0')]
+            if bndata:
+                self._names = [encoding.tolocal(bn)
+                               for bn in bndata.split('\0')]
         except (IOError, OSError):
             if readonly:
                 # don't try to use cache - fall back to the slow path