diff --git a/pre_commit/commands/autoupdate.py b/pre_commit/commands/autoupdate.py
index 8c9fdd7..87f6d53 100644
--- a/pre_commit/commands/autoupdate.py
+++ b/pre_commit/commands/autoupdate.py
@@ -84,7 +84,9 @@ def _check_hooks_still_exist_at_rev(
         )
 
 
-REV_LINE_RE = re.compile(r'^(\s+)rev:(\s*)([^\s#]+)(.*)(\r?\n)$', re.DOTALL)
+REV_LINE_RE = re.compile(
+    r'^(\s+)rev:(\s*)([\'"]?)([^\s#]+)(.*)(\r?\n)$', re.DOTALL,
+)
 
 
 def _original_lines(
@@ -116,15 +118,15 @@ def _write_new_config(path: str, rev_infos: List[Optional[RevInfo]]) -> None:
             continue
         match = REV_LINE_RE.match(lines[idx])
         assert match is not None
-        new_rev_s = yaml_dump({'rev': rev_info.rev})
+        new_rev_s = yaml_dump({'rev': rev_info.rev}, default_style=match[3])
         new_rev = new_rev_s.split(':', 1)[1].strip()
         if rev_info.frozen is not None:
             comment = f'  # frozen: {rev_info.frozen}'
-        elif match[4].strip().startswith('# frozen:'):
+        elif match[5].strip().startswith('# frozen:'):
             comment = ''
         else:
-            comment = match[4]
-        lines[idx] = f'{match[1]}rev:{match[2]}{new_rev}{comment}{match[5]}'
+            comment = match[5]
+        lines[idx] = f'{match[1]}rev:{match[2]}{new_rev}{comment}{match[6]}'
 
     with open(path, 'w', newline='') as f:
         f.write(''.join(lines))
diff --git a/pre_commit/util.py b/pre_commit/util.py
index 2db579a..0338b37 100644
--- a/pre_commit/util.py
+++ b/pre_commit/util.py
@@ -36,10 +36,11 @@ yaml_load = functools.partial(yaml.load, Loader=Loader)
 Dumper = getattr(yaml, 'CSafeDumper', yaml.SafeDumper)
 
 
-def yaml_dump(o: Any) -> str:
+def yaml_dump(o: Any, **kwargs: Any) -> str:
     # when python/mypy#1484 is solved, this can be `functools.partial`
     return yaml.dump(
         o, Dumper=Dumper, default_flow_style=False, indent=4, sort_keys=False,
+        **kwargs,
     )
 
 

Any scalar quotes around rev are lost during autoupdate
#### Steps to reproduce

Example `.pre-commit-config.yaml`:
```
repos:
-   repo: 'https://github.com/pre-commit/pre-commit-hooks'
    rev: 'v2.4.0'
    hooks:
    -   id: 'trailing-whitespace'
    -   id: 'end-of-file-fixer'
    -   id: 'check-yaml'
    -   id: 'check-added-large-files'
```

Run 
```
$ pre-commit autoupdate
Updating https://github.com/pre-commit/pre-commit-hooks ... updating v2.4.0 -> v2.5.0.
```

`.pre-commit-config.yaml` after:
```
repos:
  - repo: 'https://github.com/pre-commit/pre-commit-hooks'
    rev: v2.5.0
    hooks:
      - id: 'trailing-whitespace'
      - id: 'end-of-file-fixer'
      - id: 'check-yaml'
      - id: 'check-added-large-files'
```
Any wrapping quotes (single or double) around the `rev` value are lost during the update

I noticed this when I turned on the `quoted-strings` [yamllint rule](https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.quoted_strings) and set it to `required` to be consistent with our internal YAML coding conventions
diff --git a/tests/commands/autoupdate_test.py b/tests/commands/autoupdate_test.py
index fbeee72..bd89c1d 100644
--- a/tests/commands/autoupdate_test.py
+++ b/tests/commands/autoupdate_test.py
@@ -474,3 +474,23 @@ def test_updates_old_format_to_new_format(tmpdir, capsys, store):
     )
     out, _ = capsys.readouterr()
     assert out == 'Configuration has been migrated.\n'
+
+
+def test_maintains_rev_quoting_style(tmpdir, out_of_date, store):
+    fmt = (
+        'repos:\n'
+        '-   repo: {path}\n'
+        '    rev: "{rev}"\n'
+        '    hooks:\n'
+        '    -   id: foo\n'
+        '-   repo: {path}\n'
+        "    rev: '{rev}'\n"
+        '    hooks:\n'
+        '    -   id: foo\n'
+    )
+    cfg = tmpdir.join(C.CONFIG_FILE)
+    cfg.write(fmt.format(path=out_of_date.path, rev=out_of_date.original_rev))
+
+    assert autoupdate(str(cfg), store, freeze=False, tags_only=False) == 0
+    expected = fmt.format(path=out_of_date.path, rev=out_of_date.head_rev)
+    assert cfg.read() == expected

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.9
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
cfgv==3.4.0
covdefaults==2.3.0
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
filelock==3.18.0
identify==2.6.9
iniconfig==2.1.0
nodeenv==1.9.1
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
-e git+https://github.com/pre-commit/pre-commit.git@f455312944c1a26f03ee79c17ae9d69ecf2c78c3#egg=pre_commit
pytest==8.3.5
pytest-env==1.1.5
PyYAML==6.0.2
toml==0.10.2
tomli==2.2.1
virtualenv==20.29.3

name: pre-commit
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - cfgv==3.4.0
      - covdefaults==2.3.0
      - coverage==7.8.0
      - distlib==0.3.9
      - exceptiongroup==1.2.2
      - filelock==3.18.0
      - identify==2.6.9
      - iniconfig==2.1.0
      - nodeenv==1.9.1
      - packaging==24.2
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-env==1.1.5
      - pyyaml==6.0.2
      - toml==0.10.2
      - tomli==2.2.1
      - virtualenv==20.29.3
prefix: /opt/conda/envs/pre-commit

tests/commands/autoupdate_test.py::test_maintains_rev_quoting_style
tests/commands/autoupdate_test.py::test_rev_info_from_config tests/commands/autoupdate_test.py::test_rev_info_update_up_to_date_repo tests/commands/autoupdate_test.py::test_rev_info_update_out_of_date_repo tests/commands/autoupdate_test.py::test_rev_info_update_non_master_default_branch tests/commands/autoupdate_test.py::test_rev_info_update_tags_even_if_not_tags_only tests/commands/autoupdate_test.py::test_rev_info_update_tags_only_does_not_pick_tip tests/commands/autoupdate_test.py::test_rev_info_update_freeze_tag tests/commands/autoupdate_test.py::test_rev_info_update_does_not_freeze_if_already_sha tests/commands/autoupdate_test.py::test_autoupdate_up_to_date_repo tests/commands/autoupdate_test.py::test_autoupdate_old_revision_broken tests/commands/autoupdate_test.py::test_autoupdate_out_of_date_repo tests/commands/autoupdate_test.py::test_autoupdate_only_one_to_update tests/commands/autoupdate_test.py::test_autoupdate_out_of_date_repo_with_correct_repo_name tests/commands/autoupdate_test.py::test_autoupdate_out_of_date_repo_with_wrong_repo_name tests/commands/autoupdate_test.py::test_does_not_reformat tests/commands/autoupdate_test.py::test_does_not_change_mixed_endlines_read tests/commands/autoupdate_test.py::test_does_not_change_mixed_endlines_write tests/commands/autoupdate_test.py::test_loses_formatting_when_not_detectable tests/commands/autoupdate_test.py::test_autoupdate_tagged_repo tests/commands/autoupdate_test.py::test_autoupdate_freeze tests/commands/autoupdate_test.py::test_autoupdate_tags_only tests/commands/autoupdate_test.py::test_autoupdate_latest_no_config tests/commands/autoupdate_test.py::test_hook_disppearing_repo_raises tests/commands/autoupdate_test.py::test_autoupdate_hook_disappearing_repo tests/commands/autoupdate_test.py::test_autoupdate_local_hooks tests/commands/autoupdate_test.py::test_autoupdate_local_hooks_with_out_of_date_repo tests/commands/autoupdate_test.py::test_autoupdate_meta_hooks tests/commands/autoupdate_test.py::test_updates_old_format_to_new_format
pre_commit/commands/autoupdate.py pre_commit/util.py
pre_commit/commands/autoupdate.py pre_commit/util.py