Commits

TK Soh  committed e4550fd

hggtk/merge: accept rev param to support merging via history dialog

  • Participants
  • Parent commits a95083c

Comments (0)

Files changed (1)

File hggtk/merge.py

 
 class MergeDialog(gtk.Dialog):
     """ Dialog to merge revisions of a Mercurial repo """
-    def __init__(self, root='', cwd=''):
+    def __init__(self, root='', cwd='', rev=''):
         """ Initialize the Dialog """
         buttons = (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
         super(MergeDialog, self).__init__(flags=gtk.DIALOG_MODAL, 
         title = "hg merge"
         if root: title += " - %s" % root
         self.set_title(title)
-        self.connect('response', gtk.main_quit)
 
         self.root = root
         self.cwd = cwd or root
+        self.rev = rev
         self.repo = None
         self._create()
 
             
             self._revlist.append([short(node), "(%s)" %status])
             self._rev_input.set_text(short(node))
+
+        if self.rev:
+            self._rev_input.set_text(str(self.rev))
         
     def _merge_menu(self):
         menu = gtk.Menu()
         shell_notify([self.cwd])
         self._refresh()
 
-def run(root='', cwd='', **opts):
-    dialog = MergeDialog(root, cwd)
+def run(root='', cwd='', rev='', **opts):
+    dialog = MergeDialog(root, cwd, rev)
+    dialog.connect('response', gtk.main_quit)
     dialog.show_all()
     gtk.gdk.threads_init()
     gtk.gdk.threads_enter()