Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit IDs are compared with startswith? #246

Open
Timmmm opened this issue Aug 9, 2018 · 0 comments
Open

Commit IDs are compared with startswith? #246

Timmmm opened this issue Aug 9, 2018 · 0 comments

Comments

@Timmmm
Copy link
Contributor

Timmmm commented Aug 9, 2018

I made some test data with a few commit IDs like: 1, 11, 111. If you click on the graph node for 1 you get this error:

Environment:

Request Method: GET
Request URL: http://sw02:8005/changes/?rev=483ef73342&exe=1&env=1

Django Version: 1.11.15
Python Version: 3.5.2
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.admin',
 'django.contrib.staticfiles',
 'codespeed')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')

Traceback:

File "/home/timh/.local/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/home/timh/.local/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/home/me/.local/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/home/me/.local/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/me/.local/lib/python3.5/site-packages/django/views/decorators/http.py" in inner
  40.             return func(request, *args, **kwargs)

File "/home/me/workspace/codespeed/source/codespeed-0.12.0/codespeed/views.py" in changes
  654.                 commitid__startswith=commitid, branch=branch

File "/home/me/.local/lib/python3.5/site-packages/django/db/models/manager.py" in manager_method
  85.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/home/me/.local/lib/python3.5/site-packages/django/db/models/query.py" in get
  384.             (self.model._meta.object_name, num)

Exception Type: MultipleObjectsReturned at /changes/
Exception Value: get() returned more than one Revision -- it returned 3!

It looks like commit IDs are compared with startswith??? I guess that will coincidentally work in most cases but I can't see how that is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant