diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-19 15:26:48 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-19 15:26:48 -0400 |
commit | 2f2841356a80294b601f67e6676266d88b3ab971 (patch) | |
tree | 573942a8c251eb52565e7567f295a97d0d472e15 /becommands/commit.py | |
parent | 9c956487a7d10f4b52ba4aeaceff35e90d027130 (diff) | |
parent | a6d5f2891dc353ebe5d9d8598790a6674c174eec (diff) | |
download | bugseverywhere-2f2841356a80294b601f67e6676266d88b3ab971.tar.gz |
Merged "be commit --allow-empty from be.wtk-rr"
Diffstat (limited to 'becommands/commit.py')
-rw-r--r-- | becommands/commit.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/becommands/commit.py b/becommands/commit.py index bda51c4..4f3bdbd 100644 --- a/becommands/commit.py +++ b/becommands/commit.py @@ -14,7 +14,7 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """Commit the currently pending changes to the repository""" -from libbe import cmdutil, bugdir, editor +from libbe import cmdutil, bugdir, editor, rcs import sys __desc__ = __doc__ @@ -49,13 +49,22 @@ def execute(args, manipulate_encodings=True): body = editor.editor_string("Please enter your commit message above") else: body = bd.rcs.get_file_contents(options.body, allow_no_rcs=True) - revision = bd.rcs.commit(summary, body=body) - print "Committed %s" % revision + try: + revision = bd.rcs.commit(summary, body=body, + allow_empty=options.allow_empty) + except rcs.EmptyCommit, e: + print e + return 1 + else: + print "Committed %s" % revision def get_parser(): parser = cmdutil.CmdOptionParser("be commit COMMENT") parser.add_option("-b", "--body", metavar="FILE", dest="body", help='Provide a detailed body for the commit message. In the special case that FILE == "EDITOR", spawn an editor to enter the body text (in which case you cannot use stdin for the summary)', default=None) + parser.add_option("-a", "--allow-empty", dest="allow_empty", + help="Allow empty commits", + default=False, action="store_true") return parser longhelp=""" |