diff --git a/darc/archiver.py b/darc/archiver.py index b044c2df1..ba6edaf74 100644 --- a/darc/archiver.py +++ b/darc/archiver.py @@ -11,7 +11,7 @@ from .key import Key from .helpers import location_validator, format_time, \ format_file_mode, IncludePattern, ExcludePattern, exclude_path, to_localtime, \ - get_cache_dir, format_timedelta, purge_split, Manifest, Location + get_cache_dir, format_timedelta, prune_split, Manifest, Location from .remote import StoreServer, RemoteStore @@ -253,7 +253,7 @@ def do_info(self, args): stats.print_() return self.exit_code - def do_purge(self, args): + def do_prune(self, args): store = self.open_store(args.store) key = Key(store) manifest = Manifest(store, key) @@ -268,15 +268,15 @@ def do_purge(self, args): archives = [archive for archive in archives if archive.name.startswith(args.prefix)] keep = [] if args.hourly: - keep += purge_split(archives, '%Y-%m-%d %H', args.hourly) + keep += prune_split(archives, '%Y-%m-%d %H', args.hourly) if args.daily: - keep += purge_split(archives, '%Y-%m-%d', args.daily, keep) + keep += prune_split(archives, '%Y-%m-%d', args.daily, keep) if args.weekly: - keep += purge_split(archives, '%Y-%V', args.weekly, keep) + keep += prune_split(archives, '%Y-%V', args.weekly, keep) if args.monthly: - keep += purge_split(archives, '%Y-%m', args.monthly, keep) + keep += prune_split(archives, '%Y-%m', args.monthly, keep) if args.yearly: - keep += purge_split(archives, '%Y', args.yearly, keep) + keep += prune_split(archives, '%Y', args.yearly, keep) keep.sort(key=attrgetter('ts'), reverse=True) to_delete = [a for a in archives if a not in keep] @@ -387,8 +387,8 @@ def run(self, args=None): type=location_validator(archive=True), help='Archive to display information about') - subparser = subparsers.add_parser('purge', parents=[common_parser]) - subparser.set_defaults(func=self.do_purge) + subparser = subparsers.add_parser('prune', parents=[common_parser]) + subparser.set_defaults(func=self.do_prune) subparser.add_argument('-H', '--hourly', dest='hourly', type=int, default=0, help='Number of hourly archives to keep') subparser.add_argument('-d', '--daily', dest='daily', type=int, default=0, @@ -406,7 +406,7 @@ def run(self, args=None): help='Actually delete archives') subparser.add_argument('store', metavar='STORE', type=location_validator(archive=False), - help='Store to purge') + help='Store to prune') args = parser.parse_args(args) self.verbose = args.verbose diff --git a/darc/helpers.py b/darc/helpers.py index 251f096fb..55b30544d 100644 --- a/darc/helpers.py +++ b/darc/helpers.py @@ -47,7 +47,7 @@ def write(self): self.store.put(self.MANIFEST_ID, self.key.encrypt(data)) -def purge_split(archives, pattern, n, skip=[]): +def prune_split(archives, pattern, n, skip=[]): items = {} keep = [] for a in archives: diff --git a/darc/test.py b/darc/test.py index 430062a86..b680e1e0f 100644 --- a/darc/test.py +++ b/darc/test.py @@ -122,16 +122,16 @@ def test_corrupted_store(self): fd.close() self.darc('verify', self.store_location + '::test', exit_code=1) - def test_purge_store(self): + def test_prune_store(self): src_dir = os.path.join(os.getcwd(), os.path.dirname(__file__)) self.darc('init', '-p', '', self.store_location) self.darc('create', self.store_location + '::test1', src_dir) self.darc('create', self.store_location + '::test2', src_dir) - self.darc('purge', self.store_location, '--daily=2') + self.darc('prune', self.store_location, '--daily=2') output = self.darc('list', self.store_location) assert 'test1' in output assert 'test2' in output - self.darc('purge', self.store_location, '--daily=2', '--really') + self.darc('prune', self.store_location, '--daily=2', '--really') output = self.darc('list', self.store_location) assert 'test1' not in output assert 'test2' in output diff --git a/docs/index.rst b/docs/index.rst index 1c6266cd1..0c724ce1f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -133,15 +133,15 @@ The following command will list the contents of the ``backup-2011-09-10`` archiv -rw-r--r-- YOU users 280 May 14 2010 home/YOU/Documents/something-else.pdf ... -Purge old archives +Prune old archives ------------------ -When performing automatic backups it is important to periodically purge old backup +When performing automatic backups it is important to periodically prune old backup archives to stop the store from growing too big. -The following command will purge old archives and only keep the +The following command will prune old archives and only keep the seven latest end of day archives and the five latest end of week archives:: - $ darc purge --daily=7 --weekly=5 /data/my-backup.darc + $ darc prune --daily=7 --weekly=5 /data/my-backup.darc Indices and tables