~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shelf.py

  • Committer: Aaron Bentley
  • Date: 2006-08-07 03:07:35 UTC
  • mto: This revision was merged to the branch mainline in revision 425.
  • Revision ID: aaron.bentley@utoronto.ca-20060807030735-0a9f8330ce1a836a
Add --no-color option to shelf

Show diffs side-by-side

added added

removed removed

Lines of Context:
132
132
            return None
133
133
        return patch[len(self.MESSAGE_PREFIX):patch.index('\n')]
134
134
 
135
 
    def unshelve(self, patch_source, patch_name=None, all=False, force=False):
 
135
    def unshelve(self, patch_source, patch_name=None, all=False, force=False,
 
136
                 no_color=False):
136
137
        self._check_upgrade()
137
138
 
 
139
        if no_color is False:
 
140
            color = None
 
141
        else:
 
142
            color = False
138
143
        if patch_name is None:
139
144
            patch_path = self.last_patch()
140
145
        else:
148
153
            to_unshelve = patches
149
154
            to_remain = []
150
155
        else:
151
 
            to_unshelve, to_remain = UnshelveHunkSelector(patches).select()
 
156
            hs = UnshelveHunkSelector(patches, color)
 
157
            to_unshelve, to_remain = hs.select()
152
158
 
153
159
        if len(to_unshelve) == 0:
154
160
            raise CommandError('Nothing to unshelve')
187
193
                f.write(str(patch))
188
194
            f.close()
189
195
 
190
 
    def shelve(self, patch_source, all=False, message=None):
 
196
    def shelve(self, patch_source, all=False, message=None, no_color=False):
191
197
        self._check_upgrade()
 
198
        if no_color is False:
 
199
            color = None
 
200
        else:
 
201
            color = False
192
202
 
193
203
        patches = patch_source.readpatches()
194
204
 
195
205
        if all:
196
206
            to_shelve = patches
197
207
        else:
198
 
            to_shelve = ShelveHunkSelector(patches).select()[0]
 
208
            to_shelve = ShelveHunkSelector(patches, color).select()[0]
199
209
 
200
210
        if len(to_shelve) == 0:
201
211
            raise CommandError('Nothing to shelve')