3 bup_python="$(dirname "$0")/bup-python" || exit $?
4 exec "$bup_python" "$0" ${1+"$@"}
8 from bup import options
9 from bup import _version
12 bup version [--date|--commit|--tag]
14 date display the date this version of bup was created
15 commit display the git commit id of this version of bup
16 tag display the tag name of this version. If no tag is available, display the commit id
18 o = options.Options(optspec)
19 (opt, flags, extra) = o.parse(sys.argv[1:])
22 total = (opt.date or 0) + (opt.commit or 0) + (opt.tag or 0)
24 o.fatal('at most one option expected')
28 """Format bup's version date string for output."""
29 return _version.DATE.split(' ')[0]
33 """Get the commit hash of bup's current version."""
34 return _version.COMMIT
38 """Format bup's version tag (the official version number).
40 When generated from a commit other than one pointed to with a tag, the
41 returned string will be "unknown-" followed by the first seven positions of
44 names = _version.NAMES.strip()
45 assert(names[0] == '(')
46 assert(names[-1] == ')')
48 l = [n.strip() for n in names.split(',')]
50 if n.startswith('tag: bup-'):
52 return 'unknown-%s' % _version.COMMIT[:7]
58 print version_commit()