Browse Source

Rename purge command to prune

Jonas Borgström 13 years ago
parent
commit
44b3757865
4 changed files with 18 additions and 18 deletions
  1. 10 10
      darc/archiver.py
  2. 1 1
      darc/helpers.py
  3. 3 3
      darc/test.py
  4. 4 4
      docs/index.rst

+ 10 - 10
darc/archiver.py

@@ -11,7 +11,7 @@ from .cache import Cache
 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 @@ class Archiver(object):
         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 @@ class Archiver(object):
             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 @@ class Archiver(object):
                                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 @@ class Archiver(object):
                                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

+ 1 - 1
darc/helpers.py

@@ -47,7 +47,7 @@ class Manifest(object):
         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:

+ 3 - 3
darc/test.py

@@ -122,16 +122,16 @@ class Test(unittest.TestCase):
         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

+ 4 - 4
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