3 from optparse import OptionParser
6 from darcsver import darcsvermodule, __version__
9 EXE_NAME=os.path.basename(sys.argv[0])
14 parser = OptionParser(usage="Usage: %prog [options] [pkgname [verfilename]]",
15 version="%prog " + str(__version__),
17 parser.add_option("-q", "--quiet", default=False, action="store_true",
18 help="Be quiet, do the job without any output.")
19 parser.add_option("--count-all-patches", "--revision-number", default=False,
20 action="store_true", dest="count_all_patches",
21 help="By default %s counts the number of patches since the "
22 "most recent release tag. With this option, it counts "
23 "all the patches in the repository." % EXE_NAME)
25 options, args = parser.parse_args()
30 pkgname = os.path.basename(os.getcwd())
32 print "%s: You didn't pass a pkg-name on the command-line, so I'm going to take the name of the current working directory: \"%s\"" % (EXE_NAME, pkgname,)
35 verfilename = args.pop(0)
37 verfilename = os.path.join(pkgname, "_version.py")
39 print "%s: You didn't pass a verfilename on the command-line, so I'm going to build one from the name of the package: \"%s\"" % (EXE_NAME, verfilename,)
41 (rc, newverstr) = darcsvermodule.update(pkgname=pkgname, verfilename=verfilename, revision_number=options.count_all_patches, quiet=options.quiet, EXE_NAME=EXE_NAME)
44 if __name__ == "__main__":