Can Mercurial be made to preserve file permissions?

前端 未结 5 1873
星月不相逢
星月不相逢 2021-01-30 10:19

I\'ve seen a number of blog posts, and have experienced for myself, that Mercurial does not preserve the permissions on files pushed from one repo to another. Does anyone know

5条回答
  •  死守一世寂寞
    2021-01-30 11:18

    It looks like it can be done using hooks and an auxiliary tool (and a little chewing gum and baling wire):

    1. Get David Hardeman's Metastore, which saves and restores file metadata.

    2. Alter the sources so it will ignore directory .hg as well as .git.

    3. Use the following Mercurial hooks:

       precommit.meta = metastore -s
      
       changegroup.update = hg update
       update.meta   = /usr/unsup/nr/bin/metastore -a
      

    You have to add the .metadata file to the repo.

    This lashup will work most of the time, but if you change only permissions and want to propagate it, you'll have to run metastore -s in order to push those changes into the .metadata file where hg will see the change; otherwise the commit thinks nothing is new.

提交回复
热议问题