1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

TK Soh  committed d6aec02

hggtk/update: accept rev param at dialog creation

  • Participants
  • Parent commits 0163823
  • Branches default

Comments (0)

Files changed (1)

File hggtk/update.py

View file
 
 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, 
         set_tortoise_icon(self, 'menucheckout.ico')
         self.cwd = cwd or os.getcwd()
         self.root = rootpath(self.cwd)
+        self.rev = rev
         
         u = ui.ui()
         try:
             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 """
         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()
     import sys
     opts = {}
     opts['cwd'] = len(sys.argv) > 1 and sys.argv[1] or ''
+    #opts['rev'] = 123
     run(**opts)