def run(hgcmd='add', root='', cwd='', files=[], **opts): u = ui.ui() u.updateopts(debug=False, traceback=False) repo = hg.repository(u, path=root) cmdoptions = { 'all':False, 'clean':False, 'ignored':False, 'modified':False, 'added':True, 'removed':True, 'deleted':True, 'unknown':False, 'rev':[], 'exclude':[], 'include':[], 'debug':True,'verbose':True } if hgcmd == 'add': cmdoptions['unknown'] = True elif hgcmd == 'remove': cmdoptions['clean'] = True else: raise "Invalid command '%s'" % hgcmd dialog = GStatus(u, repo, cwd, files, cmdoptions, True) gtk.gdk.threads_init() gtk.gdk.threads_enter() dialog.display() gtk.main() gtk.gdk.threads_leave()
def _diff_revs(self, menuitem): from status import GStatus from gtools import cmdtable rev0, rev1 = self._revs statopts = self.merge_opts(cmdtable['gstatus|gst'][1], ('include', 'exclude', 'git')) statopts['rev'] = ['%u:%u' % (rev0, rev1)] statopts['modified'] = True statopts['added'] = True statopts['removed'] = True dialog = GStatus(self.ui, self.repo, self.cwd, [], statopts, False) dialog.display() return True
def _diff_file_from_mark(self, menuitem): '''User selected diff from mark from the file list context menu''' from status import GStatus from gtools import cmdtable rev0 = self.graphview.get_mark_rev() rev1 = self.currev statopts = self.merge_opts(cmdtable['gstatus|gst'][1], ('include', 'exclude', 'git')) statopts['rev'] = ['%u:%u' % (rev0, rev1)] statopts['modified'] = True statopts['added'] = True statopts['removed'] = True dialog = GStatus(self.ui, self.repo, self.cwd, [self.curfile], statopts, False) dialog.display()
def parse_opts(self): GStatus.parse_opts(self) # Need an entry, because extdiff code expects it if not self.test_opt('rev'): self.opts['rev'] = '' if self.test_opt('message'): buffer = gtk.TextBuffer() buffer.set_text(self.opts['message']) self.text.set_buffer(buffer) if self.test_opt('logfile'): buffer = gtk.TextBuffer() buffer.set_text('Comment will be read from file ' + self.opts['logfile']) self.text.set_buffer(buffer) self.text.set_sensitive(False)
def get_tbbuttons(self): tbbuttons = GStatus.get_tbbuttons(self) tbbuttons.insert(2, gtk.SeparatorToolItem()) self._undo_button = self.make_toolbutton(gtk.STOCK_UNDO, '_Undo', self._undo_clicked, tip='undo recent commit') tbbuttons.insert(2, self._undo_button) tbbuttons.insert(2, self.make_toolbutton(gtk.STOCK_OK, '_Commit', self._commit_clicked, tip='commit')) return tbbuttons
def get_menu_info(self): """Returns menu info in this order: merge, addrem, unknown, clean, ignored, deleted """ merge, addrem, unknown, clean, ignored, deleted = GStatus.get_menu_info(self) return (merge + (('_commit', self._commit_file),), addrem + (('_commit', self._commit_file),), unknown + (('_commit', self._commit_file),), clean, ignored, deleted + (('_commit', self._commit_file),))
def get_body(self): status_body = GStatus.get_body(self) vbox = gtk.VBox() mbox = gtk.HBox() label = gtk.Label('Recent Commit Messages: ') mbox.pack_start(label, False, False, 2) self.msg_cbbox = gtk.combo_box_new_text() liststore = gtk.ListStore(str, str) self.msg_cbbox = gtk.ComboBox(liststore) cell = gtk.CellRendererText() self.msg_cbbox.pack_start(cell, True) self.msg_cbbox.add_attribute(cell, 'text', 0) #cell = gtk.CellRendererText() #self.msg_cbbox.pack_start(cell, True) #self.msg_cbbox.add_attribute(cell, 'text', 1) mbox.pack_start(self.msg_cbbox) vbox.pack_start(mbox, False, False) self._mru_messages = self.settings.mrul('recent_messages') self._update_recent_messages() self.msg_cbbox.connect('changed', self.changed_cb) frame = gtk.Frame() frame.set_shadow_type(gtk.SHADOW_ETCHED_IN) scroller = gtk.ScrolledWindow() scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) frame.add(scroller) vbox.pack_start(frame) self.text = gtk.TextView() self.text.set_wrap_mode(gtk.WRAP_WORD) self.text.modify_font(pango.FontDescription(self.fontcomment)) scroller.add(self.text) self._vpaned = gtk.VPaned() self._vpaned.add1(vbox) self._vpaned.add2(status_body) self._vpaned.set_position(self._setting_vpos) return self._vpaned
def load_settings(self, settings): GStatus.load_settings(self, settings) if settings: self._setting_vpos = settings['gcommit'] else: self._setting_vpos = -1
def save_settings(self): settings = GStatus.save_settings(self) settings['gcommit'] = self._vpaned.get_position() return settings
def init(self): GStatus.init(self) self._last_commit_id = None
def reload_status(self): success = GStatus.reload_status(self) self._check_merge() self._check_undo() return success