diff options
author | W. Trevor King <wking@drexel.edu> | 2009-07-19 15:24:51 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-07-19 15:24:51 -0400 |
commit | a6d5f2891dc353ebe5d9d8598790a6674c174eec (patch) | |
tree | a7828e4bc0b981540eacd7f3c5199a0c9f2ab6a4 /libbe/arch.py | |
parent | b3ce47285a66a35904e5e50636ce471ecb4ce29d (diff) | |
download | bugseverywhere-a6d5f2891dc353ebe5d9d8598790a6674c174eec.tar.gz |
Added --allow-empty to "be commit"
Previously many backends would silently add an empty commit. Not very
useful. When the new --allow-empty flag and related allow_empty
options are false, every versioning backend is guaranteed to raise the
EmptyCommit exception in the case of an attempted empty commit.
Diffstat (limited to 'libbe/arch.py')
-rw-r--r-- | libbe/arch.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libbe/arch.py b/libbe/arch.py index 30983e7..2f45aa9 100644 --- a/libbe/arch.py +++ b/libbe/arch.py @@ -260,16 +260,17 @@ class Arch(RCS): else: status,output,error = \ self._u_invoke_client("get", revision,directory) - def _rcs_commit(self, commitfile): + def _rcs_commit(self, commitfile, allow_empty=False): + if allow_empty == False: + # arch applies empty commits without complaining, so check first + status,output,error = self._u_invoke_client("changes",expect=(0,1)) + if status == 0: + raise rcs.EmptyCommit() summary,body = self._u_parse_commitfile(commitfile) - #status,output,error = self._invoke_client("make-log") - if body == None: - status,output,error \ - = self._u_invoke_client("commit","--summary",summary) - else: - status,output,error \ - = self._u_invoke_client("commit","--summary",summary, - "--log-message",body) + args = ["commit", "--summary", summary] + if body != None: + args.extend(["--log-message",body]) + status,output,error = self._u_invoke_client(*args) revision = None revline = re.compile("[*] committed (.*)") match = revline.search(output) |