/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 push.py

Add progress bar when determining revisions to dpush

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.repository import (
23
23
    InterRepository,
24
24
    )
 
25
from bzrlib.revision import (
 
26
    NULL_REVISION,
 
27
    )
25
28
 
26
29
from bzrlib.plugins.git.converter import (
27
30
    BazaarObjectStore,
132
135
            fetch_spec=None):
133
136
        raise NoPushSupport()
134
137
 
135
 
    def missing_revisions(self, stop_revision=None):
136
 
        if stop_revision is not None:
137
 
            ancestry = [x for x in self.source.get_ancestry(stop_revision) if x is not None]
138
 
        else:
139
 
            ancestry = self.source.all_revision_ids()
 
138
    def missing_revisions(self, stop_revision):
 
139
        if stop_revision is None:
 
140
            raise NotImplementedError
140
141
        missing = []
141
 
        graph = self.source.get_graph()
142
 
        for revid in graph.iter_topo_order(ancestry):
143
 
            if not self.target.has_revision(revid):
144
 
                missing.append(revid)
145
 
        return missing
 
142
        pb = ui.ui_factory.nested_progress_bar()
 
143
        try:
 
144
            graph = self.source.get_graph()
 
145
            for revid, _ in graph.iter_ancestry([stop_revision]):
 
146
                pb.update("determining revisions to fetch", len(missing))
 
147
                if not self.target.has_revision(revid):
 
148
                    missing.append(revid)
 
149
            return graph.iter_topo_order(missing)
 
150
        finally:
 
151
            pb.finished()
146
152
 
147
153
    def dfetch(self, stop_revision=None):
148
154
        """Import the gist of the ancestry of a particular revision."""
150
156
        mapping = self.target.get_mapping()
151
157
        self.source.lock_read()
152
158
        try:
153
 
            todo = self.missing_revisions(stop_revision)
 
159
            todo = [revid for revid in self.missing_revisions(stop_revision) if revid != NULL_REVISION]
154
160
            pb = ui.ui_factory.nested_progress_bar()
155
161
            try:
156
162
                object_generator = MissingObjectsIterator(self.source, mapping, pb)