hggtk/history: call update dialog to do checkout
authorTK Soh <teekaysoh@yahoo.com>
Sun, 13 Jan 2008 05:19:18 +0000
changeset 623 4c39d389dac0
parent 622 d6aec02e90e6
child 624 8b1b25bcd688
hggtk/history: call update dialog to do checkout
hggtk/history.py
hggtk/update.py
--- a/hggtk/history.py	Sun Jan 13 05:13:31 2008 +0000
+++ b/hggtk/history.py	Sun Jan 13 05:19:18 2008 +0000
@@ -23,6 +23,7 @@
 from shlib import shell_notify
 from gdialog import *
 from hgcmd import CmdDialog
+from update import UpdateDialog
 
 
 class GLog(GDialog):
@@ -605,28 +606,10 @@
     def _checkout(self, menuitem):
         row = self.model[self.tree.get_selection().get_selected()[1]]
         rev = long(row[2])
-        self.repo.invalidate()
-        wc = self.repo.workingctx()
-        pl = wc.parents()
-        p1, p2 = pl[0], self.repo.changectx(rev)
-        pa = p1.ancestor(p2)
-        warning = ''
-        flags = []
-        if len(pl) > 1:
-            warning = "Outstanding uncommitted merges"
-        elif pa != p1 and pa != p2:
-            warning = "Checkout spans branches"
-        elif wc.files():
-            warning = "Outstanding uncommitted changes"
-        if warning:
-            flags = ['--clean']
-            msg = 'lose changes'
-            warning += ', requires clean checkout'
-            if Confirm(msg, [], self, warning).run() != gtk.RESPONSE_YES:
-                return
-        cmdline = ['hg', 'update', '-R', self.repo.root] + flags + [str(rev)]
-        dialog = CmdDialog(cmdline)
+        
+        dialog = UpdateDialog(self.cwd, rev)
         dialog.set_transient_for(self)
+        dialog.show_all()
         dialog.run()
         dialog.hide()
         shell_notify([self.repo.root])
--- a/hggtk/update.py	Sun Jan 13 05:13:31 2008 +0000
+++ b/hggtk/update.py	Sun Jan 13 05:19:18 2008 +0000
@@ -42,7 +42,6 @@
         
     def _create(self):
         self.set_default_size(350, 120)
-        self.connect('response', gtk.main_quit)
 
         # add toolbar with tooltips
         self.tbar = gtk.Toolbar()
@@ -178,6 +177,7 @@
 
 def run(cwd='', rev='', **opts):
     dialog = UpdateDialog(cwd, rev)
+    dialog.connect('response', gtk.main_quit)
     dialog.show_all()
     gtk.gdk.threads_init()
     gtk.gdk.threads_enter()