Pushed with a mention in the comment that it closes an enhancement request

On Sat, Aug 15, 2009 at 12:31 PM, Simon Heimberg<sim...@besonet.ch> wrote:
> # HG changeset patch
> # User Simon Heimberg <sim...@besonet.ch>
> # Date 1250357399 -7200
> # Node ID 66c3bf712b2ed6ae7b3df4352052126882490151
> # Parent  1d8aac63e43e6fdee3dd97e75edfd8146bb67fe7
> commit/thgshelve: check if the shown state is up to date
>
> Check if the parents have changed since the last refresh of the display before
> doing commit or (un)shelve. If they have, ask the user if he wants to 
> continue.
>
> diff -r 1d8aac63e43e -r 66c3bf712b2e hggtk/commit.py
> --- a/hggtk/commit.py   Mon Aug 10 07:25:14 2009 +0200
> +++ b/hggtk/commit.py   Sam Aug 15 19:29:59 2009 +0200
> @@ -298,7 +298,7 @@
>
>     def get_custom_menus(self):
>         def commit(menuitem, files):
> -            if self.ready_message():
> +            if self.ready_message() and self.isuptodate():
>                 self.hg_commit(files)
>                 self.reload_status()
>                 abs = [self.repo.wjoin(file) for file in files]
> @@ -412,7 +412,7 @@
>         self.branchbutton.set_sensitive(not (self.mqmode or self.qnew))
>
>     def commit_clicked(self, toolbutton, data=None):
> -        if not self.ready_message():
> +        if not (self.ready_message() or self.isupdodate()):
>             return
>
>         commitable = 'MAR'
> diff -r 1d8aac63e43e -r 66c3bf712b2e hggtk/status.py
> --- a/hggtk/status.py   Mon Aug 10 07:25:14 2009 +0200
> +++ b/hggtk/status.py   Sam Aug 15 19:29:59 2009 +0200
> @@ -1336,6 +1336,21 @@
>         self._do_diff(files, self.opts)
>         return True
>
> +    def isuptodate(self):
> +        oldparents = self.repo.dirstate.parents()
> +        self.repo.dirstate.invalidate()
> +        if oldparents == self.repo.dirstate.parents():
> +            return True
> +        response = gdialog.CustomPrompt(_('not up to date'),
> +                    _('The parents have changed since the last refresh.\n'
> +                      'Continue anyway?'),
> +                    self, (_('&Yes'), _('&Refresh'), _('&Cancel')), 1, 
> 2).run()
> +        if response == 0: # Yes
> +            return True
> +        if response == 1:
> +            self.reload_status()
> +        return False
> +
>  def run(ui, *pats, **opts):
>     showclean = pats and True or False
>     rev = opts.get('rev', [])
> diff -r 1d8aac63e43e -r 66c3bf712b2e hggtk/thgshelve.py
> --- a/hggtk/thgshelve.py        Mon Aug 10 07:25:14 2009 +0200
> +++ b/hggtk/thgshelve.py        Sam Aug 15 19:29:59 2009 +0200
> @@ -195,10 +195,14 @@
>             pass
>
>     def shelve_clicked(self, toolbutton, data=None):
> +        if not self.isuptodate():
> +            return
>         self.shelve_selected()
>         self.activate_shelve_buttons(True)
>
>     def unshelve_clicked(self, toolbutton, data=None):
> +        if not self.isuptodate():
> +            return
>         self.unshelve()
>         self.activate_shelve_buttons(True)
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Tortoisehg-develop mailing list
> Tortoisehg-develop@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop
>

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to