rbc: empty (and invalid) rbc-names file should give an empty name list
authorMads Kiilerich <mads@kiilerich.com>
Sun, 12 Mar 2017 12:17:30 -0700
changeset 31371 7dd2f51f38ac
parent 31370 906be86990c4
child 31372 06440ba06bc0
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.
mercurial/branchmap.py
--- 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