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 /libbe/bzr.py | |
parent | 9c956487a7d10f4b52ba4aeaceff35e90d027130 (diff) | |
parent | a6d5f2891dc353ebe5d9d8598790a6674c174eec (diff) | |
download | bugseverywhere-2f2841356a80294b601f67e6676266d88b3ab971.tar.gz |
Merged "be commit --allow-empty from be.wtk-rr"
Diffstat (limited to 'libbe/bzr.py')
-rw-r--r-- | libbe/bzr.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/libbe/bzr.py b/libbe/bzr.py index fcbd6ac..b33292c 100644 --- a/libbe/bzr.py +++ b/libbe/bzr.py @@ -71,9 +71,21 @@ class Bzr(RCS): else: self._u_invoke_client("branch", "--revision", revision, ".", directory) - def _rcs_commit(self, commitfile): - status,output,error = self._u_invoke_client("commit", "--unchanged", - "--file", commitfile) + def _rcs_commit(self, commitfile, allow_empty=False): + args = ["commit", "--file", commitfile] + if allow_empty == True: + args.append("--unchanged") + status,output,error = self._u_invoke_client(*args) + else: + kwargs = {"expect":(0,3)} + status,output,error = self._u_invoke_client(*args, **kwargs) + if status != 0: + strings = ["ERROR: no changes to commit.", # bzr 1.3.1 + "ERROR: No changes to commit."] # bzr 1.15.1 + if self._u_any_in_string(strings, error) == True: + raise rcs.EmptyCommit() + else: + raise rcs.CommandError(args, status, error) revision = None revline = re.compile("Committed revision (.*)[.]") match = revline.search(error) |