changeset 18185:5a047276764e

branchmap: move the cache file name into a dedicated function Filtered view of the repo will want to write they file name in a different file.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 24 Dec 2012 03:04:12 +0100
parents 8d48af68e2ae
children d336f53cb2e3
files mercurial/branchmap.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/branchmap.py	Tue Jan 01 18:19:24 2013 +0100
+++ b/mercurial/branchmap.py	Mon Dec 24 03:04:12 2012 +0100
@@ -9,9 +9,13 @@
 import encoding
 import util
 
+def _filename(repo):
+    """name of a branchcache file for a given repo"""
+    return "cache/branchheads"
+
 def read(repo):
     try:
-        f = repo.opener("cache/branchheads")
+        f = repo.opener(_filename(repo))
         lines = f.read().split('\n')
         f.close()
     except (IOError, OSError):
@@ -117,7 +121,7 @@
 
     def write(self, repo):
         try:
-            f = repo.opener("cache/branchheads", "w", atomictemp=True)
+            f = repo.opener(_filename(repo), "w", atomictemp=True)
             cachekey = [hex(self.tipnode), str(self.tiprev)]
             if self.filteredhash is not None:
                 cachekey.append(hex(self.filteredhash))