From 24f57e206ef41a97d23781bc85a712d1c00dcbf6 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Wed, 16 Feb 2011 15:14:01 -0800 Subject: [PATCH] cmd/index: make the default mode '-u'. 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 --- Documentation/bup-index.md | 18 +++++++++++++----- cmd/index-cmd.py | 16 +++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/Documentation/bup-index.md b/Documentation/bup-index.md index 2ec65e2..4f7eafb 100644 --- a/Documentation/bup-index.md +++ b/Documentation/bup-index.md @@ -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] # 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. diff --git a/cmd/index-cmd.py b/cmd/index-cmd.py index 1611457..b3abb90 100755 --- a/cmd/index-cmd.py +++ b/cmd/index-cmd.py @@ -116,28 +116,30 @@ def update_index(top, excluded_paths): optspec = """ -bup index <-p|m|u> [options...] +bup index <-p|m|s|u> [options...] -- + 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) -- 2.39.2