/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/plugins/stats/classify.py

  • Committer: Jelmer Vernooij
  • Date: 2020-03-22 01:35:14 UTC
  • mfrom: (7490.7.6 work)
  • mto: This revision was merged to the branch mainline in revision 7499.
  • Revision ID: jelmer@jelmer.uk-20200322013514-7vw1ntwho04rcuj3
merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
"""Classify a commit based on the types of files it changed."""
17
17
 
18
 
from __future__ import absolute_import
19
 
 
20
18
import os.path
21
19
 
22
20
from ... import urlutils
32
30
    """
33
31
    # FIXME: Use mime types? Ohcount?
34
32
    # TODO: It will be better move those filters to properties file
35
 
        # and have possibility to determining own types !?
 
33
    # and have possibility to determining own types !?
36
34
    extension = os.path.splitext(name)[1]
37
35
    if extension in (".c", ".h", ".py", ".cpp", ".rb", ".pm", ".pl", ".ac",
38
 
                        ".java", ".cc", ".proto", ".yy", ".l"):
 
36
                     ".java", ".cc", ".proto", ".yy", ".l"):
39
37
        return "code"
40
38
    if extension in (".html", ".xml", ".txt", ".rst", ".TODO"):
41
39
        return "documentation"
65
63
    # number of lines changed in a file.
66
64
    types = []
67
65
    for d in delta.added + delta.modified:
68
 
        types.append(classify_filename(d[0]))
 
66
        types.append(classify_filename(d.path[1] or d.path[0]))
69
67
    return types