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.
importosfrommercurialimporthg,cmdutil,util,ui,node,mergeimportthgutilimportsystry:frommercurial.errorimportRepoErrorexceptImportError: from mercurial.repo import RepoError
debugging = False
+enabled = True+localonly = False+includepaths = []+excludepaths = []try:
+ from _winreg import HKEY_CURRENT_USER, OpenKey, QueryValueEx from win32api import GetTickCount
CACHE_TIMEOUT = 5000
- import _winreg try:
- hkey = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
- r"Software\TortoiseHg", 0,- _winreg.KEY_ALL_ACCESS)- val = _winreg.QueryValueEx(hkey, 'OverlayDebug')[0]
- if val in ('1', 'True'):
-debugging = True+ hkey = OpenKey(HKEY_CURRENT_USER, r"Software\TortoiseHg")+ enabled = QueryValueEx(hkey, 'EnableOverlays')[0] in ('1', 'True')+ localonly = QueryValueEx(hkey, 'LocalDisksOnly')[0] in ('1', 'True')+ incs = QueryValueEx(hkey, 'IncludePath')[0]+ excs = QueryValueEx(hkey, 'ExcludePath')[0]+ debugging = QueryValueEx(hkey, 'OverlayDebug')[0] in ('1', 'True')
+ for p in incs.split(';'):
+includepaths.append(p.strip())+ for p in excs.split(';'):+ excludepaths.append(p.strip()) except EnvironmentError:
pass
except ImportError:
fromtimeimporttimeasGetTickCountCACHE_TIMEOUT=5.0ifdebugging:importwin32traceutil def debugf(str, args=None):
if args: print str % args
else: print str
+ print 'Enabled', enabled+ print 'LocalDisksOnly', localonly+ print 'IncludePaths', includepaths+ print 'ExcludePaths', excludepathselse:
def debugf(str, args=None):
pass
STATUS_STATES='MAR!?IC'MODIFIED,ADDED,REMOVED,DELETED,UNKNOWN,IGNORED,UNCHANGED=STATUS_STATESNOT_IN_REPO=' 'ROOT="r"UNRESOLVED='U'# file status cacheoverlay_cache={}cache_tick_count=0cache_root=Nonecache_pdir=Nonedefadd_dirs(list):dirs=set()iflist:dirs.add('')forfinlist:pdir=os.path.dirname(f)ifpdirindirs:continuewhilepdir:dirs.add(pdir)pdir=os.path.dirname(pdir)list.extend(dirs)defget_state(upath,repo=None):""" Get the state of a given path in source control. """states=get_states(upath,repo)returnstatesandstates[0]orNOT_IN_REPOdefget_states(upath,repo=None):""" Get the states of a given path in source control. """
global overlay_cache, cache_tick_count
global cache_root, cache_pdir
+ global enabled, localonly+ global includepaths, excludepaths #debugf("called: _get_state(%s)", path)
tc = GetTickCount()
try:# handle some Asian charsetspath=upath.encode('mbcs')except:path=upath# check if path is cachedpdir=os.path.dirname(path)ifcache_pdir==pdirandoverlay_cache:iftc-cache_tick_count<CACHE_TIMEOUT:status=overlay_cache.get(path)ifnotstatus:ifos.path.isdir(os.path.join(path,'.hg')):add(path,ROOT)status=ROOTelse:status=overlay_cache.get(pdir,NOT_IN_REPO)debugf("%s: %s (cached)",(path,status))returnstatuselse:debugf("Timed out!!")overlay_cache.clear()cache_tick_count=GetTickCount()# path is a driveifpath.endswith(":\\"):add(path,NOT_IN_REPO)returnNOT_IN_REPO# open repoifcache_pdir==pdir:root=cache_rootelse:debugf("find new root")root=thgutil.find_root(path)ifroot==path:add(path,ROOT)returnROOTcache_root=rootcache_pdir=pdirifrootisNone:debugf("_get_state: not in repo")overlay_cache={None:None}cache_tick_count=GetTickCount()returnNOT_IN_REPOdebugf("_get_state: root = "+root)hgdir=os.path.join(root,'.hg','')ifpdir==hgdir[:-1]orpdir.startswith(hgdir): add(pdir, NOT_IN_REPO)
return NOT_IN_REPO
try:
+ if not enabled:+ overlay_cache = {None: None}+ cache_tick_count = GetTickCount()+ debugf("overlayicons disabled")+ return NOT_IN_REPO+ tc1 = GetTickCount()
- if not repo or (repo.root != root and repo.root != os.path.realpath(root)):
+ real = os.path.realpath(root)+ if not repo or (repo.root != root and repo.root != real):
repo = hg.repository(ui.ui(), path=root)
debugf("hg.repository() took %g ticks", (GetTickCount() - tc1))
- # check if to display overlay icons in this repo- overlayopt = repo.ui.config('tortoisehg', 'overlayicons', ' ').lower()- debugf("%s: repo overlayicons = %s", (path, overlayopt))- if overlayopt=='localdisk':- overlayopt = bool(thgutil.netdrive_status(path))- if not overlayopt or overlayopt in 'false off no'.split():
- debugf("%s: overlayiconsdisabled", path)
++ if localonlyand thgutil.netdrive_status(path):
+ debugf("%s: isa network drive", path)
overlay_cache = {None: None}
cache_tick_count = GetTickCount()
return NOT_IN_REPO
+ if includepaths:+ for p in includepaths:+ if path.startswith(p):+ break;+ else:+ debugf("%s: is not in an include path", path)+ overlay_cache = {None: None}+ cache_tick_count = GetTickCount()+ return NOT_IN_REPO+ if excludepaths:+ for p in excludepaths:+ if path.startswith(p):+ debugf("%s: is in an exclude path", path)+ overlay_cache = {None: None}+ cache_tick_count = GetTickCount()+ return NOT_IN_REPO except RepoError:
# We aren't in a working tree
debugf("%s: not in repo", pdir)
add(pdir, IGNORED)
return IGNORED
- except StandardError, e:
+ except Exception, e:
debugf("error while handling %s:", pdir)
debugf(e)
add(pdir, UNKNOWN)
return UNKNOWN
+ # get file status
tc1 = GetTickCount()
try:matcher=cmdutil.match(repo,[pdir])repostate=repo.status(match=matcher,ignored=True,clean=True,unknown=True)exceptutil.Abort,inst:debugf("abort: %s",inst)debugf("treat as unknown : %s",path)returnUNKNOWNdebugf("status() took %g ticks",(GetTickCount()-tc1))mergestate=repo.dirstate.parents()[1]!=node.nullidand \
hasattr(merge,'mergestate')# cached file infotc=GetTickCount()overlay_cache={}add(root,ROOT)states=STATUS_STATESifmergestate:mstate=merge.mergestate(repo)unresolved=[fforfinmstateifmstate[f]=='u']ifunresolved:modified=repostate[0]modified[:]=set(modified)-set(unresolved)repostate.insert(0,unresolved)states=[UNRESOLVED]+statesstates=zip(repostate,states)states[-1],states[-2]=states[-2],states[-1]#clean before ignoredforgrp,stinstates:add_dirs(grp)forfingrp:fpath=os.path.join(root,os.path.normpath(f))add(fpath,st)status=overlay_cache.get(path,UNKNOWN)debugf("%s: %s",(path,status))cache_tick_count=GetTickCount()returnstatusdefadd(path,state):overlay_cache[path]=overlay_cache.get(path,'')+state
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.