diff --git a/mercurial/remotenames.py b/mercurial/remotenames.py --- a/mercurial/remotenames.py +++ b/mercurial/remotenames.py @@ -28,6 +28,11 @@ remote += '/' + ref return remote +def getremotevfs(repo): + """ returns a vfs object for .hg/remotenames/ + """ + return vfsmod.vfs(repo.vfs.join(remotenamedir)) + def readremotenamefile(repo, vfs, filename): """ reads a file from .hg/remotenames/ directory and yields it's content @@ -54,7 +59,7 @@ information, call the respective functions. """ - vfs = vfsmod.vfs(repo.vfs.join(remotenamedir)) + vfs = getremotevfs(repo) for bmentry in readremotenamefile(repo, vfs, 'bookmarks'): yield bmentry @@ -66,7 +71,7 @@ If remotepath is passed, the entries with the same remotepath are yielded only. """ - vfs = vfsmod.vfs(repo.vfs.join(remotenamedir)) + vfs = getremotevfs(repo) for bmentry in readremotenamefile(repo, vfs, 'bookmarks'): if bmentry[1] != remotepath: yield bmentry @@ -78,7 +83,7 @@ If remotepath is passed, the entries with the same remotepath are yielded only. """ - vfs = vfsmod.vfs(repo.vfs.join(remotenamedir)) + vfs = getremotevfs(repo) for bmentry in readremotenamefile(repo, vfs, 'branches'): if bmentry[1] != remotepath: yield bmentry @@ -123,7 +128,7 @@ respective files under ".hg/remotenames/" directory. """ - vfs = vfsmod.vfs(repo.vfs.join(remotenamedir)) + vfs = getremotevfs(repo) wlock = repo.wlock() try: if bookmarks: