On Mon, Sep 14, 2009 at 8:28 PM, emmanuel <goaway1...@gmail.com> wrote:
> Yuki KODAMA wrote:
>
> # HG changeset patch
> # User Yuki KODAMA <endflow....@gmail.com>
> # Date 1252947600 -32400
> # Node ID bf6eacbb0affb1f3085376f12294b2a910bae8f2
> # Parent  3a38f9125e735acd209214e4c6f5cd666dcbb7ee
> commit: make QNew possible to execute without commit message
>
> >From command line, 'hg qnew' can be executed without commit message.
>
> diff --git a/tortoisehg/hgtk/commit.py b/tortoisehg/hgtk/commit.py
> --- a/tortoisehg/hgtk/commit.py
> +++ b/tortoisehg/hgtk/commit.py
> @@ -611,32 +611,40 @@
>          self.branchbutton.set_sensitive(not (self.mqmode or self.qnew))
>
>      def commit_clicked(self, toolbutton, data=None):
> -        if not self.ready_message() or not self.isuptodate():
> +        if not self.isuptodate():
>              return
>
> -        commitable = 'MAR'
> -        if self.merging:
> -            commit_list = self.relevant_checked_files(commitable)
> -            # merges must be committed without specifying file list.
> -            self.hg_commit([])
> +        def get_list(addremove=True):
> +            commitable = 'MAR'
> +            if addremove:
> +                ar_list = self.relevant_checked_files('?!')
> +                if len(ar_list) > 0 and self.should_addremove(ar_list):
> +                    commitable += '?!'
> +            return self.relevant_checked_files(commitable)
> +
> +        if self.qnew:
> +            commit_list = get_list()
> +            self.commit_selected(commit_list)
>          else:
> -            addremove_list = self.relevant_checked_files('?!')
> -            if len(addremove_list) and
> self.should_addremove(addremove_list):
> -                commitable += '?!'
> +            if not self.ready_message():
> +                return
>
> -            commit_list = self.relevant_checked_files(commitable)
> -            if len(commit_list) > 0:
> -                self.commit_selected(commit_list)
> -            elif len(self.filemodel) == 0 and self.qnew:
> -                self.commit_selected([])
> -            elif self.qheader is not None:
> -                self.commit_selected([])
> -            elif self.closebranch:
> -                self.commit_selected([])
> +            if self.merging:
> +                commit_list = get_list(addremove=False)
> +                # merges must be committed without specifying file list.
> +                self.hg_commit([])
>              else:
> -                gdialog.Prompt(_('Nothing Commited'),
> -                       _('No committable files selected'), self).run()
> -                return
> +                commit_list = get_list()
> +                if len(commit_list) > 0:
> +                    self.commit_selected(commit_list)
> +                elif self.qheader is not None:
> +                    self.commit_selected([])
> +                elif self.closebranch:
> +                    self.commit_selected([])
> +                else:
> +                    gdialog.Prompt(_('Nothing Commited'),
> +                           _('No committable files selected'), self).run()
> +                    return
>          self.reload_status()
>          files = [self.repo.wjoin(x) for x in commit_list]
>          shlib.shell_notify(files)

The problem is that it's no longer calling ready_message() when doing
a QNew, which bypasses the side-effects of that function, setting
opts['message'].  It's a good indication that function needs to be
split up into checking and setup functions and all callers to it
updated.

--
Steve Borho

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to