# HG changeset patch
# User Sune Foldager <c...@cyanite.org>
# Date 1256405906 -7200
# Branch stable
# Node ID bf996eea3ac3934564a49df007ab3664ae645938
# Parent  1037a39a6f4194f8cf72ab5d6405021b17b1fdb4
add support for bundle:<path>[+<bundlefile>] repository paths

When a bundle is set like that, the history command displays it as per
the 'Add Bundle...' menu item, except the bundle is automatically rejected
when leaving the program, if not previously accepted by the user.

diff --git a/tortoisehg/hgtk/hgtk.py b/tortoisehg/hgtk/hgtk.py
--- a/tortoisehg/hgtk/hgtk.py
+++ b/tortoisehg/hgtk/hgtk.py
@@ -212,8 +212,16 @@
     elif not cmd:
         return help_(ui, 'shortlist')
 
-    if options['repository']:
-        path = ui.expandpath(options['repository'])
+    path = options['repository']
+    if path:
+        if path.startswith('bundle:'):
+            s = path[7:].split('+', 1)
+            if len(s) == 1:
+                path, bundle = os.getcwd(), s[0]
+            else:
+                path, bundle = s
+            cmdoptions['bundle'] = os.path.abspath(bundle)
+        path = ui.expandpath(path)
         cmdoptions['repository'] = path
         os.chdir(path)
     if options['nofork']:
diff --git a/tortoisehg/hgtk/history.py b/tortoisehg/hgtk/history.py
--- a/tortoisehg/hgtk/history.py
+++ b/tortoisehg/hgtk/history.py
@@ -53,6 +53,7 @@
         self.useproxy = None
         self.revrange = None
         self.forcepush = False
+        self.bundle_autoreject = False
         os.chdir(self.repo.root)
 
         # Load extension support for commands which need it
@@ -70,7 +71,7 @@
 
     def should_live(self, widget=None, event=None):
         live = False
-        if self.bfile:
+        if self.bfile and not self.bundle_autoreject:
             t = _('New changesets from the preview bundle are still pending.'
                   '\n\nAccept or reject the new changesets?')
             # response: 0=Yes, 1=No, 2=Cancel
@@ -475,7 +476,11 @@
             self.filtercombo.set_active(1)
             self.filterentry.set_text(', '.join(self.pats))
             opts['pats'] = self.pats
-        self.reload_log(**opts)
+        if 'bundle' in opts:
+            self.set_bundlefile(opts['bundle'])
+            self.bundle_autoreject = True
+        else:
+            self.reload_log(**opts)
 
         self.filterbox.set_property('visible', self.show_filterbar)
         self.filterbox.set_no_show_all(True)
@@ -1192,7 +1197,7 @@
         if dlg.return_code() == 0 and os.path.isfile(bfile):
             self.set_bundlefile(bfile)
 
-    def set_bundlefile(self, bfile):
+    def set_bundlefile(self, bfile, **kwopts):
         self.origurl = self.urlcombo.get_active()
         self.pathentry.set_text(bfile)
 
@@ -1239,9 +1244,10 @@
         self.changeview.set_repo(self.repo)
         self.changeview.bfile = bfile
         self.npreviews = len(self.repo) - oldtip
-        self.reload_log()
+        self.reload_log(**kwopts)
 
         self.stbar.set_idle_text(_('Bundle Preview'))
+        self.bundle_autoreject = False
 
     def add_bundle_clicked(self, button):
         result = gtklib.NativeSaveFileDialogWrapper(

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) 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 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Tortoisehg-develop mailing list
Tortoisehg-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to