Mercurial > mozilla > hg > ProfileManager
changeset 10:c77e9bef78d6
* update list of public API functions
* further flushing out of profile manager
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Wed, 05 May 2010 17:08:47 -0700 |
parents | b1274abd1206 |
children | 21bc82d8930a |
files | profilemanager/main.py profilemanager/manager.py |
diffstat | 2 files changed, 27 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/profilemanager/main.py Wed Apr 14 16:07:20 2010 -0700 +++ b/profilemanager/main.py Wed May 05 17:08:47 2010 -0700 @@ -19,10 +19,13 @@ # global option parsing commands = [ ProfileManager.backup, + ProfileManager.backups, ProfileManager.clone, ProfileManager.list, +# ProfileManager.merge, + ProfileManager.new, ProfileManager.restore, - ProfileManager.merge ] + ] parser = CommandParser(commands, setup=create_profilemanager) parser.add_option('-c', '--config', dest='config', help="specify a profile.ini [default: $HOME/.mozilla/firefox/profiles.ini]")
--- a/profilemanager/manager.py Wed Apr 14 16:07:20 2010 -0700 +++ b/profilemanager/manager.py Wed May 05 17:08:47 2010 -0700 @@ -8,6 +8,10 @@ from utils import format_tabular from ConfigParser import SafeConfigParser as ConfigParser +# Changes to profiles.ini: +# - add a ``backups`` field for each profile: +# Backups = /path/to/backup:1273104310 /path/to/other/backup:1273104355 + class ProfileNotFound(Exception): """ exception when a profile is specified but is not present in a given @@ -46,18 +50,6 @@ retval.append(values) return format_tabular(retval) - def backups(self, profile=None): - """ - list backups for a given profile, or all profiles if the - profile is not given; returns a list of backups if - profile is given or a dictionary of lists otherwise - """ - if profile is None: - # all profiles - retval = {} - return retval - # TODO - def clone(self, source, dest, hash=True): """ clones the profile `source` and output to `dest` @@ -90,6 +82,18 @@ # `Backup=$(profile)s.$(datestamp)s.bak` # to self.profiles + def backups(self, profile=None): + """ + list backups for a given profile, or all profiles if the + profile is not given; returns a list of backups if + profile is given or a dictionary of lists otherwise + """ + if profile is None: + # all profiles + retval = {} + return retval + # TODO + def restore(self, profile, date=None, delete=False): """ restore the profile from a backup @@ -99,12 +103,17 @@ """ # get the possible backups - # TODO + backups = self.backups(profile) + # TODO: check to see if these all exist (print warnings if not) # restore the backup over ``profile`` if delete: # delete the backup - pass + # delete the directory + # delete the entry from ``profiles.ini`` + # if there are no backups, delete the ``backups`` line + pass #TODO + def merge(self, output, *profiles): """merge a set of profiles (not trivial!)"""