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/hg.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/hg.py')
-rw-r--r-- | libbe/hg.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libbe/hg.py b/libbe/hg.py index c301948..a20eeb5 100644 --- a/libbe/hg.py +++ b/libbe/hg.py @@ -58,7 +58,7 @@ class Hg(RCS): def _rcs_add(self, path): self._u_invoke_client("add", path) def _rcs_remove(self, path): - self._u_invoke_client("rm", path) + self._u_invoke_client("rm", "--force", path) def _rcs_update(self, path): pass def _rcs_get_file_contents(self, path, revision=None, binary=False): @@ -73,8 +73,13 @@ class Hg(RCS): return RCS._rcs_duplicate_repo(self, directory, revision) else: self._u_invoke_client("archive", "--rev", revision, directory) - def _rcs_commit(self, commitfile): - self._u_invoke_client('commit', '--logfile', commitfile) + def _rcs_commit(self, commitfile, allow_empty=False): + args = ['commit', '--logfile', commitfile] + status,output,error = self._u_invoke_client(*args) + if allow_empty == False: + strings = ["nothing changed"] + if self._u_any_in_string(strings, output) == True: + raise rcs.EmptyCommit() status,output,error = self._u_invoke_client('identify') revision = None revline = re.compile("(.*) tip") |