hggtk/update: accept rev param at dialog creation
authorTK Soh <teekaysoh@yahoo.com>
Sun, 13 Jan 2008 05:13:31 +0000
changeset 622 d6aec02e90e6
parent 621 0163823c506b
child 623 4c39d389dac0
hggtk/update: accept rev param at dialog creation
hggtk/update.py
--- a/hggtk/update.py	Sun Jan 13 03:24:26 2008 +0000
+++ b/hggtk/update.py	Sun Jan 13 05:13:31 2008 +0000
@@ -18,7 +18,7 @@
 
 class UpdateDialog(gtk.Dialog):
     """ Dialog to update Mercurial repo """
-    def __init__(self, cwd=''):
+    def __init__(self, cwd='', rev=''):
         """ Initialize the Dialog """
         buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
         super(UpdateDialog, self).__init__(flags=gtk.DIALOG_MODAL, 
@@ -26,6 +26,7 @@
         set_tortoise_icon(self, 'menucheckout.ico')
         self.cwd = cwd or os.getcwd()
         self.root = rootpath(self.cwd)
+        self.rev = rev
         
         u = ui.ui()
         try:
@@ -136,7 +137,10 @@
             if node == tip:
                 status += ", tip"
             self._revlist.append([short(node), "(%s)" %status])
-        self._revbox.set_active(0)
+        if self.rev:
+            self._revbox.get_child().set_text(str(self.rev))
+        else:
+            self._revbox.set_active(0)
 
     def _btn_rev_clicked(self, button):
         """ select revision from history dialog """
@@ -172,8 +176,8 @@
         self._refresh()
         shell_notify([self.cwd])
 
-def run(cwd='', **opts):
-    dialog = UpdateDialog(cwd)
+def run(cwd='', rev='', **opts):
+    dialog = UpdateDialog(cwd, rev)
     dialog.show_all()
     gtk.gdk.threads_init()
     gtk.gdk.threads_enter()
@@ -184,4 +188,5 @@
     import sys
     opts = {}
     opts['cwd'] = len(sys.argv) > 1 and sys.argv[1] or ''
+    #opts['rev'] = 123
     run(**opts)