/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: 2018-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

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
 
18
20
import os.path
19
21
 
20
22
from ... import urlutils
30
32
    """
31
33
    # FIXME: Use mime types? Ohcount?
32
34
    # TODO: It will be better move those filters to properties file
33
 
    # and have possibility to determining own types !?
 
35
        # and have possibility to determining own types !?
34
36
    extension = os.path.splitext(name)[1]
35
37
    if extension in (".c", ".h", ".py", ".cpp", ".rb", ".pm", ".pl", ".ac",
36
 
                     ".java", ".cc", ".proto", ".yy", ".l"):
 
38
                        ".java", ".cc", ".proto", ".yy", ".l"):
37
39
        return "code"
38
40
    if extension in (".html", ".xml", ".txt", ".rst", ".TODO"):
39
41
        return "documentation"
63
65
    # number of lines changed in a file.
64
66
    types = []
65
67
    for d in delta.added + delta.modified:
66
 
        types.append(classify_filename(d.path[1] or d.path[0]))
 
68
        types.append(classify_filename(d[0]))
67
69
    return types