# HG changeset patch
# User Adrian Buehlmann <adr...@cadifra.com>
# Date 1256757885 -3600
# Branch stable
# Node ID 39cd643216058f8fcdd490120f39715d5d695677
# Parent  0c590019e83395748291020a1f989280bae0e2a3
history: use hg.islocal in push_clicked

instead of needlessly creating a full repo object just to see
whether it is a local repository

Fixes #665

diff --git a/tortoisehg/hgtk/history.py b/tortoisehg/hgtk/history.py
--- a/tortoisehg/hgtk/history.py
+++ b/tortoisehg/hgtk/history.py
@@ -1394,35 +1394,28 @@ class GLog(gdialog.GDialog):
             return
 
         confirm_push = False
-        try:
-            dest_repo = hg.repository(self.ui, path=remote_path)
-            if not dest_repo.local():
-                if self.forcepush:
-                    title = _('Confirm Forced Push to Remote Repository')
-                    text = _('Forced push to remote repository\n%s\n'
-                        '(creating new heads in remote if needed)?') % 
remote_path
-                    buttontext = _('Forced &Push')
-                else:
-                    title = _('Confirm Push to remote Repository')
-                    text = _('Push to remote repository\n%s\n?') % remote_path
-                    buttontext = _('&Push')
-                confirm_push = True
-            elif self.forcepush:
-                title = _('Confirm Forced Push')
-                text = _('Forced push to repository\n%s\n'
-                    '(creating new heads if needed)?') % remote_path
+        if not hg.islocal(remote_path):
+            if self.forcepush:
+                title = _('Confirm Forced Push to Remote Repository')
+                text = _('Forced push to remote repository\n%s\n'
+                    '(creating new heads in remote if needed)?') % remote_path
                 buttontext = _('Forced &Push')
-                confirm_push = True
-            if confirm_push:
-                dlg = gdialog.CustomPrompt(title, text,
-                        None, (buttontext, _('&Cancel')), default=1, esc=1)
-                if dlg.run() != 0:
-                    return
-        except hglib.RepoError, e:
-            dlg = gdialog.Prompt(_('Invalid Remote Repository'), str(e), self,
-                    type=gtk.MESSAGE_ERROR)
-            dlg.run()
-            return
+            else:
+                title = _('Confirm Push to remote Repository')
+                text = _('Push to remote repository\n%s\n?') % remote_path
+                buttontext = _('&Push')
+            confirm_push = True
+        elif self.forcepush:
+            title = _('Confirm Forced Push')
+            text = _('Forced push to repository\n%s\n'
+                '(creating new heads if needed)?') % remote_path
+            buttontext = _('Forced &Push')
+            confirm_push = True
+        if confirm_push:
+            dlg = gdialog.CustomPrompt(title, text,
+                    None, (buttontext, _('&Cancel')), default=1, esc=1)
+            if dlg.run() != 0:
+                return
 
         cmdline = ['hg', 'push'] + self.get_proxy_args()
         if self.forcepush:

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) 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 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to