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.
# hgtk.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) 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.'''importosimportpdbimportsysimporttracebackimportgtkimportgobjectimportmercurial.uias_uifrommercurialimporthg,util,fancyopts,cmdutil,extensionsfromthgutil.i18nimportagettextas_fromthgutilimporthglib,paths,shlibfromthgutilimportversionasthgversionnonrepo_commands='''userconfig clone debugcomplete init about helpversion thgstatus'''# Add TortoiseHg signals, hooked to key accelerators in gtklibforsigin('copy-clipboard','thg-diff','thg-parent'):gobject.signal_new(sig,gtk.TreeView,gobject.SIGNAL_ACTION,gobject.TYPE_NONE,())forsigin('thg-exit','thg-close','thg-refresh','thg-accept'):gobject.signal_new(sig,gtk.Window,gobject.SIGNAL_ACTION,gobject.TYPE_NONE,())gtkmainalive=Falsedefdispatch(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:passexcept:fromhggtk.bugreportimportrunif'--debugger'inargs:pdb.post_mortem(sys.exc_info()[2])error=traceback.format_exc()opts={}opts['cmd']=' '.join(sys.argv[1:])opts['error']=errorifgtkmainalive:dlg=run(u,**opts)dlg.display()dlg.show_all()else:gtkrun(run(u,**opts))defportable_fork():if'THG_HGTK_SPAWN'inos.environor'--nofork'insys.argv:returnif'--repository'insys.argvor'-R'insys.argv:return# Spawn background process and exitifhasattr(sys,"frozen"):args=sys.argvelse:args=[sys.executable]+sys.argvifos.name=='nt':args=['"%s"'%argforarginargs]env=os.environ.copy()env['THG_HGTK_SPAWN']='1'os.spawnve(os.P_NOWAIT,sys.executable,args,env)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()ifcwd==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:raisehglib.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:raisehglib.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:checkhgversion(hglib.hgversion)exceptutil.Abort,inst:ui.status(_("abort: %s!\n")%inst)return0try:returnruncommand(ui,args)finally:ui.flush()excepthglib.ParseError,inst:ifinst.args[0]:ui.status(_("hgtk %s: %s\n")%(inst.args[0],inst.args[1]))help_(ui,inst.args[0])else:ui.status(_("hgtk: %s\n")%inst.args[1])help_(ui,'shortlist')excepthglib.AmbiguousCommand,inst:ui.status(_("hgtk: command '%s' is ambiguous:\n%s\n")%(inst.args[0]," ".join(inst.args[1])))excepthglib.UnknownCommand,inst:ui.status(_("hgtk: unknown command '%s'\n")%inst.args[0])help_(ui,'shortlist')excepthglib.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')ifoptions['repository']:path=ui.expandpath(options['repository'])cmdoptions['repository']=pathos.chdir(path)path=paths.find_root(os.getcwd())ifpath:try:lui=hasattr(_ui,'copy')and_ui.copy()or_ui.ui(ui)lui.readconfig(os.path.join(path,".hg","hgrc"))exceptIOError:passelse:lui=ui_loaded={}extensions.loadall(ui)forname,moduleinextensions.extensions():ifnamein_loaded:continueextsetup=getattr(module,'extsetup',None)ifextsetup:extsetup()_loaded[name]=1ifcmdnotinnonrepo_commands.split()andnotpath:raisehglib.RepoError(_("There is no Mercurial repository here"" (.hg not found)"))try:returnfunc(ui,*args,**cmdoptions)exceptTypeError,inst:# was this an argument error?tb=traceback.extract_tb(sys.exc_info()[2])iflen(tb)!=1:# noraiseraisehglib.ParseError(cmd,_("invalid arguments"))mainwindow=Nonedefthgexit(win):ifhasattr(mainwindow,'should_live'):ifmainwindow.should_live():returnmainwindow.destroy()defgtkrun(win):globalmainwindow,gtkmainalivemainwindow=winifhasattr(win,'display'):win.display()win.show_all()if'response'ingobject.signal_list_names(win):win.connect('response',gtk.main_quit)win.connect('destroy',gtk.main_quit)gtk.gdk.threads_init()gtk.gdk.threads_enter()gtkmainalive=Truegtk.main()gtkmainalive=Falsegtk.gdk.threads_leave()defabout(ui,*pats,**opts):"""about TortoiseHg"""fromhggtk.aboutimportrungtkrun(run(ui,*pats,**opts))defadd(ui,*pats,**opts):"""add files"""frommercurialimportdispatchas_dispatch_dispatch.dispatch(['add']+list(pats))shlib.shell_notify([os.getcwd()])defthgstatus(ui,*pats,**opts):"""update TortoiseHg status cache"""fromhggtk.thgstatusimportrunrun(ui,*pats,**opts)defclone(ui,*pats,**opts):"""clone tool"""portable_fork()fromhggtk.cloneimportrungtkrun(run(ui,*pats,**opts))defcommit(ui,*pats,**opts):"""commit tool"""ct=ui.config('tortoisehg','extcommit',None)ifct=='qct':frommercurialimportdispatchas_dispatchtry:_dispatch.dispatch([ct],*pats)exceptSystemExit:passreturnportable_fork()# move cwd to repo root if repo is merged, so we can show# all the changed filesrepo=hg.repository(ui,path=paths.find_root())iflen(repo.parents())>1:os.chdir(repo.root)pats=[]fromhggtk.commitimportrungtkrun(run(ui,*pats,**opts))defshelve(ui,*pats,**opts):"""shelve/unshelve tool"""portable_fork()fromhggtk.thgshelveimportrungtkrun(run(ui,*pats,**opts))defuserconfig(ui,*pats,**opts):"""user configuration editor"""# Import thgconfig first, to check for iniparsefromhggtk.thgconfigimportrunportable_fork()opts['repomode']=Falsegtkrun(run(ui,*pats,**opts))defrepoconfig(ui,*pats,**opts):"""repository configuration editor"""portable_fork()fromhggtk.thgconfigimportrunopts['repomode']=Truegtkrun(run(ui,*pats,**opts))defrename(ui,*pats,**opts):"""rename a single file or directory"""portable_fork()fromhggtk.renameimportrunifnotpatsorlen(pats)>2:raiseutil.Abort(_('rename takes one or two path arguments'))gtkrun(run(ui,*pats,**opts))defguess(ui,*pats,**opts):"""guess previous renames or copies"""portable_fork()fromhggtk.guessimportrungtkrun(run(ui,*pats,**opts))defdatamine(ui,*pats,**opts):"""repository search and annotate tool"""portable_fork()fromhggtk.datamineimportrungtkrun(run(ui,*pats,**opts))defhgignore(ui,*pats,**opts):"""ignore filter editor"""portable_fork()fromhggtk.hgignoreimportrungtkrun(run(ui,*pats,**opts))defhginit(ui,*pats,**opts):"""repository initialization tool"""portable_fork()fromhggtk.hginitimportrungtkrun(run(ui,*pats,**opts))deflog(ui,*pats,**opts):"""changelog viewer"""portable_fork()fromhggtk.historyimportrungtkrun(run(ui,*pats,**opts))defmerge(ui,*pats,**opts):"""merge tool"""portable_fork()fromhggtk.mergeimportrungtkrun(run(ui,*pats,**opts))defrecovery(ui,*pats,**opts):"""recover, rollback & verify"""portable_fork()fromhggtk.recoveryimportrungtkrun(run(ui,*pats,**opts))defremove(ui,*pats,**opts):"""file status viewer in remove mode"""portable_fork()fromhggtk.statusimportrungtkrun(run(ui,*pats,**opts))defrevert(ui,*pats,**opts):"""file status viewer in revert mode"""portable_fork()fromhggtk.statusimportrungtkrun(run(ui,*pats,**opts))defserve(ui,*pats,**opts):"""web server"""portable_fork()fromhggtk.serveimportrungtkrun(run(ui,*pats,**opts))defstatus(ui,*pats,**opts):"""file status viewer"""portable_fork()fromhggtk.statusimportrungtkrun(run(ui,*pats,**opts))defsynch(ui,*pats,**opts):"""repository synchronization tool"""portable_fork()fromhggtk.synchimportruncmd=opts['alias']ifcmdin('push','outgoing','email'):opts['pushmode']=Trueelse:opts['pushmode']=Falsegtkrun(run(ui,*pats,**opts))defupdate(ui,*pats,**opts):"""update/checkout tool"""portable_fork()fromhggtk.updateimportrungtkrun(run(ui,*pats,**opts))defvdiff(ui,*pats,**opts):"""launch configured visual diff tool"""portable_fork()fromhggtk.visdiffimportrungtkrun(run(ui,*pats,**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')try:aliases,i=cmdutil.findcmd(name,table,False)excepthglib.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.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):frommercurialimporthelpfornames,header,docinhelp.helptable:ifnameinnames:breakelse:raisehglib.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=Nonebreakexcepthglib.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)defcheckhgversion(v):"""range check the Mercurial version"""# this is a series of hacks, but Mercurial's versioning scheme# doesn't lend itself to a "correct" solution. This will at least# catch people who have old Mercurial packages.reqver=['1','2']ifnotvorv=='unknown'orlen(v)>=12:# can't make any intelligent decisions about unknown or hashesreturnvers=v.split('.')[:2]ifvers==reqverorlen(vers)<2:returnnextver=list(reqver)nextver[1]=chr(ord(reqver[1])+1)ifvers==nextver:returnraiseutil.Abort(_('This version of TortoiseHg requires Mercurial ''version %s.n to %s.n, but finds %s')%('.'.join(reqver),'.'.join(nextver),v))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')),('h','help',None,_('display help and exit')),('','debugger',None,_('start debugger')),('','nofork',None,_('do not fork GUI process')),('l','listfile','',_('read file list from file')),]table={"^about":(about,[],_('hgtk about')),"^add":(add,[],_('hgtk add [FILE]...')),"^clone":(clone,[],_('hgtk clone SOURCE [DEST]')),"^commit|ci":(commit,[('u','user','',_('record user as committer')),('d','date','',_('record datecode as commit date'))],_('hgtk commit [OPTIONS] [FILE]...')),"^datamine|annotate|blame":(datamine,[],_('hgtk datamine')),"^hgignore|ignore|filter":(hgignore,[],_('hgtk hgignore [FILE]')),"^init":(hginit,[],_('hgtk init [DEST]')),"^log|history":(log, [('l', 'limit', '', _('limit number of changes displayed'))],
_('hgtk log [OPTIONS] [FILE]')),
"^merge": (merge,
- [('r', 'rev', '', _('revision to update'))],
+ [('r', 'rev', None, _('revision to merge with'))],
_('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,[('r','rev',[],_('revisions to compare'))],_('hgtk status [FILE]...')),"^userconfig":(userconfig,[],_('hgtk userconfig')),"^repoconfig":(repoconfig,[],_('hgtk repoconfig')),"^guess":(guess,[],_('hgtk guess')),"^remove|rm":(revert,[],_('hgtk remove [FILE]...')),"^rename|mv":(rename,[],_('hgtk rename SOURCE [DEST]')),"^revert":(revert,[],_('hgtk revert [FILE]...')),"^serve":(serve,[('','webdir-conf','',_('name of the webdir config file'))],_('hgtk serve [OPTION]...')),"thgstatus":(thgstatus,[('','delay',None,_('wait until the second ticks over')),('n','notify',[],_('notify the shell for path(s) given')),('','remove',None,_('remove the status cache')),('s','show',None,_('show the contents of the'' status cache (no update)')),('','all',None,_('udpate all repos in current dir'))],_('hgtk thgstatus [OPTION]')),"^update|checkout|co":(update,[('r','rev',None,_('revision to update'))],('hgtk update')),"^vdiff":(vdiff,[('c','change','',_('changeset to view in diff tool')),('r','rev',[],_('revisions to view in diff tool'))],_('launch visual diff tool')),"^version":(version,[('v','verbose',None,_('print license'))],_('hgtk version [OPTION]')),"debugcomplete":(debugcomplete,[('o','options',None,_('show the command options'))],_('[-o] CMD')),"help":(help_,[],_('hgtk help [COMMAND]')),}
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.