[patch]bug 32054 if commit fails commit message draft is lost

Cheuksan Edward Wang wang02139 at gmail.com
Fri Oct 20 08:22:53 BST 2006


If you haven't merged already, please apply the attached clean-up patch. It
just removes a few lines of "TODO".

On 10/19/06, Martin Pool <mbp at canonical.com> wrote:
>
> On 19 Oct 2006, Cheuksan Edward Wang <wang02139 at gmail.com> wrote:
> > I have modified the code and tests according to your comments except the
> > 'replace' part. The changeset is attached. I'll see what I can do with
> 5798.
>
> Thankyou.
>
> +1 with comments, taking
>
> > -
> > +
> > +        # save the commit message and only unlink it if the commit was
> > +        # successful
> > +        try:
> > +            tmp_fileno, msgfilename = tempfile.mkstemp
> (prefix='bzr-commit-',
> > +                                                       dir=tree.basedir
> )
> > +            os.close(tmp_fileno)
> > +        except OSError:
> > +            try:
> > +                # No access to working dir, try $TMP
> > +                tmp_fileno, msgfilename= tempfile.mkstemp
> (prefix='bzr-commit-')
> > +                os.close(tmp_fileno)
> > +            except:
> > +                # We can't create a temp file, try to work without it
> > +                msgfilename = None
> > +        if msgfilename is not None:
> > +            msgfile = open(msgfilename, "wt")
> > +            try:
> > +                msgfile.write(message.encode(bzrlib.user_encoding,
> 'replace'))
> > +            finally:
> > +                msgfile.close()
> > +
>
> This is large enough and self-contained enough that it should be in a
> separate method.  If someone else approves it I'll fix that and merge.
>
>
> --
> Martin
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20061020/dacf58dc/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clean_up.patch
Type: text/x-patch
Size: 622 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061020/dacf58dc/attachment.bin 


More information about the bazaar mailing list