~ubuntu-branches/ubuntu/lucid/bzr/lucid-proposed

« back to all changes in this revision

Viewing changes to bzrlib/msgeditor.py

Tags: upstream-0.7
ImportĀ upstreamĀ versionĀ 0.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
        ignoreline = "-- This line and the following will be ignored --"
80
80
        
81
81
    try:
82
 
        tmp_fileno, msgfilename = tempfile.mkstemp()
 
82
        tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.', dir=u'.')
83
83
        msgfile = os.close(tmp_fileno)
84
84
        if infotext is not None and infotext != "":
85
85
            hasinfo = True
127
127
        try: os.unlink(msgfilename)
128
128
        except IOError: pass
129
129
 
 
130
 
 
131
def make_commit_message_template(working_tree, specific_files):
 
132
    """Prepare a template file for a commit into a branch.
 
133
 
 
134
    Returns a unicode string containing the template.
 
135
    """
 
136
    # TODO: Should probably be given the WorkingTree not the branch
 
137
    #
 
138
    # TODO: make provision for this to be overridden or modified by a hook
 
139
    #
 
140
    # TODO: Rather than running the status command, should prepare a draft of
 
141
    # the revision to be committed, then pause and ask the user to
 
142
    # confirm/write a message.
 
143
    from StringIO import StringIO       # must be unicode-safe
 
144
    from bzrlib.status import show_status
 
145
    status_tmp = StringIO()
 
146
    show_status(working_tree.branch, specific_files=specific_files, to_file=status_tmp)
 
147
    return status_tmp.getvalue()