# HG changeset patch # User Jeff Hammel # Date 1273104527 25200 # Node ID c77e9bef78d640938baac3a2e5fe67ff076f991b # Parent b1274abd120655f1ec92e95a859e47201f27c09c * update list of public API functions * further flushing out of profile manager diff -r b1274abd1206 -r c77e9bef78d6 profilemanager/main.py --- 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]") diff -r b1274abd1206 -r c77e9bef78d6 profilemanager/manager.py --- 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!)"""