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

« back to all changes in this revision

Viewing changes to __init__.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:
34
34
                        copy
35
35
pipe-patches            Export the pipeline as a collection of patches,
36
36
                        one per pipe
37
 
lp-submit               Submit the specified pipe to Launchpad
38
37
====================    =======================================================
39
38
 
40
39
It also extends `merge --uncommitted` to work with pipes.
112
111
from bzrlib.directory_service import AliasDirectory, directories
113
112
 
114
113
 
115
 
supported_bzrlib_version = [(2, x, 0) for x in range(1, 2)]
 
114
supported_bzrlib_version = [(2, x, 0) for x in range(2, 3)]
116
115
api.require_any_api(bzrlib, supported_bzrlib_version)
117
116
 
118
117
 
124
123
 
125
124
register('cmd_add_pipe')
126
125
register('cmd_remove_pipe')
 
126
register('cmd_rename_pipe')
127
127
register('cmd_switch_pipe', ['swp'])
 
128
register('cmd_store')
128
129
register('cmd_show_pipeline', ['pipes'])
129
130
register('cmd_pipe_patches')
130
131
register('cmd_pump')
131
132
register('cmd_merge')
132
133
register('cmd_reconfigure_pipeline')
133
134
register('cmd_sync_pipeline')
134
 
register('cmd_lp_submit')
135
135
plugin_cmds.register_lazy('cmd_import_loom', [],
136
136
                          'bzrlib.plugins.pipeline.loom')
137
137
 
157
157
directories.register(':', PipeAliasDirectory,
158
158
                     'Easy access to remembered branch locations')
159
159
 
 
160
try:
 
161
    from bzrlib.plugins.launchpad import lp_api
 
162
    from bzrlib.plugins.launchpad import lp_propose
 
163
except ImportError:
 
164
    pass
 
165
else:
 
166
    def get_prerequisite_from_pipe(hook_params):
 
167
        from bzrlib.plugins.pipeline.pipeline import PipeManager
 
168
        source_branch = hook_params['source_branch']
 
169
        launchpad = hook_params['launchpad']
 
170
        manager = PipeManager(source_branch.bzr)
 
171
        prev_pipe = manager.get_prev_pipe()
 
172
        if prev_pipe is not None:
 
173
            prerequisite_branch = lp_api.LaunchpadBranch.from_bzr(launchpad,
 
174
                                                                  prev_pipe)
 
175
            if (prerequisite_branch.lp.bzr_identity
 
176
                == hook_params['target_branch'].lp.bzr_identity):
 
177
                prerequisite_branch = None
 
178
        else:
 
179
            prerequisite_branch = None
 
180
        return prerequisite_branch
 
181
 
 
182
 
 
183
    # XXX: When we move the pipeline command, we should make sure it
 
184
    # constructs Submitter correctly.
 
185
    lp_propose.Proposer.hooks.install_named_hook(
 
186
        'get_prerequisite', get_prerequisite_from_pipe,
 
187
        'Get the prerequisite from the pipeline')
 
188
 
160
189
 
161
190
def test_suite():
162
191
    from bzrlib.tests.TestUtil import TestLoader, TestSuite