def assert_nondirty(cls): lines = [ line.strip() for line in subprocess.check_output( ["git", "status", "--porcelain"]).splitlines() if not line.strip().startswith(b"??") ] if lines: raise WorkingDirectoryIsDirtyException( "Git working directory is not clean:\n{}".format( b"\n".join(lines).decode()))
def assert_nondirty(cls): lines = [ line.strip() for line in subprocess.check_output( ["hg", "status", "-mard"]).splitlines() if not line.strip().startswith(b"??") ] if lines: raise WorkingDirectoryIsDirtyException( "Mercurial working directory is not clean:\n{}".format( b"\n".join(lines)))