/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 processors/generic_processor.py

  • Committer: Ian Clatworthy
  • Date: 2009-08-17 06:06:47 UTC
  • mto: (0.64.207 trunk)
  • mto: This revision was merged to the branch mainline in revision 6631.
  • Revision ID: ian.clatworthy@canonical.com-20090817060647-45sj0g5012w1qqhu
Update the working tree for trunk implicitly

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    progress,
27
27
    )
28
28
from bzrlib.repofmt import pack_repo
29
 
from bzrlib.trace import note
 
29
from bzrlib.trace import note, mutter
30
30
import bzrlib.util.configobj.configobj as configobj
31
31
from bzrlib.plugins.fastimport import (
32
32
    branch_updater,
298
298
        if branches_lost:
299
299
            if not self.repo.is_shared():
300
300
                self.warning("Cannot import multiple branches into "
301
 
                    "an unshared repository")
 
301
                    "a standalone branch")
302
302
            self.warning("Not creating branches for these head revisions:")
303
303
            for lost_info in branches_lost:
304
304
                head_revision = lost_info[1]
315
315
        elif self.params.get('trees', False):
316
316
            trees = self._get_working_trees(branches_updated)
317
317
            if trees:
318
 
                self.note("Updating the working trees ...")
319
 
                if self.verbose:
320
 
                    report = delta._ChangeReporter()
321
 
                else:
322
 
                    reporter = None
323
 
                for wt in trees:
324
 
                    wt.update(reporter)
325
 
                    self._tree_count += 1
 
318
                self._update_working_trees(trees)
326
319
                remind_about_update = False
327
320
            else:
328
321
                self.warning("No working trees available to update")
 
322
        else:
 
323
            # Update just the trunk. (This is always the first branch
 
324
            # returned by the branch updater.)
 
325
            trunk_branch = branches_updated[0]
 
326
            trees = self._get_working_trees([trunk_branch])
 
327
            if trees:
 
328
                self._update_working_trees(trees)
 
329
                remind_about_update = self._branch_count > 1
329
330
 
330
331
        # Dump the cache stats now because we clear it before the final pack
331
332
        if self.verbose:
341
342
        self.dump_stats()
342
343
        if remind_about_update:
343
344
            # This message is explicitly not timestamped.
344
 
            note("To refresh the working tree for a branch, "
345
 
                "use 'bzr update'.")
 
345
            note("To refresh the working tree for other branches, "
 
346
                "use 'bzr update' inside that branch.")
 
347
 
 
348
    def _update_working_trees(self, trees):
 
349
        if self.verbose:
 
350
            reporter = delta._ChangeReporter()
 
351
        else:
 
352
            reporter = None
 
353
        for wt in trees:
 
354
            self.note("Updating the working tree for %s ...", wt.basedir)
 
355
            wt.update(reporter)
 
356
            self._tree_count += 1
346
357
 
347
358
    def _pack_repository(self, final=True):
348
359
        # Before packing, free whatever memory we can and ensure
377
388
        result = []
378
389
        wt_expected = self.repo.make_working_trees()
379
390
        for br in branches:
380
 
            if br == self.branch and br is not None:
381
 
                wt = self.working_tree
 
391
            if br is None:
 
392
                continue
 
393
            elif br == self.branch:
 
394
                if self.working_tree:
 
395
                    result.append(self.working_tree)
382
396
            elif wt_expected:
383
397
                try:
384
 
                    wt = br.bzrdir.open_workingtree()
 
398
                    result.append(br.bzrdir.open_workingtree())
385
399
                except errors.NoWorkingTree:
386
400
                    self.warning("No working tree for branch %s", br)
387
 
                    continue
388
 
            else:
389
 
                continue
390
 
            result.append(wt)
391
401
        return result
392
402
 
393
403
    def dump_stats(self):