# HG changeset patch
# User Kurt Granroth <[EMAIL PROTECTED]>
# Date 1222630315 25200
# Node ID 039ae73bf795f4d122cda1b9ce8d3d26934c082d
# Parent  5313a09bdd5f88ad2d68551e5bfd6e041e15d3a6
Add options to clone, synch, and update to use the forest equivalent of common 
commands.  This includes clone/fclone, update/fupdate, pull/fpull, push/fpush, 
and fetch/ffetch.  status is not yet supported as it requires digging deep into 
the internals of the forest extension itself.

diff -r 5313a09bdd5f -r 039ae73bf795 hggtk/clone.py
--- a/hggtk/clone.py    Mon Sep 22 08:02:17 2008 +0100
+++ b/hggtk/clone.py    Sun Sep 28 12:31:55 2008 -0700
@@ -15,7 +15,7 @@
 import gtk
 import pango
 from dialog import question_dialog, error_dialog, info_dialog
-from mercurial import hg, ui, cmdutil, util
+from mercurial import hg, ui, cmdutil, util, extensions
 from mercurial.i18n import _
 from mercurial.node import *
 import shlib
@@ -39,6 +39,9 @@
         self._settings = shlib.Settings('clone')
         self._recent_src = self._settings.mrul('src_paths')
         self._recent_dest = self._settings.mrul('dest_paths')
+
+        # load the forest extension explicitly
+        extensions.load(ui.ui(), 'forest', None)
 
         try:
             self._src_path = repos[0]
@@ -167,10 +170,12 @@
         self._opt_pull = gtk.CheckButton("use pull protocol to copy metadata")
         self._opt_uncomp = gtk.CheckButton("use uncompressed transfer")
         self._opt_proxy = gtk.CheckButton("use proxy server")        
+        self._opt_forest = gtk.CheckButton("source repository is a forest")
         option_box.pack_start(self._opt_update, False, False)
         option_box.pack_start(self._opt_pull, False, False)
         option_box.pack_start(self._opt_uncomp, False, False)
         option_box.pack_start(self._opt_proxy, False, False)
+        option_box.pack_start(self._opt_forest, False, False)
         vbox.pack_start(option_box, False, False, 15)
 
         if ui.ui().config('http_proxy', 'host', ''):   
@@ -279,7 +284,11 @@
         
         # start cloning        
         try:            
-            cmdline = ['hg', 'clone']
+            cmdline = ['hg']
+            if self._opt_forest.get_active():
+                cmdline.append('fclone')
+            else:
+                cmdline.append('clone')
             if self._opt_update.get_active():
                 cmdline.append('--noupdate')
             if self._opt_uncomp.get_active():
diff -r 5313a09bdd5f -r 039ae73bf795 hggtk/synch.py
--- a/hggtk/synch.py    Mon Sep 22 08:02:17 2008 +0100
+++ b/hggtk/synch.py    Sun Sep 28 12:31:55 2008 -0700
@@ -46,6 +46,9 @@
 
         # load the fetch extension explicitly
         extensions.load(self.ui, 'fetch', None)
+
+        # load the forest extension explicitly
+        extensions.load(self.ui, 'forest', None)
 
         name = self.repo.ui.config('web', 'name') or os.path.basename(root)
         self.set_title("TortoiseHg Synchronize - " + name)
@@ -165,6 +168,7 @@
         self._force = gtk.CheckButton('Force pull or push')
         self.tips.set_tip(self._force, 'Run even when remote repository'
                 ' is unrelated.')
+        self._forest = gtk.CheckButton('Repository is a forest')
 
         revhbox.pack_start(gtk.Label('Target Revision:'), False, False, 2)
         revhbox.pack_start(self._reventry, True, True, 2)
@@ -174,6 +178,7 @@
                 ' would like to push or pull.')
         revvbox.pack_start(eventbox, True, True, 8)
         revvbox.pack_start(self._force, False, False, 2)
+        revvbox.pack_start(self._forest, False, False, 2)
         hbox.pack_start(revvbox, True, True, 4)
 
         frame = gtk.Frame('Incoming/Outgoing')
@@ -366,10 +371,16 @@
         
     def _pull_clicked(self, toolbutton, data=None):
         aopts = self._get_advanced_options()
+        if self._forest.get_active():
+            fetchcmd = 'ffetch'
+            pullcmd = 'fpull'
+        else:
+            fetchcmd = 'fetch'
+            pullcmd = 'pull'
         if self._pull_fetch.get_active():
-            cmd = ['fetch', '--message', 'merge']
+            cmd = [fetchcmd, '--message', 'merge']
         else:
-            cmd = ['pull']
+            cmd = [pullcmd]
             cmd += aopts.get('force', [])
             if self._pull_update.get_active():
                 cmd.append('--update')
@@ -378,7 +389,11 @@
     
     def _push_clicked(self, toolbutton, data=None):
         aopts = self._get_advanced_options()
-        cmd = ['push']
+        if self._forest.get_active():
+            pushcmd = 'fpush'
+        else:
+            pushcmd = 'push'
+        cmd = [pushcmd]
         cmd += aopts.get('rev', [])
         cmd += aopts.get('force', [])
         self._exec_cmd(cmd)
diff -r 5313a09bdd5f -r 039ae73bf795 hggtk/update.py
--- a/hggtk/update.py   Mon Sep 22 08:02:17 2008 +0100
+++ b/hggtk/update.py   Sun Sep 28 12:31:55 2008 -0700
@@ -12,7 +12,7 @@
 import gtk
 from dialog import *
 from mercurial.node import *
-from mercurial import util, hg, ui
+from mercurial import util, hg, ui, extensions
 from mercurial.repo import RepoError
 from shlib import shell_notify, set_tortoise_icon
 from hglib import rootpath
@@ -37,6 +37,9 @@
         # set dialog title
         title = "hg update - %s" % self.cwd
         self.set_title(title)
+
+        # load the forest extension explicitly
+        extensions.load(u, 'forest', None)
 
         self._create()
         
@@ -108,6 +111,8 @@
         vbox.pack_start(revbox, False, False, 2)
 
         self._overwrite = gtk.CheckButton("Overwrite local changes")
+        self._forest = gtk.CheckButton("Repository is a forest")
+        vbox.pack_start(self._forest, False, False)
         vbox.pack_end(self._overwrite, False, False, 10)
         
         # show them all
@@ -179,8 +184,12 @@
                                    "to revision %s" % rev)
         if response != gtk.RESPONSE_YES:
             return
-            
-        cmdline = ['hg', 'update', '-R', self.root, '--rev', rev, '--verbose']
+ 
+        if self._forest.get_active():
+            cmd = 'fupdate'
+        else:
+            cmd = 'update'
+        cmdline = ['hg', cmd, '-R', self.root, '--rev', rev, '--verbose']
         if overwrite: 
             cmdline.append('--clean')
 

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to