diff --git a/asv/commands/profiling.py b/asv/commands/profiling.py
index afabf6c..8028862 100644
--- a/asv/commands/profiling.py
+++ b/asv/commands/profiling.py
@@ -13,7 +13,7 @@ import tempfile
 
 from . import Command
 from ..benchmarks import Benchmarks
-from ..console import log
+from ..console import log, color_print
 from ..environment import get_environments, is_existing_only
 from ..machine import Machine
 from ..profiling import ProfilerGui
@@ -123,8 +123,10 @@ class Profile(Command):
 
         machine_name = Machine.get_unique_machine_name()
         if revision is None:
-            revision = conf.branches[0]
-        commit_hash = repo.get_hash_from_name(revision)
+            rev = conf.branches[0]
+        else:
+            rev = revision
+        commit_hash = repo.get_hash_from_name(rev)
 
         profile_data = None
         checked_out = set()
@@ -192,6 +194,8 @@ class Profile(Command):
 
                 profile_data = results.get_profile(benchmark_name)
 
+        log.flush()
+
         if gui is not None:
             log.debug("Opening gui {0}".format(gui))
             with temp_profile(profile_data) as profile_path:
@@ -200,6 +204,7 @@ class Profile(Command):
             with io.open(output, 'wb') as fd:
                 fd.write(profile_data)
         else:
+            color_print('')
             with temp_profile(profile_data) as profile_path:
                 stats = pstats.Stats(profile_path)
                 stats.sort_stats('cumulative')

"asv profile" broken with existing environment
```
$ asv profile -E existing comm.Transfer.time_tcp_large_transfers_uncompressible
· An explicit revision may not be specified when using an existing environment.
```

Same with:
```
$ asv profile --python=same comm.Transfer.time_tcp_large_transfers_uncompressible
· An explicit revision may not be specified when using an existing environment.
```

I also tried with:
```
asv run --python=same --profile -b time_tcp_large_transfers_uncompressible
```
which doesn't seem to save a profile output anywhere.

This is with asv version 0.2.1.
diff --git a/test/test_dev.py b/test/test_dev.py
index 0d188d9..48453fe 100644
--- a/test/test_dev.py
+++ b/test/test_dev.py
@@ -42,6 +42,7 @@ def generate_basic_conf(tmpdir, repo_subdir=''):
         'html_dir': 'html',
         'repo': repo_path,
         'project': 'asv',
+        'branches': ['master'],
         'matrix': {
             "six": [None],
             "colorama": ["0.3.6", "0.3.7"],

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-xdist
apt-get update apt-get install -y gcc
3.6
pip_requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
-e git+https://github.com/airspeed-velocity/asv.git@c9560bd78defaf02eecefc43e54953c10fb3a0d8#egg=asv
attrs==22.2.0
Babel==2.11.0
certifi==2021.5.30
charset-normalizer==2.0.12
docutils==0.18.1
execnet==1.9.0
idna==3.10
imagesize==1.4.1
importlib-metadata==4.8.3
iniconfig==1.1.1
Jinja2==3.0.3
MarkupSafe==2.0.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
Pygments==2.14.0
pyparsing==3.1.4
pytest==7.0.1
pytest-xdist==3.0.2
pytz==2025.2
requests==2.27.1
six==1.17.0
snowballstemmer==2.2.0
Sphinx==5.3.0
sphinx-bootstrap-theme==0.8.1
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.26.20
zipp==3.6.0

name: asv
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
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - 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=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - attrs==22.2.0
      - babel==2.11.0
      - charset-normalizer==2.0.12
      - docutils==0.18.1
      - execnet==1.9.0
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - jinja2==3.0.3
      - markupsafe==2.0.1
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pygments==2.14.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-xdist==3.0.2
      - pytz==2025.2
      - requests==2.27.1
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==5.3.0
      - sphinx-bootstrap-theme==0.8.1
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.26.20
      - zipp==3.6.0
prefix: /opt/conda/envs/asv

test/test_dev.py::test_profile_python_same
test/test_dev.py::test_dev test/test_dev.py::test_dev_with_repo_subdir test/test_dev.py::test_run_python_same test/test_dev.py::test_dev_python_arg test/test_dev.py::test_run_steps_arg
asv/commands/profiling.py
asv/commands/profiling.py