Switch to unified view

a/Allura/allura/model/stats.py b/Allura/allura/model/stats.py
...
...
18
from datetime import datetime
18
from datetime import datetime
19
import pymongo
19
import pymongo
20
from pylons import tmpl_context as c, app_globals as g
20
from pylons import tmpl_context as c, app_globals as g
21
from pylons import request
21
from pylons import request
22
from tg import config
22
from tg import config
23
from paste.deploy.converters import asbool
23
24
24
import bson
25
import bson
25
from ming import schema as S
26
from ming import schema as S
26
from ming import Field, Index, collection
27
from ming import Field, Index, collection
27
from ming.orm import session, state, Mapper
28
from ming.orm import session, state, Mapper
...
...
499
        d = newcommit.diffs
500
        d = newcommit.diffs
500
        if len(newcommit.parent_ids) > 0:
501
        if len(newcommit.parent_ids) > 0:
501
            oldcommit = newcommit.repo.commit(newcommit.parent_ids[0])
502
            oldcommit = newcommit.repo.commit(newcommit.parent_ids[0])
502
503
503
        totlines = 0
504
        totlines = 0
505
        if asbool(config.get('userstats.count_lines_of_code', True)):
504
        for changed in d.changed:
506
            for changed in d.changed:
505
            newblob = newcommit.tree.get_blob_by_path(changed)
507
                newblob = newcommit.tree.get_blob_by_path(changed)
506
            oldblob = oldcommit.tree.get_blob_by_path(changed)
508
                oldblob = oldcommit.tree.get_blob_by_path(changed)
507
            totlines+=_computeLines(newblob, oldblob)
509
                totlines+=_computeLines(newblob, oldblob)
508
510
509
        for copied in d.copied:
511
            for copied in d.copied:
510
            newblob = newcommit.tree.get_blob_by_path(copied['new'])
512
                newblob = newcommit.tree.get_blob_by_path(copied['new'])
511
            oldblob = oldcommit.tree.get_blob_by_path(copied['old'])
513
                oldblob = oldcommit.tree.get_blob_by_path(copied['old'])
512
            totlines+=_computeLines(newblob, oldblob)
514
                totlines+=_computeLines(newblob, oldblob)
513
515
514
        for added in d.added:
516
            for added in d.added:
515
            newblob = newcommit.tree.get_blob_by_path(added)
517
                newblob = newcommit.tree.get_blob_by_path(added)
516
            totlines+=_computeLines(newblob)
518
                totlines+=_computeLines(newblob)
517
519
518
        _addCommitData(self, topics, languages, totlines)
520
        _addCommitData(self, topics, languages, totlines)
519
521
520
        self.lastmonth.commits.append(dict(
522
        self.lastmonth.commits.append(dict(
521
            datetime=commit_datetime,
523
            datetime=commit_datetime,