Patchwork [1,of,2] localrepo: use the vfs join method to implement the localrepo join method

login
register
mail settings
Submitter Angel Ezquerra
Date Jan. 2, 2015, 12:31 p.m.
Message ID <2c2eadf76e8b8dbb3abb.1420201860@Angels-MacBook-Pro.local>
Download mbox | patch
Permalink /patch/7299/
State Accepted
Headers show

Comments

Angel Ezquerra - Jan. 2, 2015, 12:31 p.m.
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1419360518 -3600
#      Tue Dec 23 19:48:38 2014 +0100
# Node ID 2c2eadf76e8b8dbb3abb265e87f41252cb1cdacb
# Parent  67d63ec85eb72187508692e52f14be46101707a5
localrepo: use the vfs join method to implement the localrepo join method

This will make it possible to customize the behavior of the join method by
changing the vfs class (e.g. by using the recently introduced "unionvfs" class).

Note that we could have modified the VFS join methods to accept a set of
optional paths in the same way thta the localrepo join method does. However it
seemed simpler to simply call os.path.join before calling self.vfs.join.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -759,7 +759,7 @@ 
         return not self.filtered('visible').changelog.filteredrevs
 
     def join(self, f, *insidef):
-        return os.path.join(self.path, f, *insidef)
+        return self.vfs.join(self.vfs.reljoin(f, *insidef))
 
     def wjoin(self, f, *insidef):
         return os.path.join(self.root, f, *insidef)