# HG changeset patch
# User Yuki KODAMA <endflow....@gmail.com>
# Date 1253335321 -32400
# Node ID b14d5fa3756841a0034c3d0c8a49aad22884783d
# Parent  f52684e023c2a6a8c0a2a4e8ef9e750c8f464764
update: provide options more explicitly

diff --git a/tortoisehg/hgtk/update.py b/tortoisehg/hgtk/update.py
--- a/tortoisehg/hgtk/update.py
+++ b/tortoisehg/hgtk/update.py
@@ -22,6 +22,10 @@
 MODE_NORMAL   = 'normal'
 MODE_UPDATING = 'updating'

+OPT_CHECK = 0
+OPT_CLEAN = 1
+OPT_MERGE = 2
+
 class UpdateDialog(gtk.Dialog):
     """ Dialog to update Mercurial repo """
     def __init__(self, rev=None):
@@ -49,16 +53,29 @@
         self.action_area.pack_end(self.updatebtn)
         self.closebtn = self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)

+        # layout table
+        self.table = table = gtk.Table(1, 2)
+        self.vbox.pack_start(table, True, True, 2)
+        # copy from 'thgconfig.py'
+        def addrow(text, widget, expand=True):
+            label = gtk.Label(text)
+            label.set_alignment(1, 0.5)
+            row = table.get_property('n-rows')
+            table.set_property('n-rows', row + 1)
+            table.attach(label, 0, 1, row, row + 1, gtk.FILL, 0, 4, 2)
+            if not expand:
+                hbox = gtk.HBox()
+                hbox.pack_start(widget, False, False)
+                hbox.pack_start(gtk.Label(''))
+                widget = hbox
+            table.attach(widget, 1, 2, row, row + 1,
gtk.FILL|gtk.EXPAND, 0, 4, 2)
+
         # revision label & combobox
-        self.revhbox = hbox = gtk.HBox()
-        lbl = gtk.Label(_('Update to:'))
-        hbox.pack_start(lbl, False, False, 2)
         self.revcombo = combo = gtk.combo_box_entry_new_text()
         entry = combo.child
         entry.connect('activate', lambda b: self.update(repo))
         entry.set_width_chars(38)
-        hbox.pack_start(combo, True, True, 2)
-        self.vbox.pack_start(hbox, False, False, 4)
+        addrow(_('Update to:'), self.revcombo)

         # fill list of combo
         if rev != None:
@@ -74,9 +91,13 @@
         for t in tags:
             combo.append_text(t)

-        # option
-        self.optclean = gtk.CheckButton(_('Overwrite local changes (--clean)'))
-        self.vbox.pack_start(self.optclean, False, False, 4)
+        # options
+        self.optlist = gtk.combo_box_new_text()
+        self.optlist.append_text(_('Check local changes (--check)'))
+        self.optlist.append_text(_('Discard local changes (--clean)'))
+        self.optlist.append_text(_('Allow merge (default)'))
+        self.optlist.set_active(OPT_CHECK)
+        addrow(_('Option:'), self.optlist, expand=False)

         # prepare to show
         self.updatebtn.grab_focus()
@@ -123,8 +144,8 @@
             raise _('unknown mode name: %s') % mode
         updating = not normal

-        self.revhbox.set_sensitive(normal)
-        self.optclean.set_sensitive(normal)
+        self.table.set_sensitive(normal)
+        self.optlist.set_sensitive(normal)
         self.updatebtn.set_property('visible', normal)
         self.closebtn.set_property('visible', normal)
         if cmd:
@@ -134,16 +155,16 @@
     def update(self, repo):
         self.switch_to(MODE_UPDATING)

-        clean = self.optclean.get_active()
+        cmdline = ['hg', 'update', '--verbose']
         rev = self.revcombo.get_active_text()
-        cmdline = ['hg', 'update', '--verbose']
         if rev != BRANCH_TIP:
             cmdline.append('--rev')
             cmdline.append(rev)
-        if clean:
+        opt = self.optlist.get_active()
+        if opt == OPT_CHECK:
+            cmdline.append('--check')
+        elif opt == OPT_CLEAN:
             cmdline.append('--clean')
-        else:
-            cmdline.append('--check')

         def cmd_done(returncode):
             self.switch_to(MODE_NORMAL, cmd=False)

Attachment: thg-kuy_rev4108.patch
Description: Binary data

------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; 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&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to