Fixes #694

# HG changeset patch
# User Emmanuel Rosa <goaway1...@gmail.com>
# Date 1258074201 18000
# Node ID b3064d77bbfd49f5773b4aad0d0be00b22ec4f8d
# Parent  1392bbfc04ca4b932ea69bd312680b83d19ce326
clone: add clone from bundle

Fixes #694

diff --git a/tortoisehg/hgtk/clone.py b/tortoisehg/hgtk/clone.py
--- a/tortoisehg/hgtk/clone.py
+++ b/tortoisehg/hgtk/clone.py
@@ -51,7 +51,7 @@
         elif len(repos):
             srcpath = repos[0]
 
-        def createcombo(path, label, title):
+        def createcombo(path, label, title, bundle=False):
             # comboentry
             model = gtk.ListStore(str)
             combo = gtk.ComboBoxEntry(model, 0)
@@ -74,7 +74,13 @@
             browse = gtk.Button(_('Browse...'))
             browse.connect('clicked', self.browse_clicked, title, entry)
 
-            table.add_row(label, combo, 0, browse)
+            if bundle:
+                # bundle button
+                bundlebtn = gtk.Button(_('Bundle...'))
+                bundlebtn.connect('clicked', self.bundle_clicked, title, entry)
+                table.add_row(label, combo, 0, browse, bundlebtn)
+            else:
+                table.add_row(label, combo, 0, browse)
 
             return model, combo
 
@@ -85,7 +91,7 @@
         ## comboentry for source paths
         self.srclist, srccombo = createcombo(srcpath,
                                              _('Source path:'),
-                                             _('Select Source Folder'))
+                                             _('Select Source Folder'), True)
         self.srcentry = srccombo.get_child()
 
         ## add pre-defined src paths to pull-down list
@@ -206,6 +212,21 @@
         if res:
             entry.set_text(res)
 
+    def bundle_clicked(self, button, title, entry):
+        path = entry.get_text()
+        if os.path.isdir(path):
+            initial = path
+        else:
+            initial = os.path.dirname(path)
+
+        res = gtklib.NativeSaveFileDialogWrapper(
+                     initial=initial,
+                     title=title, 
+                     filter= ((_('Mercurial bundles'), '*.hg'),),
+                     open=True).run()
+        if res:
+            entry.set_text(res)
+
     def checkbutton_toggled(self, checkbutton, entry):
         state = checkbutton.get_active()
         entry.set_sensitive(state)
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to