mercurial/ignore.py
changeset 18089 0127366df8fe
parent 18088 52620e5db2f6
child 25065 8cf7f0c4cb14
equal deleted inserted replaced
18088:52620e5db2f6 18089:0127366df8fe
    68                 warn("%s: %s\n" % (f, warning))
    68                 warn("%s: %s\n" % (f, warning))
    69         except IOError, inst:
    69         except IOError, inst:
    70             if f != files[0]:
    70             if f != files[0]:
    71                 warn(_("skipping unreadable ignore file '%s': %s\n") %
    71                 warn(_("skipping unreadable ignore file '%s': %s\n") %
    72                      (f, inst.strerror))
    72                      (f, inst.strerror))
    73     return pats
    73     return [(f, pats[f]) for f in files if f in pats]
    74 
    74 
    75 def ignore(root, files, warn):
    75 def ignore(root, files, warn):
    76     '''return matcher covering patterns in 'files'.
    76     '''return matcher covering patterns in 'files'.
    77 
    77 
    78     the files parsed for patterns include:
    78     the files parsed for patterns include:
    93     pattern        # pattern of the current default type'''
    93     pattern        # pattern of the current default type'''
    94 
    94 
    95     pats = readpats(root, files, warn)
    95     pats = readpats(root, files, warn)
    96 
    96 
    97     allpats = []
    97     allpats = []
    98     for patlist in pats.values():
    98     for f, patlist in pats:
    99         allpats.extend(patlist)
    99         allpats.extend(patlist)
   100     if not allpats:
   100     if not allpats:
   101         return util.never
   101         return util.never
   102 
   102 
   103     try:
   103     try:
   104         ignorefunc = match.match(root, '', [], allpats)
   104         ignorefunc = match.match(root, '', [], allpats)
   105     except util.Abort:
   105     except util.Abort:
   106         # Re-raise an exception where the src is the right file
   106         # Re-raise an exception where the src is the right file
   107         for f, patlist in pats.iteritems():
   107         for f, patlist in pats:
   108             try:
   108             try:
   109                 match.match(root, '', [], patlist)
   109                 match.match(root, '', [], patlist)
   110             except util.Abort, inst:
   110             except util.Abort, inst:
   111                 raise util.Abort('%s: %s' % (f, inst[0]))
   111                 raise util.Abort('%s: %s' % (f, inst[0]))
   112 
   112