Versions is a great SVN tool in Mac OS, but it has a date limit. Someone on the Internet provides a script to reset versions's use date, which is worth learning. Paste it to make a record.
#!/usr/bin/env python
import os, sys, re, plistlib, subprocess, re, time
userdir = os.path.expanduser('~')
prefdir = os.path.join(userdir, 'Library/Preferences')
pfile_a = os.path.join(prefdir,'com.madebysofa.Versions.plist')
pfile_b = 'com.picodev.Versions.plist'
hfile_a = '.CF89AA64'
hfile_b = '.FB64CF89'
globalprefs = os.path.join(prefdir, '.GlobalPreferences.plist')
def convert_plist_to_xml(plist_path):
cmdline = '/usr/bin/plutil -convert xml1 "%s"' % plist_path
os.system(cmdline)
def isVersionsRunning():
p = subprocess.Popen(['ps','-Ac'],stdout=subprocess.PIPE)
output = p.stdout.read()
apps_re = re.search('^([0-9]+).*Versions$', output, re.M)
if apps_re:
return int(apps_re.group(1))
else:
return False
def killRunningVersions():
pid = isVersionsRunning()
if pid:
sys.stdout.write('Stopping currently running Versions...\n')
os.system('kill %d' % pid)
while isVersionsRunning():
time.sleep(0.1)
def relaunchVersions():
os.system('open -a /Applications/Versions.app')
if __name__ == '__main__':
killRunningVersions()
pfile_a_path = os.path.join(prefdir, pfile_a)
pfile_b_path = os.path.join(prefdir, pfile_b)
# --1) Start by deleting the hidden files.
hfile_a1 = os.path.join(userdir, hfile_a)
if os.path.exists(hfile_a1):
print 'Removing "%s"'%hfile_a1
os.remove(hfile_a1)
hfile_b1 = os.path.join(os.path.join(userdir, 'Library/'), hfile_b)
if os.path.exists(hfile_b1):
print 'Removing "%s"'%hfile_b1
os.remove(hfile_b1)
# -- 2) Now, delete the expiry token from the globalprefs file...
if os.path.exists(globalprefs):
convert_plist_to_xml(globalprefs)
pl = plistlib.readPlist(globalprefs)
if 'com.madebysofa.Versions.ezsRequiredToken' in pl.keys():
sys.stdout.write('Removing expiry token from .Globalprefs...\n')
del pl['com.madebysofa.Versions.ezsRequiredToken']
plistlib.writePlist(pl, globalprefs)
# -- 2) Make sure that the "FirstRunDate" is also removed...
if os.path.exists(pfile_a):
convert_plist_to_xml(pfile_a)
pl = plistlib.readPlist(pfile_a)
if 'FirstRunDate' in pl.keys():
sys.stdout.write('Removing FirstRunDate from "%s"\n' % pfile_a)
del pl['FirstRunDate']
if 'EZSBookmarksSelectionMask' in pl.keys():
sys.stdout.write('Removing EZSBookmarksSelectionMask from "%s"' % pfile_a)
del pl['EZSBookmarksSelectionMask']
plistlib.writePlist(pl, pfile_a)
sys.stdout.write('Launching Versions....')
relaunchVersions()