[PATCH 3 of 6] hg: update to use vfs functions in shared destination repository

Chinmay Joshi c at chinmayjoshi.com
Thu Jun 19 13:10:21 CDT 2014


On Thu, Jun 19, 2014 at 10:56 PM, FUJIWARA Katsunori
<foozy at lares.dti.ne.jp> wrote:
>
> At Mon, 16 Jun 2014 22:09:43 +0530,
> Chinmay Joshi wrote:
>>
>> # HG changeset patch
>> # User Chinmay Joshi <c at chinmayjoshi.com>
>> # Date 1402932176 -19800
>> #      Mon Jun 16 20:52:56 2014 +0530
>> # Node ID c74650d0e88db42859b07e03d4f266eaae91b2a8
>> # Parent  b230c9509c488d0d2ef0bf9e3375b2ad376153fd
>> hg: update to use vfs functions in shared destination repository
>>
>> This patch uses rvfs with base as root of .hg directory in shared destination
>> repository to update filesystem function with vfs. Some methods are changed to
>> use vfs functions with rvfs.
>>
>> diff --git a/mercurial/hg.py b/mercurial/hg.py
>> --- a/mercurial/hg.py
>> +++ b/mercurial/hg.py
>> @@ -173,14 +173,14 @@
>>      sharedpath = srcrepo.sharedpath # if our source is already sharing
>>
>>      dstvfs = scmutil.vfs(dest, expandpath=True, realpath=True)

Additional expandpath is not explicitly required, since path is
already expanded at previous stage in share itself.

>> -    roothg = os.path.join(root, '.hg')
>
> "roothg" shouldn't be removed in this patch, because it is still
> referred from others until next (#4) patch (see writing 'requires' and
> 'sharedpath' out below in this patch !)

I will take care of this in V2.
>
>
>> +    rvfs = scmutil.vfs(os.path.join(dstvfs.base, '.hg'))
>
> Name of "rvfs" seems to make relation with "dstvfs" weak.
>
> What about "dstwvfs" and "dstvfs" to follow field names of
> localrepository, instead of "dstvfs" and "rvfs" ?
>

I used term 'dstvfs because it was already used in copystrore in hg.py
but I must agree that destvfs is better suited.

>
> Or what about passing ".hg" to "dstvfs" explicitly like below, because
> there are at most four "rvfs" users below ? (this way may be a little
> redundant ...)
>

Sounds good as there are only few users with repository path.

>> -    if os.path.exists(roothg):
>> +    if rvfs.lexists():
>
>        if dstvfs('.hg'):
>
>>          raise util.Abort(_('destination already exists'))
>>
>>      if not dstvfs.isdir():
>>          dstvfs.mkdir()
>> -    util.makedir(roothg, notindexed=True)
>> +    rvfs.makedir()
>
>        dstvfs.makedir('.hg')
>
>>      requirements = ''
>>      try:
>> @@ -193,7 +193,7 @@
>>      util.writefile(os.path.join(roothg, 'requires'), requirements)
>>      util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath)
>
> (in next patch)
>
>        dstvfs.write('.hg/requires', requirements)
>        dstvfs.write('.hg/sharedpath, requirements)
>
>> -    r = repository(ui, root)
>> +    r = repository(ui, dstvfs.base)
>>
>>      default = srcrepo.ui.config('paths', 'default')
>>      if default:
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
>>
>
>
> ----------------------------------------------------------------------
> [FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp


More information about the Mercurial-devel mailing list