diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py
index 3a7efcbdf288efd790ab0356152394ab441585dd_bWVyY3VyaWFsL2JyYW5jaG1hcC5weQ==..f0fa0fc4900ac6c62b39d88dbd65867d0e6a82cb_bWVyY3VyaWFsL2JyYW5jaG1hcC5weQ== 100644
--- a/mercurial/branchmap.py
+++ b/mercurial/branchmap.py
@@ -305,7 +305,7 @@
 
     def copy(self):
         """return an deep copy of the branchcache object"""
-        return branchcache(
+        return type(self)(
             self._entries, self.tipnode, self.tiprev, self.filteredhash,
             self._closednodes)