Patchwork [3,of,6,V2,RFC] localrepo: use the vfs join method to implement the localrepo join method

login
register
mail settings
Submitter Angel Ezquerra
Date Dec. 26, 2014, 11:46 a.m.
Message ID <f03bef0e2051c76f7dcf.1419594411@108.1.168.192.in-addr.arpa>
Download mbox | patch
Permalink /patch/7244/
State Accepted
Commit f8df993516d0c0977374c1ed0d12b46e7a6a4d68
Headers show

Comments

Angel Ezquerra - Dec. 26, 2014, 11:46 a.m.
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra@gmail.com>
# Date 1419360518 -3600
#      Tue Dec 23 19:48:38 2014 +0100
# Node ID f03bef0e2051c76f7dcfd5f580f58037e9dac50a
# Parent  3229dbe4251c8fed502c6c7914e03350dd1c5f5d
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.
Pierre-Yves David - Dec. 30, 2014, 9:26 p.m.
On 12/26/2014 03:46 AM, Angel Ezquerra wrote:
> # HG changeset patch
> # User Angel Ezquerra <angel.ezquerra@gmail.com>
> # Date 1419360518 -3600
> #      Tue Dec 23 19:48:38 2014 +0100
> # Node ID f03bef0e2051c76f7dcfd5f580f58037e9dac50a
> # Parent  3229dbe4251c8fed502c6c7914e03350dd1c5f5d
> 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.

This patch wants to:
- come first, without and RFC flag,
- also use the vfs.reljoin() method recently introduced.

Otherwise I'm super happy to see it.
Angel Ezquerra - Jan. 2, 2015, 12:32 p.m.
On Tue, Dec 30, 2014 at 10:26 PM, Pierre-Yves David
<pierre-yves.david@ens-lyon.org> wrote:
>
>
> On 12/26/2014 03:46 AM, Angel Ezquerra wrote:
>>
>> # HG changeset patch
>> # User Angel Ezquerra <angel.ezquerra@gmail.com>
>> # Date 1419360518 -3600
>> #      Tue Dec 23 19:48:38 2014 +0100
>> # Node ID f03bef0e2051c76f7dcfd5f580f58037e9dac50a
>> # Parent  3229dbe4251c8fed502c6c7914e03350dd1c5f5d
>> 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.
>
>
> This patch wants to:
> - come first, without and RFC flag,
> - also use the vfs.reljoin() method recently introduced.
>
> Otherwise I'm super happy to see it.
>
> --
> Pierre-Yves David

OK, I just sent a new patch series containing this patch, modified as
you suggested, and a follow up patch that changes
localrepository.wjoin to also use self.vfs.reljoin rather than
os.path.join.

Cheers,

Angel

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -765,7 +765,7 @@ 
         return None
 
     def join(self, f, *insidef):
-        return os.path.join(self.path, f, *insidef)
+        return self.vfs.join(os.path.join(f, *insidef))
 
     def wjoin(self, f, *insidef):
         return os.path.join(self.root, f, *insidef)