Repository: apache/airflow
File: dev/breeze/src/airflow_breeze/commands/release_command.py (Python)

Code before:
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
from __future__ import annotations

import os
import re
import time
from subprocess import CalledProcessError

import click

from airflow_breeze.commands.common_options import option_answer, option_dry_run, option_verbose
from airflow_breeze.commands.release_management_group import release_management_group
from airflow_breeze.utils.confirm import confirm_action
from airflow_breeze.utils.console import console_print
from airflow_breeze.utils.path_utils import AIRFLOW_ROOT_PATH
from airflow_breeze.utils.run_utils import run_command

# Pattern to match Airflow release versions starting with 3 (e.g., "3.0.5")
RELEASE_PATTERN = re.compile(r"^(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)$")


SVN_NUM_TRIES = 3


def clone_asf_repo(working_dir):
    if confirm_action("Clone ASF repo?"):
        run_command(["rm", "-rf", f"{working_dir}/asf-dist"], check=True)

        # SVN checkout with retries
        for attempt in range(SVN_NUM_TRIES):
            try:
                run_command(
                    [
                        "svn",
                        "checkout",
                        "--depth=immediates",
                        "https://dist.apache.org/repos/dist",
                        "asf-dist",
                    ],
                    check=True,
                    dry_run_override=False,
                )
                break

Review comment (suggestion):
```suggestion
# Pattern to match Airflow release versions (e.g., "3.0.5")
```

Code after:
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
from __future__ import annotations

import os
import re
import time
from subprocess import CalledProcessError

import click

from airflow_breeze.commands.common_options import option_answer, option_dry_run, option_verbose
from airflow_breeze.commands.release_management_group import release_management_group
from airflow_breeze.utils.confirm import confirm_action
from airflow_breeze.utils.console import console_print
from airflow_breeze.utils.path_utils import AIRFLOW_ROOT_PATH
from airflow_breeze.utils.run_utils import run_command

# Pattern to match Airflow release versions (e.g., "3.0.5")
RELEASE_PATTERN = re.compile(r"^(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)$")


SVN_NUM_TRIES = 3


def clone_asf_repo(working_dir):
    if confirm_action("Clone ASF repo?"):
        run_command(["rm", "-rf", f"{working_dir}/asf-dist"], check=True)

        # SVN checkout with retries
        for attempt in range(SVN_NUM_TRIES):
            try:
                run_command(
                    [
                        "svn",
                        "checkout",
                        "--depth=immediates",
                        "https://dist.apache.org/repos/dist",
                        "asf-dist",
                    ],
                    check=True,
                    dry_run_override=False,
                )
                break