/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.436.25 by Jelmer Vernooij
Add setup.py.
1
# Copyright (C) 2007 by Jelmer Vernooij <jelmer@samba.org>
0.436.177 by Jelmer Vernooij
Remove trailing whitespace.
2
#
0.436.2 by Jelmer Vernooij
Add stubs for testsuite, rebase-continue and rebase-abort commands.
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
0.436.131 by Jelmer Vernooij
Change license back to GPLv2+
5
# the Free Software Foundation; either version 2 of the License, or
0.436.2 by Jelmer Vernooij
Add stubs for testsuite, rebase-continue and rebase-abort commands.
6
# (at your option) any later version.
7
#
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.
12
#
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
0.436.25 by Jelmer Vernooij
Add setup.py.
16
"""Rebase support.
17
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.
22
"""
0.436.1 by Jelmer Vernooij
Add framework for git-rebase plugin.
23
7406.3.2 by Jelmer Vernooij
Update for breezy.
24
from ... import errors
25
from ...commands import plugin_cmds
0.436.1 by Jelmer Vernooij
Add framework for git-rebase plugin.
26
7406.3.2 by Jelmer Vernooij
Update for breezy.
27
from ...bzr.bzrdir import BzrFormat
0.436.248 by Jelmer Vernooij
Use feature flags.
28
7406.3.3 by Jelmer Vernooij
Fix python3 compatibility.
29
BzrFormat.register_feature(b"rebase-v1")
0.436.248 by Jelmer Vernooij
Use feature flags.
30
7406.3.2 by Jelmer Vernooij
Update for breezy.
31
from ...i18n import load_plugin_translations
0.436.245 by Jelmer Vernooij
Drop < 2.5 support.
32
translation = load_plugin_translations("bzr-rewrite")
7406.3.3 by Jelmer Vernooij
Fix python3 compatibility.
33
gettext = translation.gettext
0.449.1 by Jonathan Riddell
add gettext to strings
34
7406.3.2 by Jelmer Vernooij
Update for breezy.
35
for cmd in ['rebase', 'rebase_abort', 'rebase_continue', 'rebase_todo',
36
            'replay', 'pseudonyms', 'rebase_foreign']:
7406.3.5 by Jelmer Vernooij
Fix formatting.
37
    plugin_cmds.register_lazy("cmd_%s" % cmd, [], __name__ + ".commands")
0.436.48 by Jelmer Vernooij
Add replay command.
38
0.436.4 by Jelmer Vernooij
Add some tests.
39
0.436.248 by Jelmer Vernooij
Use feature flags.
40
def show_rebase_summary(params):
0.436.251 by Jelmer Vernooij
Guard against revision trees being passed in.
41
    if getattr(params.new_tree, "_format", None) is None:
42
        return
0.436.248 by Jelmer Vernooij
Use feature flags.
43
    features = getattr(params.new_tree._format, "features", None)
0.436.254 by Jelmer Vernooij
Ignore features on non-bzr repos.
44
    if features is None:
45
        return
7406.3.5 by Jelmer Vernooij
Fix formatting.
46
    if "rebase-v1" not in features:
0.436.248 by Jelmer Vernooij
Use feature flags.
47
        return
7406.3.2 by Jelmer Vernooij
Update for breezy.
48
    from .rebase import (
0.436.248 by Jelmer Vernooij
Use feature flags.
49
        RebaseState1,
50
        rebase_todo,
51
        )
52
    state = RebaseState1(params.new_tree)
53
    try:
54
        replace_map = state.read_plan()[1]
55
    except errors.NoSuchFile:
56
        return
57
    todo = list(rebase_todo(params.new_tree.branch.repository, replace_map))
58
    params.to_file.write('Rebase in progress. (%d revisions left)\n' % len(todo))
59
60
7406.3.2 by Jelmer Vernooij
Update for breezy.
61
from ...hooks import install_lazy_named_hook
0.436.248 by Jelmer Vernooij
Use feature flags.
62
7406.3.3 by Jelmer Vernooij
Fix python3 compatibility.
63
install_lazy_named_hook(
64
    'breezy.status', 'hooks', 'post_status',
0.436.248 by Jelmer Vernooij
Use feature flags.
65
    show_rebase_summary, 'rewrite status')
66
67
7406.3.2 by Jelmer Vernooij
Update for breezy.
68
def load_tests(loader, basic_tests, pattern):
69
    testmod_names = [
70
        'tests',
71
        ]
72
    basic_tests.addTest(loader.loadTestsFromModuleNames(
73
        ["%s.%s" % (__name__, tmn) for tmn in testmod_names]))
74
    return basic_tests