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-2010 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.'''importosimportpdbimportsysimportsubprocessimporttracebackfromPyQt4importQtCore,QtGuiimportmercurial.uias_uifrommercurialimporthg,util,fancyopts,cmdutil,extensions,errorfromtortoisehg.util.i18nimportagettextas_fromtortoisehg.utilimporthglib,paths,shlibfromtortoisehg.utilimportversionasthgversionfromtortoisehg.hgqtimportqtlibtry:fromtortoisehg.util.configimportnoforkasconfig_noforkexceptImportError:config_nofork=Nonetry:importwin32conopenflags=win32con.CREATE_NO_WINDOWexceptImportError:openflags=0nonrepo_commands='''userconfig shellconfig clone debugcomplete initabout help version thgstatus serve 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:fromtortoisehg.hgqt.bugreportimportrunif'--debugger'inargs:pdb.post_mortem(sys.exc_info()[2])error=traceback.format_exc()opts={}opts['cmd']=' '.join(sys.argv[1:])opts['error']=erroropts['nofork']=Trueqtrun(run,u,**opts)origwdir=os.getcwd()defportable_fork(ui,opts):if'THG_GUI_SPAWN'inos.environor(notopts.get('fork')andopts.get('nofork')):returnelifui.configbool('tortoisehg','hgtkfork',None)isnotNone:ifnotui.configbool('tortoisehg','hgtkfork'):returnelifconfig_nofork:return# Spawn background process and exitifhasattr(sys,"frozen"):args=sys.argvelse:args=[sys.executable]+sys.argvos.environ['THG_GUI_SPAWN']='1'cmdline=subprocess.list2cmdline(args)os.chdir(origwdir)subprocess.Popen(cmdline,creationflags=openflags,shell=True)sys.exit(0)defget_list_from_file(filename):try:iffilename=='-':lines=[x.replace("\n","")forxinsys.stdin.readlines()]else:fd=open(filename,"r")lines=[x.replace("\n","")forxinfd.readlines()]fd.close()os.unlink(filename)exceptIOError,e:sys.stderr.write(_('can not read file "%s". Ignored.\n')%filename)return[]# 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:]aliases,i=cmdutil.findcmd(alias,table,ui.config("ui","strict"))forainaliases:ifa.startswith(alias):alias=abreakcmd=aliases[0]c=list(i[1])else:alias=Nonecmd=Nonec=[]# 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']args+=get_list_from_file(listfile)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):fullargs=argscmd,func,args,options,cmdoptions,alias=_parse(ui,args)cmdoptions['alias']=aliasui.setconfig("ui","verbose",str(bool(options["verbose"])))ifoptions['help']:returnhelp_(ui,cmd)elifnotcmd:returnhelp_(ui,'shortlist')path=options['repository']ifpath:ifpath.startswith('bundle:'):s=path[7:].split('+',1)iflen(s)==1:path,bundle=os.getcwd(),s[0]else:path,bundle=scmdoptions['bundle']=os.path.abspath(bundle)path=ui.expandpath(path)cmdoptions['repository']=pathos.chdir(path)ifoptions['fork']:cmdoptions['fork']=Trueifoptions['nofork']oroptions['profile']:cmdoptions['nofork']=Truepath=paths.find_root(os.getcwd())ifpath:try:lui=ui.copy()lui.readconfig(os.path.join(path,".hg","hgrc"))exceptIOError:passelse:lui=uiextensions.loadall(ui)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()mainapp=Nonedefqtrun(dlgfunc,ui,*args,**opts):portable_fork(ui,opts)globalmainappifmainapp:dlg=dlgfunc(ui,*args,**opts)ifdlg:dlg.show()returnQtCore.QSettings.setDefaultFormat(QtCore.QSettings.IniFormat)mainapp=QtGui.QApplication(sys.argv)# default org is used by QSettingsmainapp.setApplicationName('TortoiseHgQt')mainapp.setOrganizationName('TortoiseHg')mainapp.setOrganizationDomain('tortoisehg.org')mainapp.setApplicationVersion(thgversion.version())qtlib.setup_font_substitutions()try:dlg=dlgfunc(ui,*args,**opts)ifdlg:dlg.show()mainapp.exec_()exceptException,e:fromtortoisehg.hgqt.bugreportimportrunerror=_('Fatal error opening dialog\n')error+=traceback.format_exc()opts={}opts['cmd']=' '.join(sys.argv[1:])opts['error']=erroropts['nofork']=Truebugreport=run(ui,**opts)bugreport.show()mainapp.exec_()mainapp=Nonedefadd(ui,*pats,**opts):"""add files"""fromtortoisehg.hgqt.quickopimportrunqtrun(run,ui,*pats,**opts)defthgstatus(ui,*pats,**opts):"""update TortoiseHg status cache"""fromtortoisehg.util.thgstatusimportrunrun(ui,*pats,**opts)defclone(ui,*pats,**opts):"""clone tool"""fromtortoisehg.hgqt.cloneimportrunqtrun(run,ui,*pats,**opts)defemail(ui,*pats,**opts):"""send changesets by email"""fromtortoisehg.hgqt.hgemailimportrunqtrun(run,ui,*pats,**opts)defstatus(ui,*pats,**opts):"""browse working copy status"""fromtortoisehg.hgqt.statusimportrunqtrun(run,ui,*pats,**opts)deftest(ui,*pats,**opts):"""test arbitrary widgets"""fromtortoisehg.hgqt.chunkselectimportrunqtrun(run,ui,*pats,**opts)defbug(ui,*pats,**opts):"""bug report dialog"""fromtortoisehg.hgqt.bugreportimportruniflen(pats)==1:opts['error']=pats[0]opts['cmd']=sys.argv[1:]opts['nofork']=Trueqtrun(run,ui,*pats,**opts)defremove(ui,*pats,**opts):"""remove selected files"""fromtortoisehg.hgqt.quickopimportrunqtrun(run,ui,*pats,**opts)defrevert(ui,*pats,**opts):"""revert selected files"""fromtortoisehg.hgqt.quickopimportrunqtrun(run,ui,*pats,**opts)defforget(ui,*pats,**opts):"""forget selected files"""fromtortoisehg.hgqt.quickopimportrunqtrun(run,ui,*pats,**opts)defshellconfig(ui,*pats,**opts):"""Explorer extension configuration editor"""fromtortoisehg.hgqt.shellconfimportrunqtrun(run,ui,*pats,**opts)defupdate(ui,*pats,**opts):"""update/checkout tool"""fromtortoisehg.hgqt.updateimportrunqtrun(run,ui,*pats,**opts)deflog(ui,*pats,**opts):"""Repository Explorer (changelog viewer)"""fromtortoisehg.hgqt.workbenchimportrunqtrun(run,ui,*pats,**opts)defvdiff(ui,*pats,**opts):"""launch configured visual diff tool"""fromtortoisehg.hgqt.visdiffimportrunqtrun(run,ui,*pats,**opts)defabout(ui,*pats,**opts):"""about dialog"""fromtortoisehg.hgqt.aboutimportrunqtrun(run,ui,*pats,**opts)defgrep(ui,*pats,**opts):"""grep/search dialog"""fromtortoisehg.hgqt.grepimportrunqtrun(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=[]defaddglobalopts(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%s\n'%(m,f,util.wrap(h[f],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:ui.write(" %-*s%s\n"%(opts_len,first,second))else:ui.write("%s\n"%first)defversion(ui,**opts):"""output version and copyright information"""ui.write(_('TortoiseHg Dialogs (version %s), ''Mercurial (version %s)\n')%(hglib.fromutf(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')),]table={"about":(about,[],_('thg about')),"add":(add,[],_('thg add [FILE]...')),"^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]')),"bug":(bug,[],_('thg bug [MESSAGE]')),"^grep|search":(grep,[],_('thg grep')),"^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]')), "remove|rm": (revert, [], _('thg remove [FILE]...')),
"revert": (revert, [], _('thg revert [FILE]...')),
"forget": (forget, [], _('thg forget [FILE]...')),
- "status": (status,
+ "^status": (status,
[('c', 'clean', False, _('show files without changes')),
('u', 'unknown', False, _('show unknown (not tracked) files')),
('i', 'ignored', False, _('show ignored files'))],
_('thg status [OPTIONS] [FILE]')),"test":(test,[],_('thg test')),"help":(help_,[],_('thg help [COMMAND]')),"^update|checkout|co":(update,[('C','clean',None,_('discard uncommitted changes (no backup)')),('r','rev','',_('revision to update')),],_('thg update [-C] [[-r] REV]')),"^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')),}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.