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.
# hglib.py - Mercurial API wrappers for TortoiseHg## Copyright 2007 Steve Borho <steve@borho.org>## This software may be used and distributed according to the terms of the# GNU General Public License version 2, incorporated herein by reference.importosimportsysimporttracebackimportshlibimporttimefrommercurial.errorimportRepoError,ParseError,LookupError,RepoLookupErrorfrommercurial.errorimportUnknownCommand,AmbiguousCommandfrommercurialimporthg,ui,util,extensions,commands,hook,matchfrommercurialimportdispatch,encoding,templatefilters,bundlerepo_encoding=encoding.encoding_encodingmode=encoding.encodingmode_fallbackencoding=encoding.fallbackencodingfromtortoisehg.utilimportpathsfromtortoisehg.util.i18nimport_fromtortoisehg.util.hgversionimporthgversiondeftounicode(s):""" Convert the encoding of string from MBCS to Unicode. Based on mercurial.util.tolocal(). Return 'unicode' type string. """ifisinstance(s,unicode):returnsforein('utf-8',_encoding):try:returns.decode(e,'strict')exceptUnicodeDecodeError:passreturns.decode(_fallbackencoding,'replace')deftoutf(s):""" Convert the encoding of string from MBCS to UTF-8. Return 'str' type string. """returntounicode(s).encode('utf-8')deffromutf(s):""" Convert the encoding of string from UTF-8 to MBCS Return 'str' type string. """try:returns.decode('utf-8').encode(_encoding)exceptUnicodeDecodeError:passexceptUnicodeEncodeError:passreturns.decode('utf-8').encode(_fallbackencoding)_tabwidth=Nonedefgettabwidth(ui):global_tabwidthif_tabwidthisnotNone:return_tabwidthtabwidth=ui.config('tortoisehg','tabwidth')try:tabwidth=int(tabwidth)iftabwidth<1ortabwidth>16:tabwidth=0except(ValueError,TypeError):tabwidth=0_tabwidth=tabwidthreturntabwidth_maxdiff=Nonedefgetmaxdiffsize(ui):global_maxdiffif_maxdiffisnotNone:return_maxdiffmaxdiff=ui.config('tortoisehg','maxdiff')try:maxdiff=int(maxdiff)ifmaxdiff<1:maxdiff=sys.maxintexcept(ValueError,TypeError):maxdiff=1024# 1MB by default_maxdiff=maxdiff*1024return_maxdiffdefdiffexpand(line):'Expand tabs in a line of diff/patch text'if_tabwidthisNone:gettabwidth(ui.ui())ifnot_tabwidthorlen(line)<2:returnlinereturnline[0]+line[1:].expandtabs(_tabwidth)defuiwrite(u,args):''' write args if there are buffers returns True if the caller shall handle writing '''ifu._buffers:ui.ui.write(u,*args)returnFalsereturnTruedefinvalidaterepo(repo):repo.dirstate.invalidate()ifisinstance(repo,bundlerepo.bundlerepository):# Work around a bug in hg-1.3. repo.invalidate() breaks# overlay bundlerepos return
repo.invalidate()
if '_bookmarks' in repo.__dict__:
-bm = extensions.find('bookmarks')- bm.reposetup(repo.ui, repo)+repo._bookmarks = {} if 'mq' in repo.__dict__: #do not create if it does not exist
repo.mq.invalidate()
defcanonpaths(list):'Get canonical paths (relative to root) for list of files'# This is a horrible hack. Please remove this when HG acquires a# decent case-folding solution.canonpats=[]cwd=os.getcwd()root=paths.find_root(cwd)forfinlist:try:canonpats.append(util.canonpath(root,cwd,f))exceptutil.Abort:# Attempt to resolve case folding conflicts.fu=f.upper()cwdu=cwd.upper()iffu.startswith(cwdu):canonpats.append(util.canonpath(root,cwd,f[len(cwd+os.sep):]))else:# May already be canonicalcanonpats.append(f)returncanonpatsdefnormpats(pats):'Normalize file patterns'normpats=[]forpatinpats:kind,p=match._patsplit(pat,None)ifkind:normpats.append(pat)else:if'['inpor'{'inpor'*'inpor'?'inp:normpats.append('glob:'+p)else:normpats.append('path:'+p)returnnormpatsdefmergetools(ui,values=None):'returns the configured merge tools and the internal ones'ifvalues==None:values=[]frommercurialimportfilemergeforkey,valueinui.configitems('merge-tools'):t=key.split('.')[0]iftnotinvalues:# Ensure the tool is installediffilemerge._findtool(ui,t):values.append(t)values.append('internal:merge')values.append('internal:prompt')values.append('internal:dump')values.append('internal:local')values.append('internal:other')values.append('internal:fail')returnvaluesdefhgcmd_toq(q,*args):''' Run an hg command in a background thread, pipe all output to a Queue object. Assumes command is completely noninteractive. '''classQui(ui.ui):def__init__(self,src=None):super(Qui,self).__init__(src)self.setconfig('ui','interactive','off')defwrite(self,*args):ifuiwrite(self,args):forainargs:q.put(str(a))u=Qui()fork,vinu.configitems('defaults'):u.setconfig('defaults',k,'')returndispatch._dispatch(u,list(args))defget_reponame(repo):ifrepo.ui.config('tortoisehg','fullpath',False):name=repo.rootelifrepo.ui.config('web','name',False):name=repo.ui.config('web','name')else:name=os.path.basename(repo.root)returntoutf(name)defdisplaytime(date):returnutil.datestr(date,'%Y-%m-%d %H:%M:%S %1%2')defutctime(date):returntime.strftime("%Y-%m-%d %H:%M:%S",time.gmtime(date[0]))defusername(user):author=templatefilters.person(user)ifnotauthor:author=util.shortuser(user)returnauthor
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.