def dodiff(tmproot): assert not (hascopies and len(MAR) > 1), \ 'dodiff cannot handle copies when diffing dirs' sa = [mod_a, add_a, rem_a] sb = [mod_b, add_b, rem_b] ctxs = [ctx1a, ctx1b, ctx2] # If more than one file, diff on working dir copy. copyworkingdir = len(MAR) > 1 dirs, labels, fns_and_mtimes = snapshotset(repo, ctxs, sa, sb, cpy, tmproot, copyworkingdir) dir1a, dir1b, dir2 = dirs label1a, label1b, label2 = labels fns_and_mtime = fns_and_mtimes[2] if len(MAR) > 1 and label2 == '': label2 = 'working files' def getfile(fname, dir, label): file = os.path.join(tmproot, dir, fname) if os.path.isfile(file): return fname+label, file nullfile = os.path.join(tmproot, 'empty') fp = open(nullfile, 'w') fp.close() return _nonexistant+label, nullfile # If only one change, diff the files instead of the directories # Handle bogus modifies correctly by checking if the files exist if len(MAR) == 1: file2 = util.localpath(MAR.pop()) if file2 in cto: file1 = util.localpath(cpy[file2]) else: file1 = file2 label1a, dir1a = getfile(file1, dir1a, label1a) if do3way: label1b, dir1b = getfile(file1, dir1b, label1b) label2, dir2 = getfile(file2, dir2, label2) if do3way: label1a += '[local]' label1b += '[other]' label2 += '[merged]' replace = dict(parent=dir1a, parent1=dir1a, parent2=dir1b, plabel1=label1a, plabel2=label1b, phash1=str(ctx1a), phash2=str(ctx1b), repo=hglib.get_reponame(repo), clabel=label2, child=dir2, chash=str(ctx2)) launchtool(diffcmd, args, replace, True) # detect if changes were made to mirrored working files for copy_fn, working_fn, mtime in fns_and_mtime: if os.path.getmtime(copy_fn) != mtime: ui.debug('file changed while diffing. ' 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn)) util.copyfile(copy_fn, working_fn)
def realized(self, *args): # set title reponame = self.repo and hglib.get_reponame(self.repo) or '' self.set_title(self.get_title(reponame)) # add user-defined buttons self.buttons = {} for name, label, res in self.get_buttons(): btn = self.add_button(label, res) self.buttons[name] = btn # create Abort button (add later) btn = gtk.Button(_('Abort')) btn.connect('clicked', lambda *a: self.response(gtk.RESPONSE_CANCEL)) self.buttons['abort'] = btn # construct dialog body self.get_body(self.vbox) if self.earlyout: gtklib.idle_add_single_call(self.destroy) return # load persistent settings self.load_settings() # dialog size defsize = self.get_defsize() if defsize != (-1, -1): self.set_default_size(*defsize) # signal handler self.connect('response', self.dialog_response) # prepare to show self.before_show() self.vbox.show_all() gtklib.idle_add_single_call(self.after_init)
def __init__(self, fileglob='', *pats): 'Initialize the Dialog' gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) gtklib.set_tortoise_icon(self, 'ignore.ico') gtklib.set_tortoise_keys(self) self.set_default_size(630, 400) try: repo = hg.repository(ui.ui(), path=paths.find_root()) except error.RepoError: gtklib.idle_add_single_call(self.destroy) return self.repo = repo self.set_title(_('Ignore filter - %s') % hglib.get_reponame(repo)) self.notify_func = None # vbox for dialog main mainvbox = gtk.VBox() self.add(mainvbox) mainvbox.set_border_width(2) ## layout table for top table = gtklib.LayoutTable() mainvbox.pack_start(table, False, False) ### hbox for glob entry self.glob_entry = gtk.Entry() self.glob_entry.set_text(hglib.toutf(fileglob)) self.glob_entry.connect('activate', self.add_glob) glob_button = gtk.Button(_('Add')) glob_button.connect('clicked', self.add_glob) table.add_row(_('Glob:'), self.glob_entry, 0, glob_button, expand=0) ### hbox for regexp entry self.regexp_entry = gtk.Entry() self.regexp_entry.connect('activate', self.add_regexp) regexp_button = gtk.Button(_('Add')) regexp_button.connect('clicked', self.add_regexp) table.add_row(_('Regexp:'), self.regexp_entry, 0, regexp_button, expand=0) ignorefiles = [repo.wjoin('.hgignore')] for name, value in repo.ui.configitems('ui'): if name == 'ignore' or name.startswith('ignore.'): ignorefiles.append(os.path.expanduser(value)) ### ignore file combo if needs if len(ignorefiles) > 1: # file selector combo = gtk.combo_box_new_text() for f in ignorefiles: combo.append_text(hglib.toutf(f)) combo.set_active(0) combo.connect('changed', self.file_selected) # edit button edit = gtk.Button(_('Edit File')) edit.connect('clicked', self.edit_clicked) table.add_row(_('Apply to:'), combo, 0, edit, padding=False, expand=0) self.ignorefile = ignorefiles[0] ## hbox for filter & unknown list hbox = gtk.HBox() mainvbox.pack_start(hbox, True, True) ### frame for filter list & button frame = gtk.Frame(_('Filters')) hbox.pack_start(frame, True, True, 4) vbox = gtk.VBox() frame.add(vbox) vbox.set_border_width(2) #### filter list scrolledwindow = gtk.ScrolledWindow() vbox.pack_start(scrolledwindow, True, True, 2) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrolledwindow.set_border_width(4) pattree = gtk.TreeView() scrolledwindow.add(pattree) pattree.set_enable_search(False) pattree.set_reorderable(False) pattree.get_selection().set_mode(gtk.SELECTION_SINGLE) col = gtk.TreeViewColumn(_('Patterns'), gtk.CellRendererText(), text=0) pattree.append_column(col) pattree.set_headers_visible(False) self.pattree = pattree #### remove button bhbox = gtk.HBox() vbox.pack_start(bhbox, False, False, 2) self.removebtn = gtk.Button(_('Remove Selected')) bhbox.pack_start(self.removebtn, False, False, 2) self.removebtn.connect('clicked', self.remove_clicked) self.removebtn.set_sensitive(False) ### frame for unknown file list & button frame = gtk.Frame(_('Unknown Files')) hbox.pack_start(frame, True, True, 4) vbox = gtk.VBox() frame.add(vbox) vbox.set_border_width(2) #### unknown file list scrolledwindow = gtk.ScrolledWindow() vbox.pack_start(scrolledwindow, True, True, 2) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) scrolledwindow.set_border_width(4) unktree = gtk.TreeView() scrolledwindow.add(unktree) unktree.set_search_equal_func(self.unknown_search) col = gtk.TreeViewColumn(_('Files'), gtk.CellRendererText(), text=0) unktree.append_column(col) model = gtk.ListStore(str, str) unktree.set_model(model) unktree.set_headers_visible(False) self.unkmodel = model #### refresh button bhbox = gtk.HBox() vbox.pack_start(bhbox, False, False, 2) refresh = gtk.Button(_('Refresh')) bhbox.pack_start(refresh, False, False, 2) refresh.connect('pressed', lambda b: self.refresh()) self.connect('thg-refresh', lambda w: self.refresh()) # register signal handlers pattree.get_selection().connect('changed', self.pattree_rowchanged) unktree.get_selection().connect('changed', self.unknown_rowchanged) # prepare to show self.glob_entry.grab_focus() gtklib.idle_add_single_call(self.refresh)
def __init__(self, repo, pats, ctx1a, sa, ctx1b, sb, ctx2, cpy): 'Initialize the Dialog' gtk.Dialog.__init__(self, title=_('Visual Diffs')) gtklib.set_tortoise_icon(self, 'menushowchanged.ico') gtklib.set_tortoise_keys(self) if ctx2.rev() is None: title = _('working changes') elif ctx1a == ctx2.parents()[0]: title = _('changeset ') + str(ctx2.rev()) else: title = _('revisions %d to %d') % (ctx1a.rev(), ctx2.rev()) title = _('Visual Diffs - ') + title if pats: title += _(' filtered') self.set_title(title) self.set_default_size(400, 250) self.set_has_separator(False) self.reponame=hglib.get_reponame(repo) self.ctxs = (ctx1a, ctx1b, ctx2) self.copies = cpy self.ui = repo.ui lbl = gtk.Label(_('Temporary files are removed when this dialog ' 'is closed')) self.vbox.pack_start(lbl, False, False, 2) scroller = gtk.ScrolledWindow() scroller.set_shadow_type(gtk.SHADOW_IN) scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) treeview = gtk.TreeView() self.treeview = treeview treeview.get_selection().set_mode(gtk.SELECTION_SINGLE) treeview.set_search_equal_func(self.search_filelist) scroller.add(treeview) self.vbox.pack_start(scroller, True, True, 2) treeview.connect('row-activated', self.rowactivated) treeview.set_headers_visible(False) treeview.set_property('enable-grid-lines', True) treeview.set_enable_search(False) accelgroup = gtk.AccelGroup() self.add_accel_group(accelgroup) mod = gtklib.get_thg_modifier() key, modifier = gtk.accelerator_parse(mod+'d') treeview.add_accelerator('thg-diff', accelgroup, key, modifier, gtk.ACCEL_VISIBLE) treeview.connect('thg-diff', self.rowactivated) cell = gtk.CellRendererText() stcol = gtk.TreeViewColumn('Status', cell) stcol.set_resizable(True) stcol.add_attribute(cell, 'text', 0) treeview.append_column(stcol) cell = gtk.CellRendererText() fcol = gtk.TreeViewColumn('Filename', cell) fcol.set_resizable(True) fcol.add_attribute(cell, 'text', 1) treeview.append_column(fcol) model = gtk.ListStore(str, str) treeview.set_model(model) tools = hglib.difftools(repo.ui) preferred = besttool(repo.ui, tools) self.diffpath, self.diffopts, self.mergeopts = tools[preferred] hbox = gtk.HBox() self.vbox.pack_start(hbox, False, False, 2) if ctx2.rev() is None: pass # Do not offer directory diffs when the working directory # is being referenced directly elif ctx1b: self.p1button = gtk.Button(_('Dir diff to p1')) self.p1button.connect('pressed', self.p1dirdiff) self.p2button = gtk.Button(_('Dir diff to p2')) self.p2button.connect('pressed', self.p2dirdiff) self.p3button = gtk.Button(_('3-way dir diff')) self.p3button.connect('pressed', self.threewaydirdiff) hbox.pack_end(self.p3button, False, False) hbox.pack_end(self.p2button, False, False) hbox.pack_end(self.p1button, False, False) else: self.dbutton = gtk.Button(_('Directory diff')) self.dbutton.connect('pressed', self.p1dirdiff) hbox.pack_end(self.dbutton, False, False) self.update_diff_buttons(preferred) if len(tools) > 1: combo = gtk.combo_box_new_text() for i, name in enumerate(tools.iterkeys()): combo.append_text(name) if name == preferred: defrow = i combo.set_active(defrow) combo.connect('changed', self.toolselect, tools) hbox.pack_start(combo, False, False, 2) patterns = repo.ui.configitems('diff-patterns') patterns = [(p, t) for p,t in patterns if t in tools] filesel = treeview.get_selection() filesel.connect('changed', self.fileselect, repo, combo, tools, patterns, preferred) gobject.idle_add(self.fillmodel, repo, model, sa, sb)
def get_reponame(self): return hglib.get_reponame(self.repo)
def __init__(self, repo, tag="", rev=""): """ Initialize the Dialog """ gtk.Dialog.__init__(self) gtklib.set_tortoise_keys(self) self.set_title(_("Tag - %s") % hglib.get_reponame(repo)) self.set_resizable(False) self.set_has_separator(False) self.connect("response", self.dialog_response) self.repo = repo # add buttons self.addbtn = self.add_button(_("Add"), RESPONSE_ADD) self.removebtn = self.add_button(_("Remove"), RESPONSE_REMOVE) self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE) # persistent settings self.settings = settings.Settings("tagadd") # top layout table table = gtklib.LayoutTable() self.vbox.pack_start(table, True, True, 2) ## tag name input self.tagcombo = gtk.combo_box_entry_new_text() self.tagentry = self.tagcombo.get_child() self.tagentry.set_text(hglib.toutf(tag)) self.tagcombo.connect("changed", self.combo_changed) self.tagentry.connect("activate", lambda *a: self.response(RESPONSE_ADD)) table.add_row(_("Tag:"), self.tagcombo, padding=False) ## revision input self.reventry = gtk.Entry() self.reventry.set_width_chars(12) self.reventry.set_text(rev) self.initial_rev = rev self.reventry.connect("notify::text", lambda *a: self.update_sensitives()) table.add_row(_("Revision:"), self.reventry) # advanced options expander self.expander = gtk.Expander(_("Advanced options")) self.vbox.pack_start(self.expander, True, True, 2) # advanced options layout table table = gtklib.LayoutTable() self.expander.add(table) ## tagging options self.localchk = gtk.CheckButton(_("Tag is local")) self.localchk.connect("toggled", self.local_tag_toggled) self.replacechk = gtk.CheckButton(_("Replace existing tag")) self.replacechk.connect("toggled", lambda *a: self.update_sensitives()) self.engchk = gtk.CheckButton(_("Use English commit message")) engmsg = self.repo.ui.configbool("tortoisehg", "engmsg", False) self.engchk.set_active(engmsg) table.add_row(self.localchk) table.add_row(self.replacechk) table.add_row(self.engchk) ## custom commit message self.customchk = gtk.CheckButton(_("Use custom commit message:")) self.customchk.connect("toggled", self.msg_toggled) self.msgentry = gtk.Entry() self.msgentry.set_sensitive(False) table.add_row(self.customchk) table.add_row(self.msgentry, padding=False) # prepare to show self.load_settings() self.update_tagcombo(clear=False) self.update_sensitives(True) self.tagentry.grab_focus()
def __init__(self): """ Initialize the Dialog. """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) gtklib.set_tortoise_icon(self, 'general.ico') gtklib.set_tortoise_keys(self) self.set_default_size(600, 400) self.connect('delete-event', self._delete) self.hgthread = None self.inprogress = False self.last_pbar_update = 0 try: repo = hg.repository(ui.ui(), path=paths.find_root()) except error.RepoError: gtklib.idle_add_single_call(self.destroy) return self.repo = repo self.reponame = hglib.get_reponame(repo) self.set_title(_('%s - recovery') % self.reponame) # toolbar self.tbar = gtk.Toolbar() self.tips = gtklib.Tooltips() self._stop_button = self._toolbutton(gtk.STOCK_STOP, _('Stop'), self._stop_clicked, tip=_('Stop the hg operation')) self._stop_button.set_sensitive(False) tbuttons = [ self._toolbutton(gtk.STOCK_CLEAR, _('Clean'), self._clean_clicked, tip=_('Clean checkout, undo all changes')), gtk.SeparatorToolItem(), self._toolbutton(gtk.STOCK_UNDO, _('Rollback'), self._rollback_clicked, tip=_('Rollback (undo) last transaction to ' 'repository (pull, commit, etc)')), gtk.SeparatorToolItem(), self._toolbutton(gtk.STOCK_CLEAR, _('Recover'), self._recover_clicked, tip=_('Recover from interrupted operation')), gtk.SeparatorToolItem(), self._toolbutton(gtk.STOCK_APPLY, _('Verify'), self._verify_clicked, tip=_('Validate repository consistency')), gtk.SeparatorToolItem(), self._stop_button, gtk.SeparatorToolItem(), ] for btn in tbuttons: self.tbar.insert(btn, -1) vbox = gtk.VBox() self.add(vbox) vbox.pack_start(self.tbar, False, False, 2) # hg output window scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.textview = gtk.TextView(buffer=None) self.textview.set_editable(False) fontlog = hglib.getfontconfig()['fontlog'] self.textview.modify_font(pango.FontDescription(fontlog)) scrolledwindow.add(self.textview) self.textbuffer = self.textview.get_buffer() gtklib.configstyles(repo.ui) for tag, argdict in gtklib.TextBufferTags.iteritems(): self.textbuffer.create_tag(tag, **argdict) vbox.pack_start(scrolledwindow, True, True) self.progstat = gtk.Label() vbox.pack_start(self.progstat, False, False, 0) self.progstat.set_alignment(0, 0.5) self.progstat.set_ellipsize(pango.ELLIPSIZE_END) self.pbar = gtk.ProgressBar() vbox.pack_start(self.pbar, False, False, 2)
def __init__(self): 'Initialize the Dialog' gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) gtklib.set_tortoise_icon(self, 'detect_rename.ico') gtklib.set_tortoise_keys(self) try: repo = hg.repository(ui.ui(), path=paths.find_root()) except error.RepoError: gtklib.idle_add_single_call(self.destroy) return self.repo = repo self.notify_func = None reponame = hglib.get_reponame(repo) self.set_title(_('Detect Copies/Renames in %s') % reponame) self.settings = settings.Settings('guess') dims = self.settings.get_value('dims', (800, 600)) self.set_default_size(dims[0], dims[1]) # vbox for dialog main & status bar mainvbox = gtk.VBox() self.add(mainvbox) # vsplit for top & diff self.vpaned = gtk.VPaned() mainvbox.pack_start(self.vpaned, True, True, 2) pos = self.settings.get_value('vpaned', None) if pos: self.vpaned.set_position(pos) # vbox for top contents topvbox = gtk.VBox() self.vpaned.pack1(topvbox, True, False) # frame for simularity frame = gtk.Frame(_('Minimum Simularity Percentage')) topvbox.pack_start(frame, False, False, 2) #$ simularity slider self.adjustment = gtk.Adjustment(50, 0, 100, 1) value = self.settings.get_value('percent', None) if value: self.adjustment.set_value(value) hscale = gtk.HScale(self.adjustment) frame.add(hscale) # horizontal splitter for unknown & candidate self.hpaned = gtk.HPaned() topvbox.pack_start(self.hpaned, True, True, 2) pos = self.settings.get_value('hpaned', None) if pos: self.hpaned.set_position(pos) #$ frame for unknown list unknownframe = gtk.Frame(_('Unrevisioned Files')) self.hpaned.pack1(unknownframe, True, True) #$$ vbox for unknown list & rename/copy buttons unkvbox = gtk.VBox() unknownframe.add(unkvbox) #$$$ scroll window for unknown list scroller = gtk.ScrolledWindow() unkvbox.pack_start(scroller, True, True, 2) scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) #$$$$ unknown list unkmodel = gtk.ListStore(str, # path str) # path (utf-8) self.unktree = gtk.TreeView(unkmodel) scroller.add(self.unktree) self.unktree.get_selection().set_mode(gtk.SELECTION_MULTIPLE) cell = gtk.CellRendererText() cell.set_property("ellipsize", pango.ELLIPSIZE_START) col = gtk.TreeViewColumn('File', cell, text=1) self.unktree.append_column(col) self.unktree.set_enable_search(True) self.unktree.set_headers_visible(False) #$$$ hbox for rename/copy buttons btnhbox = gtk.HBox() unkvbox.pack_start(btnhbox, False, False, 2) #$$$$ rename/copy buttons in unknown frame self.renamebtn = gtk.Button(_('Find Renames')) self.renamebtn.set_sensitive(False) btnhbox.pack_start(self.renamebtn, False, False, 2) self.copybtn = gtk.Button(_('Find Copies')) self.copybtn.set_sensitive(False) btnhbox.pack_start(self.copybtn, False, False, 2) #$ frame for candidate list candidateframe = gtk.Frame(_('Candidate Matches')) self.hpaned.pack2(candidateframe, True, True) #$$ vbox for candidate list & accept button canvbox = gtk.VBox() candidateframe.add(canvbox) #$$$ scroll window for candidate list scroller = gtk.ScrolledWindow() canvbox.pack_start(scroller, True, True, 2) scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) #$$$$ candidate list canmodel = gtk.ListStore(str, # source str, # source (utf-8) str, # dest str, # dest (utf-8) str, # percent bool) # sensitive self.cantree = gtk.TreeView(canmodel) scroller.add(self.cantree) self.cantree.set_rules_hint(True) self.cantree.set_reorderable(False) self.cantree.set_enable_search(False) self.cantree.get_selection().set_mode(gtk.SELECTION_MULTIPLE) cell = gtk.CellRendererText() cell.set_property('width-chars', 30) cell.set_property('ellipsize', pango.ELLIPSIZE_START) col = gtk.TreeViewColumn(_('Source'), cell, text=1, sensitive=5) col.set_resizable(True) self.cantree.append_column(col) cell = gtk.CellRendererText() cell.set_property('width-chars', 30) cell.set_property('ellipsize', pango.ELLIPSIZE_START) col = gtk.TreeViewColumn(_('Dest'), cell, text=3, sensitive=5) col.set_resizable(True) self.cantree.append_column(col) cell = gtk.CellRendererText() cell.set_property('width-chars', 5) cell.set_property('ellipsize', pango.ELLIPSIZE_NONE) col = gtk.TreeViewColumn('%', cell, text=4, sensitive=5) col.set_resizable(True) self.cantree.append_column(col) #$$$ hbox for accept button btnhbox = gtk.HBox() canvbox.pack_start(btnhbox, False, False, 2) #$$$$ accept button in candidate frame self.acceptbtn = gtk.Button(_('Accept Match')) btnhbox.pack_start(self.acceptbtn, False, False, 2) self.acceptbtn.set_sensitive(False) # frame for diff diffframe = gtk.Frame(_('Differences from Source to Dest')) self.vpaned.pack2(diffframe) diffframe.set_shadow_type(gtk.SHADOW_ETCHED_IN) #$ scroll window for diff scroller = gtk.ScrolledWindow() diffframe.add(scroller) scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) #$$ text view for diff self.buf = gtk.TextBuffer() self.buf.create_tag('removed', foreground=gtklib.DRED) self.buf.create_tag('added', foreground=gtklib.DGREEN) self.buf.create_tag('position', foreground=gtklib.DORANGE) self.buf.create_tag('header', foreground=gtklib.DBLUE) diffview = gtk.TextView(self.buf) scroller.add(diffview) fontdiff = hglib.getfontconfig()['fontdiff'] diffview.modify_font(pango.FontDescription(fontdiff)) diffview.set_wrap_mode(gtk.WRAP_NONE) diffview.set_editable(False) # status bar self.stbar = statusbar.StatusBar() mainvbox.pack_start(self.stbar, False, False, 2) # register signal handlers self.copybtn.connect('pressed', lambda b: self.find_copies()) self.renamebtn.connect('pressed', lambda b: self.find_renames()) self.acceptbtn.connect('pressed', lambda b: self.accept_match()) self.unktree.get_selection().connect('changed', self.unknown_sel_change) self.cantree.connect('row-activated', lambda t,p,c: self.accept_match()) self.cantree.get_selection().connect('changed', self.show_diff) self.connect('delete-event', lambda *a: self.save_settings()) gtklib.idle_add_single_call(self.refresh)
def __init__(self, repos=[], pushmode=False): """ Initialize the Dialog. """ gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) gtklib.set_tortoise_icon(self, 'menusynch.ico') gtklib.set_tortoise_keys(self) self.root = paths.find_root() self.selected_path = None self.hgthread = None self.notify_func = None self.last_drop_time = None self.lastcmd = [] # persistent app data self._settings = settings.Settings('synch') self.set_default_size(655, 552) self.paths = self.get_paths() self.set_title(_('%s - synchronize') % hglib.get_reponame(self.repo)) self.connect('delete-event', self.delete) # toolbar self.tbar = gtk.Toolbar() self.tips = gtklib.Tooltips() self.stop_button = self.toolbutton(gtk.STOCK_STOP, _('Stop'), self.stop_clicked, tip=_('Stop the hg operation')) self.stop_button.set_sensitive(False) tbuttons = [ self.toolbutton(gtk.STOCK_GO_DOWN, _('Incoming'), self.incoming_clicked, tip=_('Display changes that can be pulled ' 'from selected repository')), self.toolbutton(gtk.STOCK_GOTO_BOTTOM, _(' Pull '), self.pull_clicked, tip=_('Pull changes from selected ' 'repository')), gtk.SeparatorToolItem(), self.toolbutton(gtk.STOCK_GO_UP, _('Outgoing'), self.outgoing_clicked, tip=_('Display local changes that will be ' 'pushed to selected repository')), self.toolbutton(gtk.STOCK_GOTO_TOP, _('Push'), self.push_clicked, tip=_('Push local changes to selected ' 'repository')), self.toolbutton(gtk.STOCK_GOTO_LAST, _('Email'), self.email_clicked, tip=_('Email local outgoing changes to ' 'one or more recipients')), self.toolbutton(gtk.STOCK_UNDO, _('Shelve'), self.shelve_clicked, tip=_('Shelve uncommited changes')), gtk.SeparatorToolItem(), self.stop_button, gtk.SeparatorToolItem(), self.toolbutton(gtk.STOCK_PREFERENCES, _('Configure'), self.conf_clicked, tip=_('Configure peer repository paths')), gtk.SeparatorToolItem(), ] for btn in tbuttons: self.tbar.insert(btn, -1) # Base box self.basevbox = basevbox = gtk.VBox() self.add(basevbox) basevbox.pack_start(self.tbar, False, False, 2) # Sync Target Path targethbox = gtk.HBox() ## target selection buttons lbl = gtk.Button(_('Repo:')) lbl.unset_flags(gtk.CAN_FOCUS) lbl.connect('clicked', self.btn_remotepath_clicked) targethbox.pack_start(lbl, False, False) lbl = gtk.Button(_('Bundle:')) lbl.unset_flags(gtk.CAN_FOCUS) lbl.connect('clicked', self.btn_bundlepath_clicked) targethbox.pack_start(lbl, False, False) ## target path combobox self.pathlist = gtk.ListStore(str, str) self.pathbox = gtk.ComboBoxEntry(self.pathlist, 0) self.pathtext = self.pathbox.get_child() cell = gtk.CellRendererText() self.pathbox.pack_end(cell, False) self.pathbox.add_attribute(cell, 'text', 1) targethbox.pack_start(self.pathbox, True, True) self.fill_path_combo() defrow = None defpushrow = None for i, (path, alias) in enumerate(self.pathlist): if alias == 'default': defrow = i if defpushrow is None: defpushrow = i elif alias == 'default-push': defpushrow = i if repos: self.pathtext.set_text(hglib.toutf(repos[0])) elif defpushrow is not None and pushmode: self.pathbox.set_active(defpushrow) elif defrow is not None: self.pathbox.set_active(defrow) exs = [ name for name, module in extensions.extensions() ] # Post Pull Operation ppullhbox = gtk.HBox() self.ppulldata = [('none', _('Nothing')), ('update', _('Update'))] cfg = self.repo.ui.config('tortoisehg.postpull', 'none') if 'fetch' in exs or 'fetch' == cfg: self.ppulldata.append(('fetch', _('Fetch'))) if 'rebase' in exs or 'rebase' == cfg: self.ppulldata.append(('rebase', _('Rebase'))) self.ppullcombo = combo = gtk.combo_box_new_text() for (index, (name, label)) in enumerate(self.ppulldata): combo.insert_text(index, label) ppullhbox.pack_start(gtk.Label(_('Post Pull: ')), False, False, 2) ppullhbox.pack_start(self.ppullcombo, True, True) # Fixed options box (non-foldable) fixedhbox = gtk.HBox() fixedhbox.pack_start(targethbox, True, True, 2) fixedhbox.pack_start(ppullhbox, False, False, 2) # Advanced options (foldable) opthbox = gtk.HBox() self.expander = expander = gtk.Expander(_('Advanced Options')) expander.set_expanded(False) expander.connect_after('activate', self.expanded) expander.add(opthbox) ## checkbox options chkopthbox = gtk.HBox() self.force = gtk.CheckButton(_('Force pull or push')) self.tips.set_tip(self.force, _('Run even when remote repository is unrelated.')) self.newbranch = gtk.CheckButton(_('Push new branch')) self.tips.set_tip(self.newbranch, _('Allow pushing a new branch')) self.use_proxy = gtk.CheckButton(_('Use proxy server')) if ui.ui().config('http_proxy', 'host', ''): self.use_proxy.set_active(True) else: self.use_proxy.set_sensitive(False) chkopthbox.pack_start(self.force, False, False, 4) chkopthbox.pack_start(self.newbranch, False, False, 4) chkopthbox.pack_start(self.use_proxy, False, False, 4) ## target revision option revhbox = gtk.HBox() self.reventry = gtk.Entry() revhbox.pack_start(gtk.Label(_('Target revision:')), False, False, 2) revhbox.pack_start(self.reventry, True, True, 2) reveventbox = gtk.EventBox() reveventbox.add(revhbox) self.tips.set_tip(reveventbox, _('A specific revision up to which you ' 'would like to push or pull.')) ## remote command option cmdhbox = gtk.HBox() self.cmdentry = gtk.Entry() cmdhbox.pack_start(gtk.Label(_('Remote command:')), False, False, 2) cmdhbox.pack_start(self.cmdentry, True, True, 2) cmdeventbox = gtk.EventBox() cmdeventbox.add(cmdhbox) self.tips.set_tip(cmdeventbox, _('Name of hg executable on remote machine.')) revvbox = gtk.VBox() revvbox.pack_start(chkopthbox, False, False, 8) revvbox.pack_start(reveventbox, False, False, 4) revvbox.pack_start(cmdeventbox, False, False, 4) opthbox.pack_start(revvbox, True, True, 4) ## incoming/outgoing options frame = gtk.Frame(_('Incoming/Outgoing')) opthbox.pack_start(frame, False, False, 2) self.showpatch = gtk.CheckButton(_('Show patches')) self.newestfirst = gtk.CheckButton(_('Show newest first')) self.nomerge = gtk.CheckButton(_('Show no merges')) iovbox = gtk.VBox() iovbox.pack_start(self.showpatch, False, False, 2) iovbox.pack_start(self.newestfirst, False, False, 2) iovbox.pack_start(self.nomerge, False, False, 2) frame.add(iovbox) # Main option box topvbox = gtk.VBox() topvbox.pack_start(fixedhbox, True, True, 2) topvbox.pack_start(expander, False, False, 2) basevbox.pack_start(topvbox, False, False, 2) # hg output window scrolledwindow = gtk.ScrolledWindow() scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN) scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) self.textview = gtk.TextView(buffer=None) self.textview.set_editable(False) fontlog = hglib.getfontconfig()['fontlog'] self.textview.modify_font(pango.FontDescription(fontlog)) scrolledwindow.add(self.textview) self.textview.connect('populate-popup', self.add_to_popup) self.textbuffer = self.textview.get_buffer() gtklib.configstyles(self.repo.ui) for tag, argdict in gtklib.TextBufferTags.iteritems(): self.textbuffer.create_tag(tag, **argdict) basevbox.pack_start(scrolledwindow, True, True) # statusbar self.stbar = statusbar.StatusBar() basevbox.pack_end(self.stbar, False, False, 2) # support dropping of repos or bundle files self.drag_dest_set(gtk.DEST_DEFAULT_ALL, [("text/uri-list", 0, 1)], gtk.gdk.ACTION_COPY) self.connect('drag_data_received', self._drag_receive) # prepare to show self.load_settings() self.update_pull_setting() gtklib.idle_add_single_call(self.finalize_startup)