~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shelf.py

  • Committer: Michael Ellerman
  • Date: 2006-06-05 14:48:11 UTC
  • mto: (0.3.1 shelf-dev)
  • mto: This revision was merged to the branch mainline in revision 393.
  • Revision ID: michael@ellerman.id.au-20060605144811-d143d182c6fbe600
Support for unshelving in arbitrary order.

Normally the shelf acts as a LIFO, or more commonly a stack. However
there are times when this is inconvenient. Add support for unshelving
any of the patches on the shelf. This will obviously only work well if
the shelved patches don't depend on each other. Add tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
            return None
134
134
        return patch[len(self.MESSAGE_PREFIX):patch.index('\n')]
135
135
 
136
 
    def unshelve(self, patch_source, all=False, force=False):
 
136
    def unshelve(self, patch_source, patch_name=None, all=False, force=False):
137
137
        self._check_upgrade()
138
138
 
139
 
        patch_path = self.last_patch()
 
139
        if patch_name is None:
 
140
            patch_path = self.last_patch()
 
141
        else:
 
142
            patch_path = self.__path_from_user(patch_name)
140
143
 
141
144
        if patch_path is None:
142
145
            raise CommandError("No patch found on shelf %s" % self.name)