~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shelf.py

  • Committer: Michael Ellerman
  • Date: 2006-03-12 00:35:10 UTC
  • mto: (325.1.2 bzrtools) (0.3.1 shelf-dev)
  • mto: This revision was merged to the branch mainline in revision 334.
  • Revision ID: michael@ellerman.id.au-20060312003510-4244ca233f07b93a
After extensive user testing, ie. me using it, I've decided --pick should be
the default, not --all. So switch back to prompting by default, and --all gets
the shelve all behaviour.

Show diffs side-by-side

added added

removed removed

Lines of Context:
121
121
            return None
122
122
        return patch[len(self.MESSAGE_PREFIX):patch.index('\n')]
123
123
 
124
 
    def unshelve(self, patch_source, pick_hunks=False):
 
124
    def unshelve(self, patch_source, all_hunks=False):
125
125
        patch_name = self.last_patch()
126
126
 
127
127
        if patch_name is None:
128
128
            raise CommandError("No patch found on shelf %s" % self.name)
129
129
 
130
130
        hunks = FilePatchSource(patch_name).readhunks()
131
 
        if pick_hunks:
132
 
            to_unshelve, to_remain = UnshelveHunkSelector(hunks).select()
133
 
        else:
 
131
        if all_hunks:
134
132
            to_unshelve = hunks
135
133
            to_remain = []
 
134
        else:
 
135
            to_unshelve, to_remain = UnshelveHunkSelector(hunks).select()
136
136
 
137
137
        if len(to_unshelve) == 0:
138
138
            raise CommandError('Nothing to unshelve')
158
158
                f.write(str(hunk))
159
159
            f.close()
160
160
 
161
 
    def shelve(self, patch_source, pick_hunks=False, message=None):
 
161
    def shelve(self, patch_source, all_hunks=False, message=None):
162
162
        from datetime import datetime
163
163
 
164
164
        hunks = patch_source.readhunks()
165
165
 
166
 
        if pick_hunks:
 
166
        if all_hunks:
 
167
            to_shelve = hunks
 
168
        else:
167
169
            to_shelve = ShelveHunkSelector(hunks).select()[0]
168
 
        else:
169
 
            to_shelve = hunks
170
170
 
171
171
        if len(to_shelve) == 0:
172
172
            raise CommandError('Nothing to shelve')