Skip to content

Commit

Permalink
Merge pull request #1209 from NickCrews/patch-1
Browse files Browse the repository at this point in the history
BUG: Allow branches that conflict with file names
  • Loading branch information
mattip committed May 21, 2023
2 parents 15075b7 + 848d666 commit a4a874e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ install:
- conda update conda -y
- conda install -q --yes python=%PYTHON_VERSION% conda pip pytest pytest-xdist pytest-timeout filelock selenium conda-build bzip2 pympler rpy2
- python -m pip install -U pip
- python -m pip install pytest-rerunfailures json5 pympler tabulate colorama
- python -m pip install pytest-rerunfailures json5 pympler tabulate colorama virtualenv

# Check that we have the expected version of Python
- python --version
Expand Down
2 changes: 1 addition & 1 deletion asv/plugins/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def get_date(self, hash):
def get_hashes_from_range(self, range_spec):
args = ['rev-list', '--first-parent']
if range_spec != "":
args += shlex.split(range_spec)
args += shlex.split(range_spec) + ["--"]
output = self._run_git(args, valid_return_codes=(0, 1), dots=False)
return output.strip().split()

Expand Down
27 changes: 27 additions & 0 deletions test/test_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import datetime
import os
import shutil
import subprocess
import xml.etree.ElementTree as etree
from os.path import abspath, dirname, join, isfile, isdir

import json5
import pytest

try:
Expand Down Expand Up @@ -432,3 +434,28 @@ def test_regression_atom_feed_update(dvcs_type, tmpdir):
a_content = a.find('{http://www.w3.org/2005/Atom}content')
b_content = b.find('{http://www.w3.org/2005/Atom}content')
assert a_content.text != b_content.text

def test_branch_name_is_also_filename(tmpdir):
# gh-1209
tmpdir = str(tmpdir)
dvcs = tools.generate_test_repo(tmpdir, list(range(10)),
dvcs_type="git",
extra_branches=[(f"{util.git_default_branch()}~4",
"benchmarks", [11, 12, 13])])
subprocess.run(["asv", "quickstart", "--top-level"],
cwd=dvcs.path, check=True)
with open(f"{dvcs.path}/asv.conf.json", 'r+') as fhandle:
conf = json5.load(fhandle)
conf["branches"] = ["benchmarks"]
conf["dvcs"] = "git"
fhandle.seek(0)
json5.dump(conf, fhandle, indent=4)
fhandle.truncate()
subprocess.run(["asv", "machine", "--yes"],
cwd=dvcs.path, check=False)
subprocess.run(["asv", "run"],
cwd=dvcs.path, check=False)
retdat = subprocess.run(["asv", "publish"], cwd=dvcs.path,
capture_output=True, text=True)
assert "git rev-list --first-parent benchmarks" not in retdat.stderr
assert retdat.returncode == 0

0 comments on commit a4a874e

Please sign in to comment.