/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
0.12.1 by Aaron Bentley
Initial bencode-based encoding
1
# Copyright (C) 2008 Aaron Bentley <aaron@aaronbentley.com>
2
#
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.
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
16
0.16.1 by Aaron Bentley
Begin implementing UI
17
"""Reimplementation of shelf commands."""
18
0.16.65 by Aaron Bentley
Implement unshelve --delete
19
from bzrlib import commands, option
0.16.1 by Aaron Bentley
Begin implementing UI
20
21
22
class cmd_shelve2(commands.Command):
0.16.66 by Aaron Bentley
Import documentation from original shelf
23
    """Temporarily set aside some changes from the current tree.
24
25
    Shelve allows you to temporarily put changes you've made "on the shelf",
26
    ie. out of the way, until a later time when you can bring them back from
27
    the shelf with the 'unshelve' command.
28
0.16.67 by Aaron Bentley
Update docs
29
    Shelve is intended to help separate several sets of changes that have
0.16.66 by Aaron Bentley
Import documentation from original shelf
30
    been inappropriately mingled.  If you just want to get rid of all changes
0.16.67 by Aaron Bentley
Update docs
31
    and you don't need to restore them later, use revert.  If you want to
32
    shelve all text changes at once, use shelve --all.
0.16.66 by Aaron Bentley
Import documentation from original shelf
33
34
    If filenames are specified, only the changes to those files will be
0.16.67 by Aaron Bentley
Update docs
35
    shelved. Other files will be left untouched.
0.16.66 by Aaron Bentley
Import documentation from original shelf
36
37
    If a revision is specified, changes since that revision will be shelved.
38
0.16.67 by Aaron Bentley
Update docs
39
    You can put multiple items on the shelf, and by default, 'unshelve' will
40
    restore the most recently shelved changes.
0.16.66 by Aaron Bentley
Import documentation from original shelf
41
42
    While you have patches on the shelf you can view and manipulate them with
43
    the 'shelf' command. Run 'bzr shelf -h' for more info.
44
    """
0.16.5 by Aaron Bentley
Get text shelving working
45
0.16.47 by Aaron Bentley
Support selecting files to shelve
46
    takes_args = ['file*']
47
0.16.15 by Aaron Bentley
Implement auto mode
48
    takes_options = [
49
        'revision',
0.16.65 by Aaron Bentley
Implement unshelve --delete
50
        option.Option('all', help='Shelve all changes.'),
0.16.57 by Aaron Bentley
Expose messages in the UI
51
        'message',
52
    ]
0.16.1 by Aaron Bentley
Begin implementing UI
53
0.16.57 by Aaron Bentley
Expose messages in the UI
54
    def run(self, revision=None, all=False, file_list=None, message=None):
0.16.34 by Aaron Bentley
Rename shelver to shelf_ui
55
        from bzrlib.plugins.shelf2.shelf_ui import Shelver
0.16.57 by Aaron Bentley
Expose messages in the UI
56
        Shelver.from_args(revision, all, file_list, message).run()
0.16.47 by Aaron Bentley
Support selecting files to shelve
57
0.16.8 by Aaron Bentley
Implement unshelve2, tidy shelve2
58
59
class cmd_unshelve2(commands.Command):
0.16.66 by Aaron Bentley
Import documentation from original shelf
60
    """Restore shelved changes.
61
0.16.67 by Aaron Bentley
Update docs
62
    By default, the most recently shelved changes are restored. However if you
63
    specify a patch by name those changes will be restored instead.  This
64
    works best when the changes don't depend on each other.
0.16.66 by Aaron Bentley
Import documentation from original shelf
65
    """
0.16.8 by Aaron Bentley
Implement unshelve2, tidy shelve2
66
0.16.54 by Aaron Bentley
Inform user about shelf ids.
67
    takes_args = ['shelf_id?']
0.16.64 by Aaron Bentley
Implement dry-run option for Unshelve
68
    takes_options = [
0.16.65 by Aaron Bentley
Implement unshelve --delete
69
        option.RegistryOption.from_kwargs(
70
            'action', enum_switch=False, value_switches=True,
71
            apply="Apply changes and remove from the shelf.",
72
            dry_run="Show changes, but do not apply or remove them.",
73
            delete_only="Delete changes without applying them."
74
        )
75
    ]
0.16.67 by Aaron Bentley
Update docs
76
    _see_also = ['shelve2']
0.16.52 by Aaron Bentley
Allow user-specified shelves
77
0.16.65 by Aaron Bentley
Implement unshelve --delete
78
    def run(self, shelf_id=None, action='apply'):
0.16.34 by Aaron Bentley
Rename shelver to shelf_ui
79
        from bzrlib.plugins.shelf2.shelf_ui import Unshelver
0.16.65 by Aaron Bentley
Implement unshelve --delete
80
        Unshelver.from_args(shelf_id, action).run()
0.16.1 by Aaron Bentley
Begin implementing UI
81
82
83
commands.register_command(cmd_shelve2)
0.16.8 by Aaron Bentley
Implement unshelve2, tidy shelve2
84
commands.register_command(cmd_unshelve2)
0.16.1 by Aaron Bentley
Begin implementing UI
85
0.12.1 by Aaron Bentley
Initial bencode-based encoding
86
87
def test_suite():
88
    from bzrlib.plugins.shelf2 import tests
89
    return tests.test_suite()