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.
# run.py - front-end script for TortoiseHg dialogs## Copyright 2008 Steve Borho <steve@borho.org># Copyright 2008 TK Soh <teekaysoh@gmail.com>## This software may be used and distributed according to the terms of the# GNU General Public License version 2, incorporated herein by reference.shortlicense='''Copyright (C) 2008-2011 Steve Borho <steve@borho.org> and others.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'''importosimportpdbimportsysimportsubprocessimporttracebackfromPyQt4.QtCoreimport*fromPyQt4.QtGuiimport*importmercurial.uias_uifrommercurialimporthg,util,fancyopts,cmdutil,extensions,errorfromtortoisehg.hgqt.i18nimportagettextas_fromtortoisehg.utilimporthglib,paths,shlib,i18nfromtortoisehg.utilimportversionasthgversionfromtortoisehg.hgqtimportqtlibfromtortoisehg.hgqt.bugreportimportrunasbugruntry:fromtortoisehg.util.configimportnoforkasconfig_noforkexceptImportError:config_nofork=Nonetry:importwin32conopenflags=win32con.CREATE_NO_WINDOWexceptImportError:openflags=0nonrepo_commands='''userconfig shellconfig clone debugcomplete initabout help version thgstatus serve rejects log'''defdispatch(args):"""run the command specified in args"""try:u=_ui.ui()if'--traceback'inargs:u.setconfig('ui','traceback','on')if'--debugger'inargs:pdb.set_trace()return_runcatch(u,args)exceptSystemExit:passexceptKeyboardInterrupt:print_('\nCaught keyboard interrupt, aborting.\n')except:if'--debugger'inargs:pdb.post_mortem(sys.exc_info()[2])error=traceback.format_exc()opts={}opts['cmd']=' '.join(sys.argv[1:])opts['error']=erroropts['nofork']=Truereturnqtrun(bugrun,u,**opts)origwdir=os.getcwd()defportable_fork(ui,opts):if'THG_GUI_SPAWN'inos.environor(notopts.get('fork')andopts.get('nofork')):os.environ['THG_GUI_SPAWN']='1'returnelifui.configbool('tortoisehg','guifork',None)isnotNone:ifnotui.configbool('tortoisehg','guifork'):returnelifconfig_nofork:returnos.environ['THG_GUI_SPAWN']='1'# Spawn background process and exitifhasattr(sys,"frozen"):args=sys.argvelse:args=[sys.executable]+sys.argvcmdline=subprocess.list2cmdline(args)os.chdir(origwdir)subprocess.Popen(cmdline,creationflags=openflags,shell=True)sys.exit(0)# Windows and Nautilus shellext execute# "thg subcmd --listfile TMPFILE" or "thg subcmd --listfileutf8 TMPFILE"(planning) .# Extensions written in .hg/hgrc is enabled after calling# extensions.loadall(lui)## 1. win32mbcs extension# Japanese shift_jis and Chinese big5 include '0x5c'(backslash) in filename.# Mercurial resolves this problem with win32mbcs extension.# So, thg must parse path after loading win32mbcs extension.## 2. fixutf8 extension# fixutf8 extension requires paths encoding utf-8.# So, thg need to convert to utf-8.#_lines=[]_linesutf8=[]defget_lines_from_listfile(filename,isutf8):global_linesglobal_linesutf8try:iffilename=='-':lines=[x.replace("\n","")forxinsys.stdin.readlines()]else:fd=open(filename,"r")lines=[x.replace("\n","")forxinfd.readlines()]fd.close()os.unlink(filename)ifisutf8:_linesutf8=lineselse:_lines=linesexceptIOError,e:sys.stderr.write(_('can not read file "%s". Ignored.\n')%filename)defget_files_from_listfile():global_linesglobal_linesutf8lines=[]need_to_utf8=Falseifos.name=='nt':try:fixutf8=extensions.find("fixutf8")iffixutf8:need_to_utf8=TrueexceptKeyError:passifneed_to_utf8:lines+=_linesutf8forlin_lines:lines.append(hglib.toutf(l))else:lines+=_linesforlin_linesutf8:lines.append(hglib.fromutf(l))# Convert absolute file paths to repo/cwd canonicalcwd=os.getcwd()root=paths.find_root(cwd)ifnotroot:returnlinesifcwd==root:cwd_rel=''else:cwd_rel=cwd[len(root+os.sep):]+os.sepfiles=[]forfinlines:try:cpath=util.canonpath(root,cwd,f)# canonpath will abort on .hg/ pathsexceptutil.Abort:continueifcpath.startswith(cwd_rel):cpath=cpath[len(cwd_rel):]files.append(cpath)else:files.append(f)returnfilesdef_parse(ui,args):options={}cmdoptions={}try:args=fancyopts.fancyopts(args,globalopts,options)exceptfancyopts.getopt.GetoptError,inst:raiseerror.ParseError(None,inst)ifargs:alias,args=args[0],args[1:]elifoptions['help']:help_(ui,None)sys.exit()else:alias,args='workbench',[]aliases,i=cmdutil.findcmd(alias,table,ui.config("ui","strict"))forainaliases:ifa.startswith(alias):alias=abreakcmd=aliases[0]c=list(i[1])# combine global options into localforoinglobalopts:c.append((o[0],o[1],options[o[1]],o[3]))try:args=fancyopts.fancyopts(args,c,cmdoptions)exceptfancyopts.getopt.GetoptError,inst:raiseerror.ParseError(cmd,inst)# separate global options back outforoinglobalopts:n=o[1]options[n]=cmdoptions[n]delcmdoptions[n]listfile=options.get('listfile')iflistfile:deloptions['listfile']get_lines_from_listfile(listfile,False)listfileutf8=options.get('listfileutf8')iflistfileutf8:deloptions['listfileutf8']get_lines_from_listfile(listfileutf8,True)return(cmd,cmdandi[0]orNone,args,options,cmdoptions,alias)def_runcatch(ui,args):try:try:returnruncommand(ui,args)finally:ui.flush()excepterror.ParseError,inst:ifinst.args[0]:ui.status(_("thg %s: %s\n")%(inst.args[0],inst.args[1]))help_(ui,inst.args[0])else:ui.status(_("thg: %s\n")%inst.args[1])help_(ui,'shortlist')excepterror.AmbiguousCommand,inst:ui.status(_("thg: command '%s' is ambiguous:\n%s\n")%(inst.args[0]," ".join(inst.args[1])))excepterror.UnknownCommand,inst:ui.status(_("thg: unknown command '%s'\n")%inst.args[0])help_(ui,'shortlist')excepterror.RepoError,inst:ui.status(_("abort: %s!\n")%inst)return-1defruncommand(ui,args):cmd,func,args,options,cmdoptions,alias=_parse(ui,args)cmdoptions['alias']=aliasui.setconfig("ui","verbose",str(bool(options["verbose"])))i18n.setlanguage(ui.config('tortoisehg','ui.language'))ifoptions['help']:returnhelp_(ui,cmd)path=options['repository']ifpath:ifpath.startswith('bundle:'):s=path[7:].split('+',1)iflen(s)==1:path,bundle=os.getcwd(),s[0]else: path, bundle = s
cmdoptions['bundle'] = os.path.abspath(bundle)
path = ui.expandpath(path)
+ if not os.path.exists(path) or not os.path.isdir(path+'/.hg'):+ print 'abort: %s is not a repository' % path+ return 1 os.chdir(path)
if options['fork']:
cmdoptions['fork'] = True
ifoptions['nofork']oroptions['profile']:cmdoptions['nofork']=Truepath=paths.find_root(os.getcwd())ifpath:cmdoptions['repository']=pathtry:lui=ui.copy()lui.readconfig(os.path.join(path,".hg","hgrc"))exceptIOError:passelse:lui=uihglib.wrapextensionsloader()# enable blacklist of extensionsextensions.loadall(lui)args+=get_files_from_listfile()ifoptions['quiet']:ui.quiet=Trueifcmdnotinnonrepo_commands.split()andnotpath:raiseerror.RepoError(_("There is no Mercurial repository here"" (.hg not found)"))cmdoptions['mainapp']=Trued=lambda:util.checksignature(func)(ui,*args,**cmdoptions)return_runcommand(lui,options,cmd,d)def_runcommand(ui,options,cmd,cmdfunc):defcheckargs():try:returncmdfunc()excepterror.SignatureError:raiseerror.ParseError(cmd,_("invalid arguments"))ifoptions['profile']:format=ui.config('profiling','format',default='text')ifnotformatin['text','kcachegrind']:ui.warn(_("unrecognized profiling format '%s'"" - Ignored\n")%format)format='text'output=ui.config('profiling','output')ifoutput:path=ui.expandpath(output)ostream=open(path,'wb')else:ostream=sys.stderrtry:frommercurialimportlsprofexceptImportError:raiseutil.Abort(_('lsprof not available - install from ''http://codespeak.net/svn/user/arigo/hack/misc/lsprof/'))p=lsprof.Profiler()p.enable(subcalls=True)try:returncheckargs()finally:p.disable()ifformat=='kcachegrind':importlsprofcalltreecalltree=lsprofcalltree.KCacheGrind(p)calltree.output(ostream)else:# format == 'text'stats=lsprof.Stats(p.getstats())stats.sort()stats.pprint(top=10,file=ostream,climit=5)ifoutput:ostream.close()else:returncheckargs()class_QtRunner(QObject):"""Run Qt app and hold its windows NOTE: This object will be instantiated before QApplication, it means there's a limitation on Qt's event handling. See http://doc.qt.nokia.com/4.6/threads-qobject.html#per-thread-event-loop """_exceptionOccured=pyqtSignal(object,object,object)# {exception class: message}# It doesn't check the hierarchy of exception classes for simplicity._recoverableexc={error.RepoLookupError:_('Try refreshing your repository.'),error.ParseError:_('Error string "%(arg0)s" at %(arg1)s<br>Please ''<a href="#edit:%(arg1)s">edit</a> your config'),}def__init__(self):super(_QtRunner,self).__init__()self._mainapp=Noneself._dialogs=[]self.errors=[]sys.excepthook=lambdat,v,o:self.ehook(t,v,o)# can be emitted by another thread; postpones it until next# eventloop of main (GUI) thread.self._exceptionOccured.connect(self.putexception,Qt.QueuedConnection)defehook(self,etype,evalue,tracebackobj):'Will be called by any thread, on any unhandled exception'elist=traceback.format_exception(etype,evalue,tracebackobj)if'THGDEBUG'inos.environ:sys.stderr.write(''.join(elist))self._exceptionOccured.emit(etype,evalue,tracebackobj)# not thread-safe to touch self.errors here@pyqtSlot(object,object,object)defputexception(self,etype,evalue,tracebackobj):'Enque exception info and display it later; run in main thread'ifnotself.errors:QTimer.singleShot(10,self.excepthandler)self.errors.append((etype,evalue,tracebackobj))@pyqtSlot()defexcepthandler(self):'Display exception info; run in main (GUI) thread'try:try:self._showexceptiondialog()except:# make sure to quit mainloop first, so that it never leave# zombie process.self._mainapp.exit(1)self._printexception()finally:self.errors=[]def_showexceptiondialog(self):fromtortoisehg.hgqt.bugreportimportBugReport,ExceptionMsgBoxopts={}opts['cmd']=' '.join(sys.argv[1:])opts['error']=''.join(''.join(traceback.format_exception(*args))forargsinself.errors)etype,evalue=self.errors[0][:2]iflen(self.errors)==1andetypeinself._recoverableexc:opts['values']=evaluedlg=ExceptionMsgBox(hglib.tounicode(str(evalue)),self._recoverableexc[etype],opts,parent=self._mainapp.activeWindow())elifetypeisKeyboardInterrupt:ifqtlib.QuestionMsgBox(_('Keyboard interrupt'),_('Close this application?')):QApplication.quit()else:self.errors=[]returnelse:dlg=BugReport(opts,parent=self._mainapp.activeWindow())dlg.exec_()def_printexception(self):forargsinself.errors:traceback.print_exception(*args)def__call__(self,dlgfunc,ui,*args,**opts):portable_fork(ui,opts)ifself._mainapp:self._opendialog(dlgfunc,ui,*args,**opts)returnQSettings.setDefaultFormat(QSettings.IniFormat)self._mainapp=QApplication(sys.argv)try:# default org is used by QSettingsself._mainapp.setApplicationName('TortoiseHgQt')self._mainapp.setOrganizationName('TortoiseHg')self._mainapp.setOrganizationDomain('tortoisehg.org')self._mainapp.setApplicationVersion(thgversion.version())self._installtranslator()qtlib.setup_font_substitutions()qtlib.fix_application_font()qtlib.configstyles(ui)qtlib.initfontcache(ui)self._mainapp.setWindowIcon(qtlib.geticon('thg-logo'))if'repository'inopts:try:# Ensure we can open the repository before opening any# dialog windows. Since thgrepo instances are cached, this# is not wasted.fromtortoisehg.hgqtimportthgreporepo=thgrepo.repository(ui,opts['repository'])excepterror.RepoError,e:qtlib.WarningMsgBox(_('Repository Error'),hglib.tounicode(str(e)))returndlg=dlgfunc(ui,*args,**opts)ifdlg:dlg.show()dlg.raise_()except:# Exception before starting eventloop needs to be postponed;# otherwise it will be ignored silently.defreraise():raiseQTimer.singleShot(0,reraise)try:returnself._mainapp.exec_()finally:self._mainapp=Nonedef_installtranslator(self):ifnoti18n.language:returnt=QTranslator(self._mainapp)t.load('qt_'+i18n.language,qtlib.gettranslationpath())self._mainapp.installTranslator(t)def_opendialog(self,dlgfunc,ui,*args,**opts):dlg=dlgfunc(ui,*args,**opts)ifnotdlg:returnself._dialogs.append(dlg)# avoid garbage collectionifhasattr(dlg,'finished')andhasattr(dlg.finished,'connect'):dlg.finished.connect(dlg.deleteLater)# NOTE: Somehow `destroyed` signal doesn't emit the original obj.# So we cannot write `dlg.destroyed.connect(self._forgetdialog)`.dlg.destroyed.connect(lambda:self._forgetdialog(dlg))dlg.show()def_forgetdialog(self,dlg):"""forget the dialog to be garbage collectable"""assertdlginself._dialogsself._dialogs.remove(dlg)qtrun=_QtRunner()defadd(ui,*pats,**opts):"""add files"""fromtortoisehg.hgqt.quickopimportrunreturnqtrun(run,ui,*pats,**opts)defbackout(ui,*pats,**opts):"""backout tool"""fromtortoisehg.hgqt.backoutimportrunreturnqtrun(run,ui,*pats,**opts)defthgstatus(ui,*pats,**opts):"""update TortoiseHg status cache"""fromtortoisehg.util.thgstatusimportrunrun(ui,*pats,**opts)defuserconfig(ui,*pats,**opts):"""user configuration editor"""fromtortoisehg.hgqt.settingsimportrunreturnqtrun(run,ui,*pats,**opts)defrepoconfig(ui,*pats,**opts):"""repository configuration editor"""fromtortoisehg.hgqt.settingsimportrunreturnqtrun(run,ui,*pats,**opts)defclone(ui,*pats,**opts):"""clone tool"""fromtortoisehg.hgqt.cloneimportrunreturnqtrun(run,ui,*pats,**opts)defcommit(ui,*pats,**opts):"""commit tool"""fromtortoisehg.hgqt.commitimportrunreturnqtrun(run,ui,*pats,**opts)defemail(ui,*pats,**opts):"""send changesets by email"""fromtortoisehg.hgqt.hgemailimportrunreturnqtrun(run,ui,*pats,**opts)defresolve(ui,*pats,**opts):"""resolve dialog"""fromtortoisehg.hgqt.resolveimportrunreturnqtrun(run,ui,*pats,**opts)defpostreview(ui,*pats,**opts):"""post changesets to reviewboard"""fromtortoisehg.hgqt.postreviewimportrunreturnqtrun(run,ui,*pats,**opts)defmerge(ui,*pats,**opts):"""merge wizard"""fromtortoisehg.hgqt.mergeimportrunreturnqtrun(run,ui,*pats,**opts)defmanifest(ui,*pats,**opts):"""display the current or given revision of the project manifest"""fromtortoisehg.hgqt.manifestdialogimportrunreturnqtrun(run,ui,*pats,**opts)defguess(ui,*pats,**opts):"""guess previous renames or copies"""fromtortoisehg.hgqt.guessimportrunreturnqtrun(run,ui,*pats,**opts)defstatus(ui,*pats,**opts):"""browse working copy status"""fromtortoisehg.hgqt.statusimportrunreturnqtrun(run,ui,*pats,**opts)defshelve(ui,*pats,**opts):"""Move changes between working directory and patches"""fromtortoisehg.hgqt.shelveimportrunreturnqtrun(run,ui,*pats,**opts)defrejects(ui,*pats,**opts):"""Manually resolve rejected patch chunks"""fromtortoisehg.hgqt.rejectsimportrunreturnqtrun(run,ui,*pats,**opts)deftag(ui,*pats,**opts):"""tag tool"""fromtortoisehg.hgqt.tagimportrunreturnqtrun(run,ui,*pats,**opts)defmq(ui,*pats,**opts):"""Mercurial Queue tool"""fromtortoisehg.hgqt.mqimportrunreturnqtrun(run,ui,*pats,**opts)deftest(ui,*pats,**opts):"""test arbitrary widgets"""fromtortoisehg.hgqt.mqimportrunreturnqtrun(run,ui,*pats,**opts)defpurge(ui,*pats,**opts):"""purge unknown and/or ignore files from repository"""fromtortoisehg.hgqt.purgeimportrunreturnqtrun(run,ui,*pats,**opts)defqreorder(ui,*pats,**opts):"""Reorder unapplied MQ patches"""fromtortoisehg.hgqt.qreorderimportrunreturnqtrun(run,ui,*pats,**opts)defqqueue(ui,*pats,**opts):"""manage multiple MQ patch queues"""fromtortoisehg.hgqt.qqueueimportrunreturnqtrun(run,ui,*pats,**opts)defremove(ui,*pats,**opts):"""remove selected files"""fromtortoisehg.hgqt.quickopimportrunreturnqtrun(run,ui,*pats,**opts)defrevert(ui,*pats,**opts):"""revert selected files"""fromtortoisehg.hgqt.quickopimportrunreturnqtrun(run,ui,*pats,**opts)defforget(ui,*pats,**opts):"""forget selected files"""fromtortoisehg.hgqt.quickopimportrunreturnqtrun(run,ui,*pats,**opts)defhgignore(ui,*pats,**opts):"""ignore filter editor"""fromtortoisehg.hgqt.hgignoreimportrunreturnqtrun(run,ui,*pats,**opts)defserve(ui,*pats,**opts):"""start stand-alone webserver"""fromtortoisehg.hgqt.serveimportrunreturnqtrun(run,ui,*pats,**opts)defsync(ui,*pats,**opts):"""Synchronize with other repositories"""fromtortoisehg.hgqt.syncimportrunreturnqtrun(run,ui,*pats,**opts)defshellconfig(ui,*pats,**opts):"""explorer extension configuration editor"""fromtortoisehg.hgqt.shellconfimportrunreturnqtrun(run,ui,*pats,**opts)defupdate(ui,*pats,**opts):"""update/checkout tool"""fromtortoisehg.hgqt.updateimportrunreturnqtrun(run,ui,*pats,**opts)deflog(ui,*pats,**opts):"""workbench application"""fromtortoisehg.hgqt.workbenchimportrunreturnqtrun(run,ui,*pats,**opts)defvdiff(ui,*pats,**opts):"""launch configured visual diff tool"""fromtortoisehg.hgqt.visdiffimportrunreturnqtrun(run,ui,*pats,**opts)defabout(ui,*pats,**opts):"""about dialog"""fromtortoisehg.hgqt.aboutimportrunreturnqtrun(run,ui,*pats,**opts)defgrep(ui,*pats,**opts):"""grep/search dialog"""fromtortoisehg.hgqt.grepimportrunreturnqtrun(run,ui,*pats,**opts)defarchive(ui,*pats,**opts):"""archive dialog"""fromtortoisehg.hgqt.archiveimportrunreturnqtrun(run,ui,*pats,**opts)defbisect(ui,*pats,**opts):"""bisect dialog"""fromtortoisehg.hgqt.bisectimportrunreturnqtrun(run,ui,*pats,**opts)defannotate(ui,*pats,**opts):"""annotate dialog"""fromtortoisehg.hgqt.annotateimportruniflen(pats)!=1:ui.warn(_('annotate requires a single filename\n'))ifpats:pats=pats[0:]else:returnreturnqtrun(run,ui,*pats,**opts)definit(ui,*pats,**opts):"""init dialog"""fromtortoisehg.hgqt.hginitimportrunreturnqtrun(run,ui,*pats,**opts)defrename(ui,*pats,**opts):"""rename dialog"""fromtortoisehg.hgqt.renameimportrunreturnqtrun(run,ui,*pats,**opts)defstrip(ui,*pats,**opts):"""strip dialog"""fromtortoisehg.hgqt.thgstripimportrunreturnqtrun(run,ui,*pats,**opts)defrebase(ui,*pats,**opts):"""rebase dialog"""fromtortoisehg.hgqt.rebaseimportrunreturnqtrun(run,ui,*pats,**opts)defdrag_move(ui,*pats,**opts):"""Move the selected files to the desired directory"""fromtortoisehg.hgqt.dndimportrun_movereturnqtrun(run_move,ui,*pats,**opts)defdrag_copy(ui,*pats,**opts):"""Copy the selected files to the desired directory"""fromtortoisehg.hgqt.dndimportrun_copyreturnqtrun(run_copy,ui,*pats,**opts)defthgimport(ui,*pats,**opts):"""import an ordered set of patches"""fromtortoisehg.hgqt.thgimportimportrunreturnqtrun(run,ui,*pats,**opts)### help management, adapted from mercurial.commands.help_()defhelp_(ui,name=None,with_version=False,**opts):"""show help for a command, extension, or list of commands With no arguments, print a list of commands and short help. Given a command name, print help for that command. Given an extension name, print help for that extension, and the commands it provides."""option_lists=[]textwidth=ui.termwidth()-2defaddglobalopts(aliases):ifui.verbose:option_lists.append((_("global options:"),globalopts))ifname=='shortlist':option_lists.append((_('use "thg help" for the full list ''of commands'),()))else:ifname=='shortlist':msg=_('use "thg help" for the full list of commands ''or "thg -v" for details')elifaliases:msg=_('use "thg -v help%s" to show aliases and ''global options')%(nameand" "+nameor"")else:msg=_('use "thg -v help %s" to show global options')%nameoption_lists.append((msg,()))defhelpcmd(name):ifwith_version:version(ui)ui.write('\n')try:aliases,i=cmdutil.findcmd(name,table,False)excepterror.AmbiguousCommand,inst:select=lambdac:c.lstrip('^').startswith(inst.args[0])helplist(_('list of commands:\n\n'),select)return# synopsisui.write("%s\n"%i[2])# aliasesifnotui.quietandlen(aliases)>1:ui.write(_("\naliases: %s\n")%', '.join(aliases[1:]))# descriptiondoc=i[0].__doc__ifnotdoc:doc=_("(no help text available)")ifui.quiet:doc=doc.splitlines(0)[0]ui.write("\n%s\n"%doc.rstrip())ifnotui.quiet:# optionsifi[1]:option_lists.append((_("options:\n"),i[1]))addglobalopts(False)defhelplist(header,select=None):h={}cmds={}forc,eintable.iteritems():f=c.split("|",1)[0]ifselectandnotselect(f):continueif(notselectandname!='shortlist'ande[0].__module__!=__name__):continueifname=="shortlist"andnotf.startswith("^"):continuef=f.lstrip("^")ifnotui.debugflagandf.startswith("debug"):continuedoc=e[0].__doc__ifdocand'DEPRECATED'indocandnotui.verbose:continue#doc = gettext(doc)ifnotdoc:doc=_("(no help text available)")h[f]=doc.splitlines()[0].rstrip()cmds[f]=c.lstrip("^")ifnoth:ui.status(_('no commands defined\n'))returnui.status(header)fns=sorted(h)m=max(map(len,fns))forfinfns:ifui.verbose:commands=cmds[f].replace("|",", ")ui.write(" %s:\n%s\n"%(commands,h[f]))else:ui.write('%s\n'%(util.wrap(h[f],textwidth,initindent=' %-*s '%(m,f),hangindent=' '*(m+4))))ifnotui.quiet:addglobalopts(True)defhelptopic(name):frommercurialimporthelpfornames,header,docinhelp.helptable:ifnameinnames:breakelse:raiseerror.UnknownCommand(name)# descriptionifnotdoc:doc=_("(no help text available)")ifhasattr(doc,'__call__'):doc=doc()ui.write("%s\n"%header)ui.write("%s\n"%doc.rstrip())ifnameandname!='shortlist':i=Noneforfin(helpcmd,helptopic):try:f(name)i=Nonebreakexcepterror.UnknownCommand,inst:i=instifi:raiseielse:# program nameifui.verboseorwith_version:version(ui)else:ui.status(_("Thg - TortoiseHg's GUI tools for Mercurial SCM (Hg)\n"))ui.status('\n')# list of commandsifname=="shortlist":header=_('basic commands:\n\n')else:header=_('list of commands:\n\n')helplist(header)# list all option listsopt_output=[]fortitle,optionsinoption_lists:opt_output.append(("\n%s"%title,None))forshortopt,longopt,default,descinoptions:if"DEPRECATED"indescandnotui.verbose:continueopt_output.append(("%2s%s"%(shortoptand"-%s"%shortopt,longoptand" --%s"%longopt),"%s%s"%(desc,defaultand_(" (default: %s)")%defaultor"")))ifopt_output:opts_len=max([len(line[0])forlineinopt_outputifline[1]]or[0])forfirst,secondinopt_output:ifsecond:initindent=' %-*s '%(opts_len,first)hangindent=' '*(opts_len+3)ui.write('%s\n'%(util.wrap(second,textwidth,initindent=initindent,hangindent=hangindent)))else:ui.write("%s\n"%first)defversion(ui,**opts):"""output version and copyright information"""ui.write(_('TortoiseHg Dialogs (version %s), ''Mercurial (version %s)\n')%(thgversion.version(),hglib.hgversion))ifnotui.quiet:ui.write(shortlicense)defdebugcomplete(ui,cmd='',**opts):"""output list of possible commands"""ifopts.get('options'):options=[]otables=[globalopts]ifcmd:aliases,entry=cmdutil.findcmd(cmd,table,False)otables.append(entry[1])fortinotables:foroint:ifo[0]:options.append('-%s'%o[0])options.append('--%s'%o[1])ui.write("%s\n"%"\n".join(options))returncmdlist=cmdutil.findpossible(cmd,table)ifui.verbose:cmdlist=[' '.join(c[0])forcincmdlist.values()]ui.write("%s\n"%"\n".join(sorted(cmdlist)))globalopts=[('R','repository','',_('repository root directory or symbolic path name')),('v','verbose',None,_('enable additional output')),('q','quiet',None,_('suppress output')),('h','help',None,_('display help and exit')),('','debugger',None,_('start debugger')),('','profile',None,_('print command execution profile')),('','nofork',None,_('do not fork GUI process')),('','fork',None,_('always fork GUI process')),('','listfile','',_('read file list from file')),('','listfileutf8','',_('read file list from file encoding utf-8')),]table={"about":(about,[],_('thg about')),"add":(add,[],_('thg add [FILE]...')),"^annotate|blame":(annotate,[('r','rev','',_('revision to annotate')),('n','line','',_('open to line')),('p','pattern','',_('initial search pattern'))],_('thg annotate')),"archive":(archive,[('r','rev','',_('revision to archive'))],_('thg archive')),"^backout":(backout,[('','merge',None,_('merge with old dirstate parent after backout')),('','parent','',_('parent to choose when backing out merge')),('r','rev','',_('revision to backout'))],_('thg backout [OPTION]... [[-r] REV]')),"^bisect":(bisect,[],_('thg bisect')),"^clone":(clone,[('U','noupdate',None,_('the clone will include an empty working copy ''(only a repository)')),('u','updaterev','',_('revision, tag or branch to check out')),('r','rev',[],_('include the specified changeset')),('b','branch',[],_('clone only the specified branch')),('','pull',None,_('use pull protocol to copy metadata')),('','uncompressed',None,_('use uncompressed transfer (fast over LAN)')),],_('thg clone [OPTION]... SOURCE [DEST]')),"^commit|ci":(commit,[('u','user','',_('record user as committer')),('d','date','',_('record datecode as commit date'))],_('thg commit [OPTIONS] [FILE]...')),"drag_move":(drag_move,[],_('thg drag_move SOURCE... DEST')),"drag_copy":(drag_copy,[],_('thg drag_copy SOURCE... DEST')),"^grep|search":(grep,[('i','ignorecase',False,_('ignore case during search')),],_('thg grep')),"^guess":(guess,[],_('thg guess')),"^hgignore|ignore|filter":(hgignore,[],_('thg hgignore [FILE]')),"import":(thgimport,[('','mq',False,_('import to the patch queue (MQ)'))],_('thg import [OPTION] [SOURCE]...')),"^init":(init,[],_('thg init [DEST]')),"^email":(email,[('r','rev',[],_('a revision to send')),],_('thg email [REVS]')),"^log|history|explorer|workbench":(log,[('l','limit','',_('limit number of changes displayed'))],_('thg log [OPTIONS] [FILE]')),"manifest":(manifest,[('r','rev','',_('revision to display')),('n','line','',_('open to line')),('p','pattern','',_('initial search pattern'))],_('thg manifest [-r REV] [FILE]')),"^merge":(merge,[('r','rev','',_('revision to merge'))],_('thg merge [[-r] REV]')),"remove|rm":(remove,[],_('thg remove [FILE]...')),"mq":(mq,[],_('thg mq')),"resolve":(resolve,[],_('thg resolve')),"revert":(revert,[],_('thg revert [FILE]...')),"forget":(forget,[],_('thg forget [FILE]...')),"rename|mv|copy":(rename,[],_('thg rename SOURCE [DEST]...')),"^serve":(serve,[('','web-conf','',_('name of the hgweb config file (serve more than one repository)')),('','webdir-conf','',_('name of the hgweb config file (DEPRECATED)'))],_('thg serve [--web-conf FILE]')),"^sync|synchronize":(sync,[],_('thg sync')),"^status":(status,[('c','clean',False,_('show files without changes')),('i','ignored',False,_('show ignored files'))],_('thg status [OPTIONS] [FILE]')),"^strip":(strip,[('f','force',None,_('discard uncommitted changes (no backup)')),('n','nobackup',None,_('do not back up stripped revisions')),('r','rev','',_('revision to strip')),],_('thg strip [-f] [-n] [[-r] REV]')),"^rebase":(rebase,[('','keep',False,_('keep original changesets')),('','keepbranches',False,_('keep original branch names')),('','detach',False,_('force detaching of source from its original ''branch')),('s','source','',_('rebase from the specified changeset')),('d','dest','',_('rebase onto the specified changeset'))],_('thg rebase -s REV -d REV [--keep] [--detach]')),"^tag":(tag,[('f','force',None,_('replace existing tag')),('l','local',None,_('make the tag local')),('r','rev','',_('revision to tag')),('','remove',None,_('remove a tag')),('m','message','',_('use <text> as commit message')),],_('thg tag [-f] [-l] [-m TEXT] [-r REV] [NAME]')),"shelve|unshelve":(shelve,[],_('thg shelve')),"rejects":(rejects,[],_('thg rejects [FILE]')),"test":(test,[],_('thg test')),"help":(help_,[],_('thg help [COMMAND]')),"^purge":(purge,[],_('thg purge')),"^qreorder":(qreorder,[],_('thg qreorder')),"^qqueue":(qqueue,[],_('thg qqueue')),"^update|checkout|co":(update,[('C','clean',None,_('discard uncommitted changes (no backup)')),('r','rev','',_('revision to update')),],_('thg update [-C] [[-r] REV]')),"^userconfig":(userconfig,[('','focus','',_('field to give initial focus'))],_('thg userconfig')),"^repoconfig":(repoconfig,[('','focus','',_('field to give initial focus'))],_('thg repoconfig')),"^vdiff":(vdiff,[('c','change','',_('changeset to view in diff tool')),('r','rev',[],_('revisions to view in diff tool')),('b','bundle','',_('bundle file to preview'))],_('launch visual diff tool')),"^version":(version,[('v','verbose',None,_('print license'))],_('thg version [OPTION]')),}ifos.name=='nt':# TODO: extra detection to determine if shell extension is installedtable['shellconfig']=(shellconfig,[],_('thg shellconfig'))
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.