~bzr/bzr-pipeline/ppa-daily

« back to all changes in this revision

Viewing changes to pipeline.py

  • Committer: Aaron Bentley
  • Date: 2009-10-31 03:02:05 UTC
  • mfrom: (58.4.19 no-shelver)
  • Revision ID: aaron@aaronbentley.com-20091031030205-rle7rmpkssmmqziy
Avoid Shelver for noninteractive shelving.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    urlutils,
37
37
    workingtree,
38
38
)
 
39
from bzrlib.plugins.pipeline import is_pipe_alias
39
40
 
40
41
 
41
42
class NoSuchPipe(errors.BzrCommandError):
468
469
 
469
470
    def store_uncommitted(self, work_tree, interactive=False):
470
471
        """Store uncommitted changes from this working tree in the pipe."""
 
472
        if not interactive:
 
473
            return self.store_all(work_tree)
471
474
        work_tree.lock_write()
472
475
        try:
473
476
            target_tree = work_tree.basis_tree()
481
484
        finally:
482
485
            work_tree.unlock()
483
486
 
 
487
    def store_all(self, work_tree):
 
488
        work_tree.lock_write()
 
489
        try:
 
490
            target_tree = work_tree.basis_tree()
 
491
            shelf_creator = shelf.ShelfCreator(work_tree, target_tree)
 
492
            try:
 
493
                change = None
 
494
                for change in shelf_creator.iter_shelvable():
 
495
                    shelf_creator.shelve_change(change)
 
496
                if change is None:
 
497
                    return
 
498
                self.shelve_changes(shelf_creator)
 
499
            finally:
 
500
                shelf_creator.finalize()
 
501
        finally:
 
502
            work_tree.unlock()
 
503
        trace.note('Uncommitted changes stored in pipe "%s".',
 
504
                   self.storage.branch.nick)
 
505
 
484
506
    def make_uncommitted_merger(self, work_tree, cleanups):
485
507
        metadata, base_tree, tt = self.get_transform_data(work_tree)
486
508
        if tt is None:
761
783
    return result
762
784
 
763
785
 
 
786
def dwim_pipe(manager, pipe):
 
787
    """Convert a pipe name or alias into a branch."""
 
788
    if pipe[0] == ':' and is_pipe_alias(pipe[1:]):
 
789
        return look_up_pipe(manager, pipe[1:])
 
790
    else:
 
791
        return manager.find_pipe(pipe)
 
792
 
 
793
 
764
794
def tree_to_pipeline(tree):
765
795
    """Convert a colocated tree and branch for use with pipelines.
766
796