branchmap: prevent reading the file twice through different iterators

Authored by pulkit.

Description

branchmap: prevent reading the file twice through different iterators

Otherwise, test-static-http.t breaks.

Differential Revision: https://phab.mercurial-scm.org/D6028