[PATCH 2 of 2] rbc: empty (and invalid) rbc-names file should give an empty name list

Augie Fackler raf at durin42.com
Sun Mar 12 16:16:59 EDT 2017


On Sun, Mar 12, 2017 at 12:33:56PM -0700, Mads Kiilerich wrote:
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1489346250 25200
> #      Sun Mar 12 12:17:30 2017 -0700
> # Node ID 1b5144a87e936fc8071463956816a89041478126
> # Parent  023b6f7456b3622cc81332ae9d6e30b7ecc37415
> rbc: empty (and invalid) rbc-names file should give an empty name list

queued these, thanks

>
> 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.
>
> diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
> --- a/mercurial/branchmap.py
> +++ b/mercurial/branchmap.py
> @@ -362,7 +362,9 @@ class revbranchcache(object):
>          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
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list