bup tag
-bup tag \<tag name\> \<committish\>
+bup tag [-f] \<tag name\> \<committish\>
-bup tag -d \<tag name\>
+bup tag -d [-f] \<tag name\>
# DESCRIPTION
-d, \--delete
: delete a tag
+-f, \--force
+: Overwrite the named tag even if it already exists. With -f, don't
+ report a missing tag as an error.
+
# EXAMPLE
$ bup tag new-puppet-version hostx-backup
optspec = """
bup tag
-bup tag <tag name> <commit>
-bup tag -d <tag name>
+bup tag [-f] <tag name> <commit>
+bup tag -d [-f] <tag name>
--
d,delete= Delete a tag
+f,force Overwrite existing tag, or 'delete' a tag that doesn't exist
"""
o = options.Options(optspec)
tag_file = git.repo('refs/tags/%s' % opt.delete)
debug1("tag file: %s\n" % tag_file)
if not os.path.exists(tag_file):
+ if opt.force:
+ sys.exit(0)
log("bup: error: tag '%s' not found.\n" % opt.delete)
sys.exit(1)
o.fatal("tag name must not be empty.")
debug1("args: tag name = %s; commit = %s\n" % (tag_name, commit))
-if tag_name in tags:
+if tag_name in tags and not opt.force:
log("bup: error: tag '%s' already exists\n" % tag_name)
sys.exit(1)
WVPASSEQ "$(bup tag)" ""
WVPASS bup tag v0.1 master
WVPASSEQ "$(bup tag)" "v0.1"
+WVFAIL bup tag v0.1 master
+WVPASS bup tag -f v0.1 master
WVPASS bup tag -d v0.1
+WVPASS bup tag -f -d v0.1
+WVFAIL bup tag -d v0.1
# This section destroys data in the bup repository, so it is done last.
WVSTART "fsck"