~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to shelf.py

  • Committer: Michael Ellerman
  • Date: 2006-02-11 03:28:04 UTC
  • mto: (0.1.73 shelf-tmp)
  • mto: This revision was merged to the branch mainline in revision 334.
  • Revision ID: michael@ellerman.id.au-20060211032804-4a7b7bb620d47d72
Always set shelf message and print it when shelving.

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
        self.__show_status(patch_source)
98
98
 
99
99
    def shelve(self, patch_source, pick_hunks=False, message=None):
 
100
        from datetime import datetime
 
101
 
100
102
        patches = patch_source.readpatches()
101
103
 
102
104
        if pick_hunks:
107
109
        if len(to_shelve) == 0:
108
110
            raise CommandError('Nothing to shelve')
109
111
 
 
112
        if message is None:
 
113
            timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
 
114
            message = "Changes shelved on %s" % timestamp
 
115
 
110
116
        shelf = self.next_shelf()
111
 
        print >>sys.stderr, "Saving to shelf '%s', patch '%s'" % \
112
 
                (self.name, os.path.basename(shelf))
 
117
        print >>sys.stderr, 'Shelving to %s/%s: "%s"' % \
 
118
                (self.name, os.path.basename(shelf), message)
 
119
 
113
120
        shelf = open(shelf, 'a')
114
 
        if message is not None:
115
 
            assert '\n' not in message
116
 
            shelf.write("# shelf: %s\n" % message)
 
121
 
 
122
        assert '\n' not in message
 
123
        shelf.write("# shelf: %s\n" % message)
 
124
 
117
125
        for patch in to_shelve:
118
126
            shelf.write(str(patch))
119
127