airspeed-velocity / asv

Airspeed Velocity: A simple Python benchmarking tool with web-based reporting
https://asv.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
875 stars 180 forks source link

git checkout error with previously tracked files #164

Closed snorfalorpagus closed 9 years ago

snorfalorpagus commented 9 years ago

I'm trying to create a benchmarking suite for the Shapely module.

Shapely uses cython to link to an external shared library. For those not familiar with this, a .pyx file (written in a superset of the python language) is parsed into a .c file, which is then compiled. In older versions of Shapely the .c file produced was included in the repository, so that people without cython installed could still build the C extension. In more recent versions of the repository the .c file is not included, and must be regenerated (done in setup.py). This seems to cause problems for asv - see the error below. Here a more recent commit has caused the creation of the .c file, which then causes git to complain as it refuses to then checkout data that would overwrite some uncomitted data.

Is it possible to get asv to run a custom command between checkouts via a hook or similar, so that this file could be deleted if it already exists (with git reset?).

Current, without _speedups.c: https://github.com/Toblerity/Shapely/tree/0bd4a08bbd110f84573f54190e9fd4070b02ab0e/shapely/speedups Old, with _speedups.c: https://github.com/Toblerity/Shapely/tree/b4fb903ba957f84f286e2387987166415d3d19e1/shapely/speedups

[ 76.00%] · For Shapely commit hash 1b56b38e:
[ 76.00%] ·· Error running /usr/bin/git checkout 1b56b38e32c7d70c126d6df45a4e977a4380df49
             STDOUT -------->

             STDERR -------->
             error: The following untracked working tree files would be overwritten by checkout:
                shapely/speedups/_speedups.c
             Please move or remove them before you can switch branches.
             Aborting
Traceback (most recent call last):
  File "/usr/local/bin/asv", line 9, in <module>
    load_entry_point('asv==0.1', 'console_scripts', 'asv')()
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asv-0.1-py2.7.egg/asv/main.py", line 36, in main
    result = args.func(args)
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asv-0.1-py2.7.egg/asv/commands/__init__.py", line 45, in run_from_args
    return cls.run_from_conf_args(conf, args)
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asv-0.1-py2.7.egg/asv/commands/run.py", line 130, in run_from_conf_args
    dry_run=args.dry_run, machine=args.machine
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asv-0.1-py2.7.egg/asv/commands/run.py", line 225, in run
    repo.checkout(commit_hash)
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asv-0.1-py2.7.egg/asv/plugins/git.py", line 68, in checkout
    self._run_git(['checkout', branch])
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asv-0.1-py2.7.egg/asv/plugins/git.py", line 50, in _run_git
    [self._git] + args, **kwargs)
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/asv-0.1-py2.7.egg/asv/util.py", line 329, in check_output
    raise ProcessError(args, retcode, stdout, stderr)
asv.util.ProcessError: Command '/usr/bin/git checkout 1b56b38e32c7d70c126d6df45a4e977a4380df49' returned non-zero exit status 1
mdboom commented 9 years ago

I think doing git reset --hard instead of git checkout might work to go between branches. Can you try out #172 (not tested in the context of your project).

mdboom commented 9 years ago

Closed by #172.

snorfalorpagus commented 9 years ago

Confirmed that https://github.com/spacetelescope/asv/pull/172 fixes this. Thanks!