Repository: activeloopai/Hub
File: deeplake/core/dataset/dataset.py (Python)

Code before:
        self._delete_branch(name)
        integrity_check(self)

    def _delete_branch(self, name: str) -> None:
        if self._is_filtered_view:
            raise Exception(
                "Cannot perform version control operations on a filtered dataset view."
            )
        read_only = self._read_only
        if read_only:
            raise ReadOnlyModeError()
        try_flushing(self)
        self._initial_autoflush.append(self.storage.autoflush)
        self.storage.autoflush = False
        try:
            self._unlock()
            delete_branch(self, name)
        finally:
            self._set_read_only(read_only, err=True)
            self.storage.autoflush = self._initial_autoflush.pop()

    @invalid_view_op
    def squash_commits(self) -> None:
        """
        Squashes all commits in 'main' into one commit.
        This is cannot be run if there are any branches besides `main`

        Raises:
            ReadOnlyModeError: If branch deletion is attempted in read-only mode.
            VersionControlError: If the main branch cannot be squashed.
        """
        if self._is_filtered_view:
            raise Exception(
                "Cannot perform version control operations on a filtered dataset view."
            )
        read_only = self._read_only
        if read_only:
            raise ReadOnlyModeError()

        try_flushing(self)

        self._initial_autoflush.append(self.storage.autoflush)
        self.storage.autoflush = False
        try:
            self._unlock()
            squash_commits(self)
        finally:
            self._set_read_only(read_only, err=True)
            self.storage.autoflush = self._initial_autoflush.pop()

    def log(self):

Review comment (suggestion):
```suggestion
        This cannot be run if there are any branches besides ``main``
```

Code after:
        self._delete_branch(name)
        integrity_check(self)

    def _delete_branch(self, name: str) -> None:
        if self._is_filtered_view:
            raise Exception(
                "Cannot perform version control operations on a filtered dataset view."
            )
        read_only = self._read_only
        if read_only:
            raise ReadOnlyModeError()
        try_flushing(self)
        self._initial_autoflush.append(self.storage.autoflush)
        self.storage.autoflush = False
        try:
            self._unlock()
            delete_branch(self, name)
        finally:
            self._set_read_only(read_only, err=True)
            self.storage.autoflush = self._initial_autoflush.pop()

    @invalid_view_op
    def _squash_main(self) -> None:
        """
        DEPRECATED: This method is deprecated and will be removed in a future release.

        Squashes all commits in current branch into one commit.
        NOTE: This cannot be run if there are any branches besides ``main``

        Raises:
            ReadOnlyModeError: If branch deletion is attempted in read-only mode.
            VersionControlError: If the branch cannot be squashed.
        """
        if self._is_filtered_view:
            raise Exception(
                "Cannot perform version control operations on a filtered dataset view."
            )
        read_only = self._read_only
        if read_only:
            raise ReadOnlyModeError()

        try_flushing(self)

        self._initial_autoflush.append(self.storage.autoflush)
        self.storage.autoflush = False
        try:
            self._unlock()
            _squash_main(self)
        finally:
            self._set_read_only(read_only, err=True)
            self.libdeeplake_dataset = None