def run(cmdline=[], gui=True, **opts): if not gui: q = Queue.Queue() hgcmd_toq(None, q, *cmdline[1:]) return dlg = CmdDialog(cmdline) dlg.connect('response', gtk.main_quit) dlg.show_all() gtk.gdk.threads_init() gtk.gdk.threads_enter() gtk.main() gtk.gdk.threads_leave()
def _do_hg_cmd(self, cmd, options): import os.path try: q = Queue.Queue() args = [cmd] + [os.path.join(self.root, x) for x in self.files] hglib.hgcmd_toq(self.root, q, *args, **{}) out = '' while q.qsize(): out += q.get(0) self.hgout = out except util.Abort, inst: error_dialog(self, "Error in %s command" % cmd, "abort: %s" % inst) return False
def _save_file_rev(self, menuitem): file = util.localpath(self.curfile) file, ext = os.path.splitext(os.path.basename(file)) filename = "%s@%d%s" % (file, self.currev, ext) fd = NativeSaveFileDialogWrapper(Title = "Save file to", InitialDir=self.cwd, FileName=filename) result = fd.run() if result: import Queue import hglib q = Queue.Queue() cpath = util.canonpath(self.repo.root, self.cwd, self.curfile) hglib.hgcmd_toq(self.repo.root, q, 'cat', '--rev', str(self.currev), '--output', result, cpath)