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.
"""shlib.py - TortoiseHg shell utilities Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>This software may be used and distributed according to the termsof the GNU General Public License, incorporated herein by reference."""importdumbdbm,anydbmanydbm._defaultmod=dumbdbmimportosimportgtkimport shelve
import time
import hgtk
+import gobjectfrom mercurial.i18n import _
class SimpleMRUList(object):
def__init__(self,size=10,reflist=[],compact=True):self._size=sizeself._list=reflistifcompact:self.compact()def__iter__(self):foreleminself._list:yieldelemdefadd(self,val):ifvalinself._list:self._list.remove(val)self._list.insert(0,val)self.flush()defget_size(self):returnself._sizedefset_size(self,size):self._size=sizeself.flush()defflush(self):whilelen(self._list)>self._size:delself._list[-1]defcompact(self):''' remove duplicate in list '''newlist=[]forvinself._list:ifvnotinnewlist:newlist.append(v)self._list[:]=newlistclassSettings(object):version=1.0def__init__(self,appname,path=None):self._appname=appnameself._data={}self._path=pathandpathorself._get_path(appname)self._audit()self.read()defget_value(self,key,default=None,create=False):ifkeyinself._data:returnself._data[key]elifcreate:self._data[key]=defaultreturndefaultdefset_value(self,key,value):self._data[key]=valuedefmrul(self,key,size=10):''' wrapper method to create a most-recently-used (MRU) list '''ls=self.get_value(key,[],True)ml=SimpleMRUList(size=size,reflist=ls)returnmldefget_keys(self):returnself._data.keys()defget_appname(self):returnself._appnamedefread(self):self._data.clear()ifnotos.path.exists(self._path+'.dat'):returndbase=shelve.open(self._path)self._dbappname=dbase['APPNAME']self.version=dbase['VERSION']self._data.update(dbase.get('DATA',{}))dbase.close()defwrite(self):self._write(self._path,self._data)def_write(self,appname,data):dbase=shelve.open(self._get_path(appname))dbase['VERSION']=Settings.versiondbase['APPNAME']=appnamedbase['DATA']=datatry:dbase.close()exceptIOError:pass# Don't care too much about permission errorsdef_get_path(self,appname):ifos.name=='nt':returnos.path.join(os.environ.get('APPDATA'),'TortoiseHg',appname)else:returnos.path.join(os.path.expanduser('~'),'.tortoisehg','settings',appname)def_audit(self):ifos.path.exists(os.path.dirname(self._path)):returnos.makedirs(os.path.dirname(self._path))defget_system_times():t=os.times()ift[4]==0.0:# Windows leaves this as zero, so use time.clock()t=(t[0],t[1],t[2],t[3],time.clock())returntdefset_tortoise_icon(window,thgicon):ico=get_tortoise_icon(thgicon)ifico:window.set_icon_from_file(ico)defset_tortoise_keys(window):'Set default TortoiseHg keyboard accelerators'accelgroup=gtk.AccelGroup()window.add_accel_group(accelgroup)key,modifier=gtk.accelerator_parse('<Control>w')window.add_accelerator('thg-close',accelgroup,key,modifier,gtk.ACCEL_VISIBLE)key,modifier=gtk.accelerator_parse('<Control>q')window.add_accelerator('thg-exit',accelgroup,key,modifier,gtk.ACCEL_VISIBLE)key,modifier=gtk.accelerator_parse('F5')window.add_accelerator('thg-refresh',accelgroup,key,modifier,gtk.ACCEL_VISIBLE)key,modifier=gtk.accelerator_parse('<Control>Return')window.add_accelerator('thg-accept',accelgroup,key,modifier,gtk.ACCEL_VISIBLE)# connect ctrl-w and ctrl-q to every windowwindow.connect('thg-close',thgclose)window.connect('thg-exit',thgexit)def thgexit(window):
if thgclose(window):
- hgtk.thgexit(window)
+gobject.idle_add(hgtk.thgexit, window)
def thgclose(window):
if hasattr(window, 'should_live'):
ifwindow.should_live():returnFalsewindow.destroy()returnTruedefget_tortoise_icon(thgicon):'''Find a tortoise icon, apply to PyGtk window'''# The context menu should set this variablevar=os.environ.get('THG_ICON_PATH',None)paths=varand[var]or[]try:# Else try relative paths from hggtk, the repository layoutfdir=os.path.dirname(__file__)paths.append(os.path.join(fdir,'..','icons'))# ... or the unix installer layoutpaths.append(os.path.join(fdir,'..','..','..','share','pixmaps','tortoisehg','icons'))paths.append(os.path.join(fdir,'..','..','..','..','share','pixmaps','tortoisehg','icons'))exceptNameError:# __file__ is not always availablepassforpinpaths:path=os.path.join(p,'tortoise',thgicon)ifos.path.isfile(path):returnpathelse:print_('icon not found'),thgiconreturnNonedefversion():try:import__version__return__version__.versionexceptImportError:return_('unknown')ifos.name=='nt':defshell_notify(paths):try:fromwin32com.shellimportshell,shellconexceptImportError:returndirs=[]forpathinpaths:abspath=os.path.abspath(path)ifnotos.path.isdir(abspath):abspath=os.path.dirname(abspath)ifabspathnotindirs:dirs.append(abspath)# send notifications to deepest directories firstdirs.sort(lambdax,y:len(y)-len(x))fordirindirs:pidl,ignore=shell.SHILCreateFromPath(dir,0)ifpidlisNone:continueshell.SHChangeNotify(shellcon.SHCNE_UPDATEITEM,shellcon.SHCNF_IDLIST|shellcon.SHCNF_FLUSH,pidl,None)else:defshell_notify(paths):pass
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.