~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Aaron Bentley
  • Date: 2007-04-14 05:52:01 UTC
  • mto: (2520.4.1 bzr.mpbundle)
  • mto: This revision was merged to the branch mainline in revision 2631.
  • Revision ID: abentley@panoramicfeedback.com-20070414055201-hmz83pf1w4whsi79
Add build ranking

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
                     commands.Option('verify', help='verify added texts'),
38
38
                     commands.Option('cache', help='Aggresively cache'),
39
39
                     commands.Option('size', help='Aggressive size'),
 
40
                     commands.Option('build', help='Aggressive build'),
40
41
                    ]
41
42
    hidden = True
42
43
 
43
44
    def run(self, file=None, sync_snapshots=False, snapshot_interval=26,
44
45
            lsprof_timed=False, dump=False, extract=False, single=False,
45
46
            verify=False, outfile=None, memory=False, cache=False,
46
 
            size=False):
 
47
            size=False, build=False):
47
48
        file_weave = get_file_weave(file)
48
49
        url = file_weave.transport.abspath(file_weave.filename)
49
 
        if size:
50
 
            assert memory
51
50
        print >> sys.stderr, 'Importing: %s' % \
52
51
            urlutils.local_path_from_url(url)
53
52
        if sync_snapshots:
63
62
        else:
64
63
            vf = MultiMemoryVersionedFile(snapshot_interval)
65
64
        vf.destroy()
66
 
        snapshots = set(r for r in file_weave.versions() if
 
65
        old_snapshots = set(r for r in file_weave.versions() if
67
66
                        file_weave._index.get_method(r) == 'fulltext')
68
67
        if sync_snapshots:
69
 
            to_sync = snapshots
70
 
        elif size:
 
68
            to_sync = old_snapshots
 
69
        elif size or build:
 
70
            assert memory
71
71
            to_sync = set()
72
72
        else:
73
73
            to_sync = vf.select_snapshots(file_weave)
74
 
        print >> sys.stderr, "%d fulltexts" % len(snapshots)
 
74
        print >> sys.stderr, "%d fulltext(s)" % len(old_snapshots)
75
75
        print >> sys.stderr, "%d planned snapshots" % len(to_sync)
76
76
 
77
77
        try:
81
81
                snapshots = vf.select_by_size(len(snapshots))
82
82
                for version_id in snapshots:
83
83
                    vf.make_snapshot(version_id)
 
84
            if build:
 
85
                ranking = vf.get_build_ranking()
 
86
                snapshots = ranking[:len(snapshots) -\
 
87
                    len(vf._snapshots)]
 
88
                for version_id in snapshots:
 
89
                    old_len = len(vf._snapshots)
 
90
                    #vf.make_snapshot(version_id)
84
91
        except:
85
92
            vf.destroy()
86
93
            raise