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.
#!/usr/bin/env python## front-end script for TortoiseHg dialogs## Copyright (C) 2008-9 Steve Borho <steve@borho.org># Copyright (C) 2008 TK Soh <teekaysoh@gmail.com>shortlicense='''\Copyright (C) 2009 Steve Borho <steve@borho.org>.This is free software; see the source for copying conditions. There is NOwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.'''# The recommended usage is to symlink this file into your path.# alternatively, you can change this line or set TORTOISEHG_PATHtortoisehg_dir='~/tools/tortoisehg-dev'importpygtkpygtk.require('2.0')importgtkfrommercurialimportdemandimport;demandimport.enable()frommercurial.i18nimport_frommercurialimporthg,util,fancyopts,commands,cmdutilimportmercurial.uias_uitry:frommercurial.errorimportRepoError,UnknownCommand,AmbiguousCommandfrommercurial.errorimportParseErrorexceptImportError:frommercurial.repoimportRepoErrorfrommercurial.cmdutilimportUnknownCommand,AmbiguousCommandfrommercurial.dispatchimportParseErrorimportosimportsysimporttracebacknonrepo_commands='userconfig clone init about help version'defdispatch(args):"run the command specified in args"try:u=_ui.ui(traceback='--traceback'inargs)exceptutil.Abort,inst:sys.stderr.write(_("abort: %s\n")%inst)return-1if'--debugger'inargs:pdb.set_trace()try:return_runcatch(u,args) except:
if '--debugger' in args:
pdb.post_mortem(sys.exc_info()[2])
-ui.print_exc()
+u.print_exc()
raise
def get_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(listfile)returnlinesexceptIOError,e:sys.stderr.write(_('can not read file "%s". Ignored.\n')%filename)return[]def_parse(ui,args):options={}cmdoptions={}try:args=fancyopts.fancyopts(args,globalopts,options)exceptfancyopts.getopt.GetoptError,inst:raiseParseError(None,inst)ifargs:cmd,args=args[0],args[1:]aliases,i=cmdutil.findcmd(cmd,table,ui.config("ui","strict"))cmd=aliases[0]c=list(i[1])else:cmd=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:raiseParseError(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)def_runcatch(ui,args):try:try:returnruncommand(ui,args)finally:ui.flush()exceptParseError,inst:ifinst.args[0]:ui.warn(_("hgtk %s: %s\n")%(inst.args[0],inst.args[1]))help_(ui,inst.args[0])else:ui.warn(_("hgtk: %s\n")%inst.args[1])help_(ui,'shortlist')exceptAmbiguousCommand,inst:ui.warn(_("hgtk: command '%s' is ambiguous:\n%s\n")%(inst.args[0]," ".join(inst.args[1])))exceptUnknownCommand,inst:ui.warn(_("hgtk: unknown command '%s'\n")%inst.args[0])help_(ui,'shortlist')exceptRepoError,inst:ui.warn(_("abort: %s!\n")%inst)exceptutil.Abort,inst:ui.warn(_("abort: %s\n")%inst)return-1defruncommand(ui,args):fullargs=argscmd,func,args,options,cmdoptions=_parse(ui,args)ui.updateopts(options["verbose"])ifoptions['help']:returnhelp_(ui,cmd)elifnotcmd:returnhelp_(ui,'shortlist')ifhasattr(sys,"frozen"):# Py2exe environmentthgdir=os.path.dirname(sys.executable)os.environ['THG_ICON_PATH']=os.path.join(thgdir,'icons')else:# Add TortoiseHg to python pathpath=os.environ.get('TORTOISEHG_PATH')ortortoisehg_dirnorm=os.path.normpath(os.path.expanduser(path))ifnormnotinsys.path:sys.path.insert(0,norm)try:# assuming TortoiseHg source layout, with hgtk in contribpath=os.path.dirname(os.path.realpath(__file__))exceptNameError:# __file__ not available in pdb modepath=os.path.dirname(sys.argv[0])norm=os.path.normpath(os.path.join(path,'..'))ifnormnotinsys.path:sys.path.append(norm)try:fromhggtkimporthglibexceptImportError,inst:m=str(inst).split()[-1]ifmin"hglib hggtk".split():# fix "tortoisehg_dir" at the top of this script, or ...raiseutil.Abort(_('Please set TORTOISEHG_PATH to location ''of your tortoisehg repository'))else:raiseutil.Abort(_('could not import module %s!\n'%m))except:raisepath=hglib.rootpath(os.getcwd())ifpath:try:lui=_ui.ui(parentui=ui)lui.readconfig(os.path.join(path,".hg","hgrc"))exceptIOError:passelse:lui=uiifoptions['repository']:path=lui.expandpath(options['repository'])ifcmdnotinnonrepo_commands.split():try:repo=hg.repository(ui,path=path)exceptRepoError,inst:# try to guess the repo from first of file argsroot=Noneifargs:path=hglib.rootpath(args[0])ifpath:repo=hg.repository(ui,path=path)else:raiseRepoError(_("There is no Mercurial repository here"" (.hg not found)"))cmdoptions['root']=os.path.abspath(path)try:returnfunc(ui,*args,**cmdoptions)exceptTypeError,inst:# was this an argument error?tb=traceback.extract_tb(sys.exc_info()[2])iflen(tb)!=1:# noraiseraiseParseError(cmd,_("invalid arguments"))defabout(ui,**opts):"""about TortoiseHg"""fromhggtk.aboutimportrunrun(**opts)defclone(ui,source=None,dest=None,**opts):"""clone tool"""fromhggtk.cloneimportrunopts['files']=[os.path.abspath(x)forxin(source,dest)ifx]run(**opts)defcommit(ui,*pats,**opts):"""commit tool"""fromhggtk.commitimportrunopts['files']=[os.path.abspath(x)forxinpats]run(**opts)defshelve(ui,*pats,**opts):"""shelve/unshelve tool"""fromhggtk.thgshelveimportrunopts['files']=[os.path.abspath(x)forxinpats]run(**opts)defuserconfig(ui,**opts):"""user configuration editor"""fromhggtk.thgconfigimportrunrun(**opts)defrepoconfig(ui,*pats,**opts):"""repository configuration editor"""fromhggtk.thgconfigimportrunopts['files']=opts['root']run(**opts)defrename(ui,*pats,**opts):"""rename a single file or directory"""fromhggtk.renameimportrunifnotpatsorlen(pats)>2:raiseutil.Abort("rename takes one or two path arguments")opts['files']=patsopts['detect']=Falserun(**opts)defguess(ui,*pats,**opts):"""guess previous renames or copies"""fromhggtk.renameimportrunopts['detect']=Truerun(**opts)defdatamine(ui,*pats,**opts):"""repository search and annotate tool"""fromhggtk.datamineimportrunopts['files']=sys.argv[2:]or[]opts['cwd']=os.getcwd()run(**opts)defhginit(ui,dest=None,**opts):"""repository initialization tool"""fromhggtk.hginitimportrunifdest:opts['files']=[dest]run(**opts)deflog(ui,*pats,**opts):"""changelog viewer"""fromhggtk.historyimportrunopts['files']=[os.path.abspath(x)forxinpats]run(**opts)defmerge(ui,node=None,rev=None,**opts):"""merge tool """fromhggtk.mergeimportrunrun(**opts)defrecovery(ui,*pats,**opts):"""recover, rollback & verify"""fromhggtk.recoveryimportrunrun(**opts)defserve(ui,**opts):"""web server"""fromhggtk.serveimportrunrun(**opts)defstatus(ui,*pats,**opts):"""file status viewer Also do add, remove and revert. """fromhggtk.statusimportrunopts['files']=[os.path.abspath(x)forxinpats]run(**opts)defsynch(ui,**opts):"""repository synchronization tool"""fromhggtk.synchimportruncmd=sys.argv[1]if'push'.startswith(cmd)or'outgoing'.startswith(cmd):opts['pushmode']=Trueelse:opts['pushmode']=Falserun(**opts)defupdate(ui,**opts):"""update/checkout tool"""fromhggtk.updateimportrunrun(**opts)### help management, adapted from mercurial.commands.help_()defhelp_(ui,name=None,with_version=False):"""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 "hgtk help" for the full list ''of commands'),()))else:ifname=='shortlist':msg=_('use "hgtk help" for the full list of commands ''or "hgtk -v" for details')elifaliases:msg=_('use "hgtk -v help%s" to show aliases and ''global options')%(nameand" "+nameor"")else:msg=_('use "hgtk -v help %s" to show global options')%nameoption_lists.append((msg,()))defhelpcmd(name):ifwith_version:version(ui)ui.write('\n')aliases,i=cmdutil.findcmd(name,table)# 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.items():f=c.split("|",1)[0]ifselectandnotselect(f):continueifname=="shortlist"andnotf.startswith("^"):continuef=f.lstrip("^")ifnotui.debugflagandf.startswith("debug"):continuedoc=e[0].__doc__ifnotdoc:doc=_("(No help text available)")h[f]=doc.splitlines(0)[0].rstrip()cmds[f]=c.lstrip("^")ifnoth:ui.status(_('no commands defined\n'))returnui.status(header)fns=h.keys()fns.sort()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,h[f]))ifnotui.quiet:addglobalopts(True)defhelptopic(name):v=Noneforiinhelp.helptable:l=i.split('|')ifnameinl:v=iheader=l[-1]ifnotv:raisecmdutil.UnknownCommand(name)# descriptiondoc=help.helptable[v]ifnotdoc:doc=_("(No help text available)")ifcallable(doc):doc=doc()ui.write("%s\n"%header)ui.write("%s\n"%doc.rstrip())defhelpext(name):try:mod=extensions.find(name)exceptKeyError:raisecmdutil.UnknownCommand(name)doc=(mod.__doc__or_('No help text available')).splitlines(0)ui.write(_('%s extension - %s\n')%(name.split('.')[-1],doc[0]))fordindoc[1:]:ui.write(d,'\n')ui.status('\n')try:ct=mod.cmdtableexceptAttributeError:ct={}modcmds=dict.fromkeys([c.split('|',1)[0]forcinct])helplist(_('list of commands:\n\n'),modcmds.has_key)ifnameandname!='shortlist':i=Noneforfin(helpcmd,helptopic,helpext):try:f(name)i=Nonebreakexceptcmdutil.UnknownCommand,inst:i=instifi:raiseielse:# program nameifui.verboseorwith_version:version(ui)else:ui.status(_("Hgtk - 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"""importhggtk.shlibui.write("%s\n"%hggtk.shlib.version())ifui.verbose:ui.write(shortlicense)globalopts=[('R','repository','',_('repository root directory or symbolic path name')),('v','verbose',None,_('enable additional output')),('h','help',None,_('display help and exit')),('l','listfile','',_('read file list from file')),]table={"^about":(about,[],_('hgtk about')),"^clone":(clone,[],_('hgtk clone SOURCE [DEST]')),"^commit|ci":(commit,[],_('hgtk commit [FILE]...')),"^datamine|annotate|blame":(datamine,[],_('hgtk datamine')),"^init":(hginit,[],_('hgtk init [DEST]')),"^log|history":(log,[('l','limit','',_('limit number of changes displayed'))],_('hgtk log [OPTIONS] [FILE]')),"^merge":(merge,[],_('hgtk merge')),"^recovery|rollback|verify":(recovery,[],_('hgtk recovery')),"^shelve|unshelve":(shelve,[],_('hgtk shelve')),"^synch|pull|push|incoming|outgoing|email":(synch,[],_('hgtk synch')),"^status|st":(status,[],_('hgtk status [FILE]...')),"^userconfig":(userconfig,[],_('hgtk userconfig')),"^repoconfig":(repoconfig,[],_('hgtk repoconfig')),"^guess":(guess,[],_('hgtk guess')),"^rename|mv":(rename,[],_('hgtk rename SOURCE [DEST]')),"^serve":(serve,[('','webdir-conf','',_('name of the webdir config file'))],_('hgtk serve [OPTION]...')),"^update|checkout|co":(update,[],_('hgtk update')),"^version":(version,[('v','verbose',None,_('print license'))],_('hgtk version [OPTION]')),"help":(help_,[],_('hgtk help [COMMAND]')),}if__name__=='__main__':sys.exit(dispatch(sys.argv[1:]))
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.