~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/shelf_ui.py

  • Committer: Aaron Bentley
  • Date: 2008-11-03 21:35:03 UTC
  • mto: This revision was merged to the branch mainline in revision 3823.
  • Revision ID: aaron@aaronbentley.com-20081103213503-3ceuk1ui7fykhg1e
Minor updates

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
    textfile,
32
32
    trace,
33
33
    ui,
34
 
    workingtree)
 
34
    workingtree,
 
35
)
35
36
try:
36
37
    from bzrlib.plugins.bzrtools import colordiff
37
38
except ImportError:
50
51
            work_tree to.
51
52
        :param auto: If True, shelve each possible change.
52
53
        :param auto_apply: If True, shelve changes with no final prompt.
53
 
        :param file_list: If supplied, only files in this list may be  shelved.
 
54
        :param file_list: If supplied, only files in this list may be shelved.
54
55
        :param message: The message to associate with the shelved changes.
55
56
        """
56
57
        self.work_tree = work_tree
103
104
                        creator.shelve_creation(change[1])
104
105
                        changes_shelved += 1
105
106
                if change[0] == 'delete file':
106
 
                    if self.prompt_bool('Shelve removing file "%s"? '
 
107
                    if self.prompt_bool('Shelve removing file "%s"?'
107
108
                                        % change[3]):
108
109
                        creator.shelve_deletion(change[1])
109
110
                        changes_shelved += 1
113
114
                        creator.shelve_content_change(change[1])
114
115
                        changes_shelved += 1
115
116
                if change[0] == 'rename':
116
 
                    if self.prompt_bool('Shelve renaming %s => %s?' %
 
117
                    if self.prompt_bool('Shelve renaming "%s" => "%s"?' %
117
118
                                   change[2:]):
118
119
                        creator.shelve_rename(change[1])
119
120
                        changes_shelved += 1
163
164
    def prompt_bool(self, question):
164
165
        """Prompt the user with a yes/no question.
165
166
 
166
 
        This may be overridden by self.auto, or auto may be supplied.
167
 
        It may also *set* self.auto.  It may also raise SystemExit.
 
167
        This may be overridden by self.auto.  It may also *set* self.auto.  It
 
168
        may also raise SystemExit.
168
169
        :param question: The question to ask the user.
169
170
        :return: True or False
170
171
        """
189
190
        :return: number of shelved hunks.
190
191
        """
191
192
        target_lines = self.target_tree.get_file_lines(file_id)
192
 
        work_file = self.work_tree.get_file(file_id)
193
 
        try:
194
 
            textfile.text_file(work_file)
195
 
        finally:
196
 
            work_file.close()
 
193
        textfile.check_text_lines(self.work_tree.get_file_lines(file_id))
197
194
        textfile.check_text_lines(target_lines)
198
195
        parsed = self.get_parsed_patch(file_id)
199
196
        final_hunks = []