Mercurial and Git clients can push and pull from this alias URL to interact with this repository. You can change to which repository an alias points by going to the Aliases link on the project page.
## commit.py - commit dialog for TortoiseHg## Copyright 2007 Brad Schick, brad at gmail . com# Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>#importosimportthreadingimportStringIOimportsysimportshutilimporttempfileimportdatetimeimportcPickleimportpygtkpygtk.require('2.0')importgtkimportgobjectimportpangofrommercurial.i18nimport_frommercurial.nodeimport*frommercurialimportcmdutil,util,ui,hg,commands,patchfromhgextimportextdifffromshlibimportshell_notifyfromgdialogimport*fromgtoolsimportcmdtablefromstatusimportGStatusfromhgcmdimportCmdDialogclassGCommit(GStatus):"""GTK+ based dialog for displaying repository status and committing changes. Also provides related operations like add, delete, remove, revert, refresh, ignore, diff, and edit. """### Overrides of base class methods ###defparse_opts(self):GStatus.parse_opts(self)# Need an entry, because extdiff code expects itifnotself.test_opt('rev'):self.opts['rev']=''ifself.test_opt('message'):buffer=gtk.TextBuffer()buffer.set_text(self.opts['message'])self.text.set_buffer(buffer)ifself.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)defget_title(self):returnos.path.basename(self.repo.root)+' commit '+' '.join(self.pats)+' '+self.opts['user']+' '+self.opts['date']defget_icon(self):return'menucommit.ico'defauto_check(self):ifself.test_opt('check'):forentryinself.model:ifentry[1]in'MAR':entry[0]=Truedefsave_settings(self):settings=GStatus.save_settings(self)settings['gcommit']=self._vpaned.get_position()returnsettingsdefload_settings(self,settings):GStatus.load_settings(self,settings)ifsettings:self._setting_vpos=settings['gcommit']else:self._setting_vpos=-1defget_tbbuttons(self):tbbuttons=GStatus.get_tbbuttons(self)tbbuttons.insert(2,self.make_toolbutton(gtk.STOCK_OK,'_Commit',self._commit_clicked,tip='commit'))returntbbuttonsdefget_body(self):status_body=GStatus.get_body(self)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)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(frame)self._vpaned.add2(status_body)self._vpaned.set_position(self._setting_vpos)returnself._vpaneddefget_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),))defshould_live(self,widget=None,event=None):# If there are more than a few character typed into the commit# message, ask if the exit should continue.live=Falseifself.text.get_buffer().get_char_count()>10:dialog=Confirm('Exit',[],self,'Discard commit message and exit?')ifdialog.run()==gtk.RESPONSE_NO:live=Truereturnlive### End of overridable methods ###def_commit_clicked(self,toolbutton,data=None):ifnotself._ready_message():returnTruecommitable='MAR'addremove_list=self._relevant_files('?!')iflen(addremove_list)andself._should_addremove(addremove_list):commitable+='?!'commit_list=self._relevant_files(commitable)iflen(commit_list)>0:self._hg_commit(commit_list)else:Prompt('Nothing Commited','No committable files selected',self).run()returnTruedef_commit_file(self,stat,file):ifself._ready_message():ifstatnotin'?!'orself._should_addremove([file]):self._hg_commit([file])returnTruedef_should_addremove(self,files):ifself.test_opt('addremove'):returnTrueelse:response=Confirm('Add/Remove',files,self).run()ifresponse==gtk.RESPONSE_YES:# This will stay set for further commits (meaning no more prompts). Problem?self.opts['addremove']=TruereturnTruereturnFalsedef_ready_message(self):begin,end=self.text.get_buffer().get_bounds()message=self.text.get_buffer().get_text(begin,end)ifnotself.test_opt('logfile')andnotmessage:Prompt('Nothing Commited','Please enter commit message',self).run()self.text.grab_focus()returnFalseelse:ifnotself.test_opt('logfile'):self.opts['message']=messagereturnTruedef_hg_commit(self,files):ifnotself.repo.ui.config('ui','username'):Prompt('Username not configured','Please enter a username',self).run()fromthgconfigimportConfigDialogdlg=ConfigDialog(self.repo.root,False)dlg.show_all() dlg.focus_field('ui.username')
dlg.run()
dlg.hide()
+ self.repo = hg.repository(ui.ui(), self.repo.root)+ self.ui = self.repo.ui # call the threaded CmdDialog to do the commit, so the the large commit
# won't get locked up by potential large commit. CmdDialog will also
# display the progress of the commit operation.cmdline=["hg","commit","--verbose","--repository",self.repo.root]cmdline+=['--message',self.opts['message']]cmdline+=filesdialog=CmdDialog(cmdline,True)dialog.set_transient_for(self)dialog.run()dialog.hide()# refresh overlay icons and commit dialogself.text.set_buffer(gtk.TextBuffer())shell_notify([self.cwd]+files)self.reload_status()deflaunch(root='',files=[],cwd='',main=True):u=ui.ui()u.updateopts(debug=False,traceback=False)repo=hg.repository(u,path=root)ct=repo.ui.config('tortoisehg','commit','internal')ifct!='internal':fromhglibimportthgdispatchargs=['--repository',root,ct]try:ret=thgdispatch(repo.ui,args=args)exceptSystemExit:passreturnNonecmdoptions={'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()returndialogdefrun(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 wideifnotfilesandcwd:files=[cwd]iflaunch(root,files,cwd,True):gtk.gdk.threads_init()gtk.gdk.threads_enter()gtk.main()gtk.gdk.threads_leave()if__name__=="__main__":importsysopts={}opts['root']=len(sys.argv)>1andsys.argv[1]or''run(**opts)
Attach a Trello Card
Add a tag
Your session has expired
You are no longer logged in. Please log in and try your request again.
Filter RSS Feed
This RSS feed URL allows you to see the contents of your current filter using any feed reader.
This link includes a special authentication token. If you share the URL with anyone else, they can see this RSS feed's activity. You can disable these tokens when needed.
Your current filter is unsaved; changing it won't affect this RSS feed.