Would like to create some defaults for my .hgignore files in TortoiseHG/Mercurial

后端 未结 4 1176
温柔的废话
温柔的废话 2020-12-30 10:57

I\'d like to make it so that every time I create a new repository, certain filters automatically get added to my .hgignore files by default.

For example, for C# proj

相关标签:
4条回答
  • 2020-12-30 11:38

    Just to clarify, it is safe to copy a .hgignore from one repos to another, it is just a plain old simple text file.

    0 讨论(0)
  • 2020-12-30 11:45

    hg add .hgignore ?

    Perhaps you could clone from a repo that only had that file checked in. :)

    Otherwise you'd have to write a small extension that did this in hg init somehow

    0 讨论(0)
  • 2020-12-30 11:46

    I use ~/.hgignore and just cp that into my repo.

    In my ~/.hgrc:

    [ui]
    ignore.other = ~/.hgignore
    

    I just put the really obvious stuff in that one. And copy it for project specific stuff.

    I don't think its quite what you're asking for as there is no automation, but it does the trick.

    Windows users, see Ry4an's comment below.

    0 讨论(0)
  • 2020-12-30 11:49

    You could use a post-init hook to do it for you:

    [hooks]
    post-init.ignore-bin = echo 'glob:bin/*' >> .hgignore
    post-init.ignore-obj = echo 'glob:obj/*' >> .hgignore
    

    This form only works with the mkdir sample && cd sample && hg init style of creating a repo If you use the faster hg init sample form it will dump the new .hgignore file into the current directory.

    You could write a more intelligent hook script if you prefer using hg init name.

    0 讨论(0)
提交回复
热议问题