]> arthur.barton.de Git - bup.git/commitdiff
cmd/index: make the default mode '-u'.
authorAvery Pennarun <apenwarr@gmail.com>
Wed, 16 Feb 2011 23:14:01 +0000 (15:14 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Wed, 16 Feb 2011 23:14:01 +0000 (15:14 -0800)
I always forget the -u option, and it's by far the most common thing to do
with 'bup index'.  So if no mode option is provided, just default to that
one.

While we're here, update the man page and usage message a bit.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
Documentation/bup-index.md
cmd/index-cmd.py

index 2ec65e2c45d5878ec5301c7e416929562fd729e1..4f7eafb334c1b423cf25731be54e20325bc2d9a9 100644 (file)
@@ -8,8 +8,8 @@ bup-index - print and/or update the bup filesystem index
 
 # SYNOPSIS
 
-bup index <-p|-m|-u> [-s] [-H] [-l] [-x] [--fake-valid]
-[--check] [-f *indexfile*] [--exclude *path*]
+bup index <-p|-m|-s|-u> [-H] [-l] [-x] [--fake-valid]
+[--fake-invalid] [--check] [-f *indexfile*] [--exclude *path*]
 [--exclude-from *filename*] [-v] <filenames...>
 
 # DESCRIPTION
@@ -40,12 +40,13 @@ other purposes (such as speeding up other programs that
 need the same information).
 
 
-# OPTIONS
+# MODES
 
 -u, --update
-:   (recursively) update the index for the given filenames and
+:   recursively update the index for the given filenames and
     their descendants.  One or more filenames must be
-    given.
+    given.  If no mode option is given, this is the
+    default.
 
 -p, --print
 :   print the contents of the index.  If filenames are
@@ -64,6 +65,9 @@ need the same information).
     that a file is marked in the index as added, modified,
     deleted, or unchanged since the last backup.
     
+
+# OPTIONS
+
 -H, --hash
 :   for each file printed, prepend the most recently
     recorded hash code.  The hash code is normally
@@ -90,6 +94,10 @@ need the same information).
     unnecessarily backing up files that you know are
     boring.
     
+--fake-invalid
+:   mark specified filenames as not up-to-date, forcing the
+    next "bup save" run to re-check their contents.
+    
 --check
 :   carefully check index file integrity before and after
     updating.  Mostly useful for automated tests.
index 16114575be1b88f279eb2cb2e6e07269bb5e2b21..b3abb902e31bc2ccc2e9666b7a7be06b99b927a2 100755 (executable)
@@ -116,28 +116,30 @@ def update_index(top, excluded_paths):
 
 
 optspec = """
-bup index <-p|m|u> [options...] <filenames...>
+bup index <-p|m|s|u> [options...] <filenames...>
 --
+ Modes:
 p,print    print the index entries for the given names (also works with -u)
 m,modified print only added/deleted/modified files (implies -p)
 s,status   print each filename with a status char (A/M/D) (implies -p)
-H,hash     print the hash for each object next to its name (implies -p)
+u,update   recursively update the index entries for the given file/dir names (default if no mode is specified)
+check      carefully check index file integrity
+ Options:
+H,hash     print the hash for each object next to its name
 l,long     print more information about each file
-u,update   (recursively) update the index entries for the given filenames
-x,xdev,one-file-system  don't cross filesystem boundaries
 fake-valid mark all index entries as up-to-date even if they aren't
 fake-invalid mark all index entries as invalid
-check      carefully check index file integrity
 f,indexfile=  the name of the index file (normally BUP_DIR/bupindex)
 exclude=   a path to exclude from the backup (can be used more than once)
 exclude-from= a file that contains exclude paths (can be used more than once)
 v,verbose  increase log output (can be used more than once)
+x,xdev,one-file-system  don't cross filesystem boundaries
 """
 o = options.Options(optspec)
 (opt, flags, extra) = o.parse(sys.argv[1:])
 
 if not (opt.modified or opt['print'] or opt.status or opt.update or opt.check):
-    o.fatal('supply one or more of -p, -s, -m, -u, or --check')
+    opt.update = 1
 if (opt.fake_valid or opt.fake_invalid) and not opt.update:
     o.fatal('--fake-{in,}valid are meaningless without -u')
 if opt.fake_valid and opt.fake_invalid:
@@ -158,7 +160,7 @@ paths = index.reduce_paths(extra)
 
 if opt.update:
     if not extra:
-        o.fatal('update (-u) requested but no paths given')
+        o.fatal('update mode (-u) requested but no paths given')
     for (rp,path) in paths:
         update_index(rp, excluded_paths)