Mercurial's. hgignore Method

Source: Internet
Author: User
Tags mercurial

After reading more than N introductions, the results are all in one sentence-clear at a glance ...... In fact, those examples do not cover common requirements, so I am very confused. Study for yourself.

Hgignore supports two syntaxes: Python/perl-style Regular Expressions and system shell. Although the shell syntax is clear at a glance, it is recommended to use Regexp. First, you do not need to specify the syntax in the file (the regular expression is the default syntax), and second, it is more controllable.

There are two common requirements: filter out specific types of files (usually by the suffix) and filter out files in a specific folder.

Filter the writing of a specific suffix

  1. /. Xxx $

"/." Is ".", because "." has a special meaning in the regular expression, so "/" must be added before escape. "$" Indicates the end, so the above expression indicates matching the file ended with ". xxx"

Filter the writing of a specific folder

  1. ^ Folder/

The path Separator of python is "/", which can be transplanted on different operating systems. "^" Indicates start. The complete file name is path/filename. Therefore, the above expression indicates that the file starts with "folder.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.