Mercurial > mozilla > hg > ProfileManager
comparison profilemanager/manager.py @ 1:979315ed0816
mucho cleanup on optionparser stuff
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 05 Apr 2010 08:55:44 -0700 |
parents | 7301d534bc6c |
children | 4d1cd60dd2a1 |
comparison
equal
deleted
inserted
replaced
0:7301d534bc6c | 1:979315ed0816 |
---|---|
22 self.profiles = profiles | 22 self.profiles = profiles |
23 self.directory = '' # TODO : path to self.profiles directory | 23 self.directory = '' # TODO : path to self.profiles directory |
24 | 24 |
25 ### (public) API | 25 ### (public) API |
26 | 26 |
27 @command | |
28 def clone(self, source, dest): | 27 def clone(self, source, dest): |
29 """ | 28 """ |
30 clones the profile `source` and output to `dest` | 29 clones the profile `source` and output to `dest` |
31 """ | 30 """ |
32 source_path = self.path(source) # fs path of the `from` profile | 31 source_path = self.path(source) # fs path of the `from` profile |
33 dest_path = self.path(dest) # fs path to back up to | 32 dest_path = self.path(dest) # fs path to back up to |
34 shutil.copytree(src_path, backup, symlinks=False) | 33 shutil.copytree(src_path, backup, symlinks=False) |
35 | 34 |
36 @command | 35 |
37 def backup(self, profile, dest=None): | 36 def backup(self, profile, dest=None): |
38 """ | 37 """ |
39 backup the profile | 38 backup the profile |
40 - profile: name of the profile to be backed up | 39 - profile: name of the profile to be backed up |
41 - dest: name of the destination (optional) | 40 - dest: name of the destination (optional) |
46 self.clone(profile, dest) | 45 self.clone(profile, dest) |
47 # TODO: add something like | 46 # TODO: add something like |
48 # `Backup=$(profile)s.$(datestamp)s.bak` | 47 # `Backup=$(profile)s.$(datestamp)s.bak` |
49 # to self.profiles | 48 # to self.profiles |
50 | 49 |
51 @command | |
52 def restore(self, profile, date=None, delete=False): | 50 def restore(self, profile, date=None, delete=False): |
53 """ | 51 """ |
54 restore the profile from a backup | 52 restore the profile from a backup |
55 the most recent backup is used unless `date` is given | 53 the most recent backup is used unless `date` is given |
56 - date : date to restore from | 54 - date : date to restore from |
58 """ | 56 """ |
59 if delete: | 57 if delete: |
60 # delete the backup | 58 # delete the backup |
61 pass | 59 pass |
62 | 60 |
63 @command | |
64 def merge(self, *profiles): | 61 def merge(self, *profiles): |
65 """merge a set of profiles (not trivial!)""" | 62 """merge a set of profiles (not trivial!)""" |
66 raise NotImplementedError | 63 raise NotImplementedError |
67 | 64 |
68 ### internal functions | 65 ### internal functions |