~ubuntu-branches/debian/experimental/bzr-pipeline/experimental

« back to all changes in this revision

Viewing changes to commands.py

  • Committer: Bazaar Package Importer
  • Author(s): Jelmer Vernooij
  • Date: 2010-05-23 16:16:01 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100523161601-7l0gduy3dc25ulll
Tags: 0.0.1~bzr172-1
New upstream snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
 
from bzrlib import builtins, errors, merge, revision as _mod_revision, trace
 
18
from bzrlib import (
 
19
    builtins,
 
20
    errors,
 
21
    merge,
 
22
    revision as _mod_revision, trace,
 
23
    ui,
 
24
)
19
25
from bzrlib.branch import Branch
20
26
from bzrlib.bzrdir import BzrDir
21
27
from bzrlib.commands import Command
22
 
from bzrlib.option import ListOption, Option, RegistryOption
 
28
from bzrlib.option import Option, RegistryOption
23
29
from bzrlib.osutils import pathjoin
24
30
from bzrlib.switch import switch
25
31
from bzrlib.workingtree import WorkingTree
152
158
            trace.note('Created and switched to pipe "%s".' % pipe)
153
159
 
154
160
 
 
161
class cmd_rename_pipe(PipeCommand):
 
162
    """Rename a pipe to a different name.
 
163
 
 
164
    This will rename the branch directory and update the pipeline metadata.
 
165
    It is not connected to the branch nick.
 
166
    """
 
167
 
 
168
    takes_args = ['new_name']
 
169
 
 
170
    def run(self, new_name):
 
171
        tree, manager = self._get_checkout_manager('.')
 
172
        manager.rename_pipe(new_name, tree)
 
173
 
155
174
class cmd_merge(builtins.cmd_merge):
156
175
    #Support merge --uncommitted PIPE
157
176
    __doc__ = builtins.cmd_merge.__doc__
240
259
        trace.note('Switched from "%s" to "%s".' % (old, target.nick))
241
260
 
242
261
 
 
262
class cmd_store(PipeCommand):
 
263
 
 
264
    hidden = True
 
265
 
 
266
    """Store uncommitted changes in the pipe."""
 
267
 
 
268
    def run(self):
 
269
        checkout, manager = self._get_checkout_manager('.')
 
270
        manager.store_uncommitted(checkout)
 
271
 
 
272
 
243
273
class cmd_show_pipeline(PipeCommand):
244
274
    """Show the current pipeline.
245
275
 
368
398
                else:
369
399
                    raise errors.BzrCommandError(
370
400
                        'No location specified and none remembered.')
371
 
        manager.sync_pipeline(location, remote)
372
 
 
373
 
 
374
 
class cmd_lp_submit(PipeCommand):
375
 
    """Submit the specified pipe to Launchpad."""
376
 
 
377
 
    takes_options = [Option('staging',
378
 
                            help='Propose the merge on staging.'),
379
 
                     Option('message', short_name='m', type=unicode,
380
 
                            help='Commit message.'),
381
 
                     ListOption('review', short_name='R', type=unicode,
382
 
                            help='Requested reviewer and optional type.')]
383
 
 
384
 
    takes_args = ['submit_branch?']
385
 
 
386
 
    def run(self, submit_branch=None, review=None, staging=False,
387
 
            message=None):
388
 
        from bzrlib.plugins.pipeline import lp_submit
389
 
        checkout, manager = self._get_checkout_manager(checkout_optional=True,
390
 
                                                       allow_tree=True)
391
 
        if review is None:
392
 
            reviews = None
393
 
        else:
394
 
            reviews = []
395
 
            for review in review:
396
 
                if '=' in review:
397
 
                    reviews.append(review.split('=', 2))
398
 
                else:
399
 
                    reviews.append((review, ''))
400
 
            if submit_branch is None:
401
 
                submit_branch = manager.storage.branch.get_submit_branch()
402
 
        if submit_branch is None:
403
 
            target = None
404
 
        else:
405
 
            target = Branch.open(submit_branch)
406
 
        submitter = lp_submit.Submitter(checkout, manager, target, message,
407
 
                                        reviews, staging)
408
 
        submitter.check_submission()
409
 
        submitter.submit()
 
401
        try:
 
402
            manager.sync_pipeline(checkout, location, remote)
 
403
        finally:
 
404
            ui.ui_factory.clear_term()