2
2
"""Shelf - temporarily set aside changes, then bring them back."""
9
from bzrlib.tests.TestUtil import TestLoader
11
return TestLoader().loadTestsFromModule(tests)
14
raise Exception("Bzr not found!")
6
from bzrlib.errors import BzrCommandError
7
from bzrlib.option import Option
8
from shelf import Shelf
10
class cmd_shelve(bzrlib.commands.Command):
11
"""Temporarily set aside some changes to the current working tree.
13
Shelve allows you to temporarily put changes you've made "on the shelf",
14
ie. out of the way, until a later time when you can bring them back from
15
the shelf with the 'unshelve' command.
17
You can put multiple items on the shelf, each time you run unshelve the
18
most recently shelved changes will be reinstated.
20
If filenames are specified, only the changes to those files will be
21
shelved, other files will be left untouched.
23
If a revision is specified, changes since that revision will be shelved.
25
If you specifiy "--pick" you'll be prompted for each hunk of the diff as
26
to whether you want to shelve it or not. Press "?" at the prompt for help.
28
takes_args = ['file*']
29
takes_options = [Option('pick'), 'message', 'revision']
30
def run(self, pick=False, file_list=None, message=None, revision=None):
31
if file_list is not None and len(file_list) > 0:
32
branchdir = file_list[0]
36
if revision is not None and revision:
37
if len(revision) == 1:
38
revision = revision[0]
40
raise BzrCommandError("shelve only accepts a single revision "
44
return s.shelve(pick, message, revision, file_list)
46
class cmd_unshelve(bzrlib.commands.Command):
47
"""Reinstate the most recently shelved changes.
48
See 'shelve' for more information.
50
takes_options = [Option('pick')]
51
def run(self, pick=False):
53
return s.unshelve(pick)
55
bzrlib.commands.register_command(cmd_shelve)
56
bzrlib.commands.register_command(cmd_unshelve)
59
from bzrlib.tests.TestUtil import TestLoader
61
return TestLoader().loadTestsFromModule(tests)