1
# Copyright (C) 2007 by Jelmer Vernooij <jelmer@samba.org>
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
The Bazaar rebase plugin adds support for rebasing branches to Bazaar.
19
It adds the command 'rebase' to Bazaar. When conflicts occur when replaying
20
patches, the user can resolve the conflict and continue the rebase using the
21
'rebase-continue' command or abort using the 'rebase-abort' command.
24
from __future__ import absolute_import
26
from ... import errors
27
from ...commands import plugin_cmds
29
from ...bzr.bzrdir import BzrFormat
31
BzrFormat.register_feature(b"rebase-v1")
33
from ...i18n import load_plugin_translations
34
translation = load_plugin_translations("bzr-rewrite")
35
gettext = translation.gettext
37
for cmd in ['rebase', 'rebase_abort', 'rebase_continue', 'rebase_todo',
38
'replay', 'pseudonyms', 'rebase_foreign']:
39
plugin_cmds.register_lazy("cmd_%s" % cmd, [], __name__ + ".commands")
42
def show_rebase_summary(params):
43
if getattr(params.new_tree, "_format", None) is None:
45
features = getattr(params.new_tree._format, "features", None)
48
if "rebase-v1" not in features:
54
state = RebaseState1(params.new_tree)
56
replace_map = state.read_plan()[1]
57
except errors.NoSuchFile:
59
todo = list(rebase_todo(params.new_tree.branch.repository, replace_map))
60
params.to_file.write('Rebase in progress. (%d revisions left)\n' % len(todo))
63
from ...hooks import install_lazy_named_hook
65
install_lazy_named_hook(
66
'breezy.status', 'hooks', 'post_status',
67
show_rebase_summary, 'rewrite status')
70
def load_tests(loader, basic_tests, pattern):
74
basic_tests.addTest(loader.loadTestsFromModuleNames(
75
["%s.%s" % (__name__, tmn) for tmn in testmod_names]))