def __init__(self, cwd='', rev=''): """ Initialize the Dialog """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) set_tortoise_icon(self, 'menucheckout.ico') self.cwd = cwd or os.getcwd() self.root = rootpath(self.cwd) self.rev = rev self.notify_func = None u = ui.ui() try: self.repo = hg.repository(u, path=self.root) except RepoError: return None # set dialog title title = "hg update - %s" % self.cwd self.set_title(title) self._create()
'only_merges':None, 'prune':[], 'git':False, 'verbose':False, 'include':[], 'exclude':[] } dialog = DataMineDialog(u, repo, cwd, files, cmdoptions, True) dialog.display() for f in files: if os.path.isfile(f): cf = util.canonpath(root, cwd, f) dialog.add_annotate_page(cf, '.') elif os.path.isdir(f): Prompt('Invalid path', "Can't annotate directory: %s" % f, dialog).run() if not dialog.notebook.get_n_pages(): dialog.add_search_page() gtk.gdk.threads_init() gtk.gdk.threads_enter() gtk.main() gtk.gdk.threads_leave() if __name__ == "__main__": import sys import hglib opts = {} opts['cwd'] = os.getcwd() opts['root'] = hglib.rootpath() opts['files'] = sys.argv[1:] or [] run(**opts)
'user':'', 'date':'', 'modified':True, 'added':True, 'removed':True, 'deleted':True, 'unknown':False, 'ignored':False, 'exclude':[], 'include':[], 'check': False, 'git':False, 'logfile':'', 'addremove':False, } dialog = GCommit(u, repo, cwd, files, cmdoptions, main) dialog.display() return dialog def run(root='', files=[], cwd='', **opts): # If no files or directories were selected, take current dir # TODO: Not clear if this is best; user may expect repo wide if not files and cwd: files = [cwd] if launch(root, files, cwd, True): gtk.gdk.threads_init() gtk.gdk.threads_enter() gtk.main() gtk.gdk.threads_leave() if __name__ == "__main__": import sys from hglib import rootpath opts = {} opts['cwd'] = len(sys.argv) > 1 and sys.argv[1] or os.getcwd() opts['root'] = rootpath(opts['cwd']) run(**opts)
out = [line + '\n' for line in self.ignorelines] try: f = open(os.path.join(self.root, '.hgignore'), 'wb') f.writelines(out) f.close() except IOError: pass def _close_clicked(self, toolbutton, data=None): self.destroy() def _toolbutton(self, stock, label, handler, tip): tbutton = gtk.ToolButton(stock) tbutton.set_label(label) tbutton.set_tooltip(self.tips, tip) tbutton.connect('clicked', handler) return tbutton def run(root='', **opts): dialog = HgIgnoreDialog(root) dialog.show_all() dialog.connect('destroy', gtk.main_quit) gtk.gdk.threads_init() gtk.gdk.threads_enter() gtk.main() gtk.gdk.threads_leave() if __name__ == "__main__": opts = {'root' : hglib.rootpath()} run(**opts)