Changeset 14cf67ad37b1…
Parent 1c5869a11840…
by
Changes to 2 files · Browse files at 14cf67ad37b1 Showing diff from parent 1c5869a11840 Diff from another changeset...
@@ -366,6 +366,29 @@ return fname
return None
+class NativeFileManager:
+ """
+ Wrapper for opening the specific file manager; Explorer on Windows,
+ Nautilus File Manager on Linux.
+ """
+ def __init__(self, path):
+ self.path = path
+
+ def run(self):
+ try:
+ import pywintypes
+ self.runExplorer()
+ except ImportError:
+ self.runNautilus()
+
+ def runExplorer(self):
+ import subprocess
+ subprocess.Popen('explorer "%s"' % self.path)
+
+ def runNautilus(self):
+ # TODO implement me!
+ pass
+
def markup(text, **kargs):
"""
A wrapper function for Pango Markup Language.
|
@@ -5,6 +5,7 @@ # This software may be used and distributed according to the terms of the
# GNU General Public License version 2, incorporated herein by reference.
+import re
import os
import gtk
import gobject
@@ -362,9 +363,8 @@ if returncode == 0:
if hasattr(self, 'notify_func'):
self.notify_func(*self.notify_args, **self.notify_kargs)
- if not self.cmd.is_show_log():
- self.response(gtk.RESPONSE_CLOSE)
self.cmd.set_result(_('Stripped successfully'), style='ok')
+ self.after_strip()
elif useraborted:
self.cmd.set_result(_('Canceled stripping'), style='error')
else:
@@ -372,5 +372,27 @@ self.switch_to(MODE_WORKING)
self.cmd.execute(cmdline, cmd_done)
+ def after_strip(self):
+ root = self.repo.root
+ bakdir = os.path.join(root, r'.hg\strip-backup')
+ escaped = bakdir.replace('\\', '\\\\')
+ buf = self.cmd.log.buffer
+ text = buf.get_text(buf.get_start_iter(), buf.get_end_iter())
+ m = re.search(escaped + r'\\[0-9abcdef]{12}-backup', text, re.I)
+ if m:
+ def open_bakdir():
+ gtklib.NativeFileManager(bakdir).run()
+ # backup bundle label & button
+ self.bubox = gtk.HBox()
+ self.vbox.pack_start(self.bubox, True, True, 2)
+ self.bulabel = gtk.Label(_('Saved at: %s') % m.group(0))
+ self.bubox.pack_start(self.bulabel, True, True, 8)
+ self.bulabel.set_alignment(0, 0.5)
+ self.bulabel.set_selectable(True)
+ self.bubtn = gtk.Button(_('Open...'))
+ self.bubox.pack_start(self.bubtn, False, False, 2)
+ self.bubtn.connect('clicked', lambda b: open_bakdir())
+ self.bubox.show_all()
+
def run(ui, *pats, **opts):
return StripDialog(None, *pats)
|
Loading...