~ursinha/lp-qa-tools/bzr-tarmacland

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: Diogo Matsubara
  • Date: 2010-09-09 12:27:00 UTC
  • mto: This revision was merged to the branch mainline in revision 73.
  • Revision ID: diogo.matsubara@canonical.com-20100909122700-5upkmmw24qux6iel
Implements additional options to the lpland.py plugin: removes the restriction to use the --no-qa and --incremental option together and implements the --rollback option.

Show diffs side-by-side

added added

removed removed

Lines of Context:
137
137
        Option(
138
138
            'incremental',
139
139
            help="Incremental to other bug fix (tags commit with [incr])."),
 
140
        Option(
 
141
            'rollback', type=int,
 
142
            help=(
 
143
                "Rollback given revision number. (tags commit with "
 
144
                "[rollback=revno]).")),
140
145
        ]
141
146
 
142
 
    def run(self, location=None, dry_run=False, testfix=False, 
143
 
            no_qa=False, incremental=False):
 
147
    def run(self, location=None, dry_run=False, testfix=False,
 
148
            no_qa=False, incremental=False, rollback=None):
144
149
        from bzrlib.plugins.pqm.lpland import Submitter
145
150
        from bzrlib import branch as _mod_branch
146
151
        from bzrlib.plugins.pqm.lpland import (
147
152
            MissingReviewError, MissingBugsError, MissingBugsIncrementalError)
148
153
 
149
 
 
150
 
        if no_qa and incremental:
151
 
            raise BzrCommandError(
152
 
                "--no-qa and --incremental cannot be given at the same time.")
153
 
 
154
154
        branch = _mod_branch.Branch.open_containing('.')[0]
155
155
        if dry_run:
156
156
            outf = self.outf
157
157
        else:
158
158
            outf = None
 
159
        if rollback and (no_qa or incremental):
 
160
            print "--rollback option used. Ignoring --no-qa and --incremental."
159
161
        try:
160
 
            submitter = Submitter(branch, location, testfix, no_qa, incremental
161
 
                ).run(outf)
 
162
            submitter = Submitter(branch, location, testfix, no_qa,
 
163
                incremental, rollback=rollback).run(outf)
162
164
        except MissingReviewError:
163
165
            raise BzrCommandError(
164
166
                "Cannot land branches that haven't got approved code "