git-up could be more resilient to deleted branches
velo opened this issue · 11 comments
If the remote branch get deleted I get the following error:
Marvin@marvin-note ~/contaazul
$ git up
Fetching origin
develop up to date
feature/API-2 Traceback (most recent call last):
File "/usr/bin/git-up", line 8, in <module>
load_entry_point('git-up==0.1', 'console_scripts', 'git-up')()
File "/usr/bin/gitup.py", line 294, in run
GitUp().run()
File "/usr/bin/gitup.py", line 103, in run
self.rebase_all_branches()
File "/usr/bin/gitup.py", line 138, in rebase_all_branches
if remote.commit.hexsha == branch.commit.hexsha:
File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 168, in _get_commit
obj = self._get_object()
File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 161, in _get_object
return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 115, in dereference_recursive
hexsha, ref_path = cls._get_ref_info(repo, ref_path)
File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 142, in _get_ref_info
raise ValueError("Reference at %r does not exist" % ref_path)
ValueError: Reference at 'refs/remotes/origin/feature/API-2' does not exist
Fixed in v0.2.3, you can update it via pip install -U git-up
:)
Awesome, lemme try....
...
...
...
It works my friend... many thanks!
👍
Hey man, a pattern rise up here, I need to run git up twice to get it workin
Marvin@marvin-note ~/**(release/20130620a)
$ git up
Fetching origin
develop fast-forwarding...
feature/CA-1572 Traceback (most recent call last):
File "/usr/bin/git-up", line 8, in <module>
load_entry_point('git-up==0.1', 'console_scripts', 'git-up')()
File "/usr/bin/gitup.py", line 294, in run
GitUp().run()
File "/usr/bin/gitup.py", line 103, in run
self.rebase_all_branches()
File "/usr/bin/gitup.py", line 138, in rebase_all_branches
if remote.commit.hexsha == branch.commit.hexsha:
File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 168, in _get_commit
obj = self._get_object()
File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 161, in _get_object
return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 115, in dereference_recursive
hexsha, ref_path = cls._get_ref_info(repo, ref_path)
File "/usr/lib/python2.7/site-packages/git/refs/symbolic.py", line 142, in _get_ref_info
raise ValueError("Reference at %r does not exist" % ref_path)
ValueError: Reference at 'refs/remotes/origin/feature/CA-1572' does not exist
Marvin@marvin-note ~/contaazul (develop)
$ git up
Fetching origin
develop up to date
master fast-forwarding...
release/20130620a rebasing
returning to develop
Marvin@marvin-note ~/contaazul (release/20130620a)
$
Any clues? Can I provide more information?
Very strange. Are you running the latest version of PyGitUp? What does pip show git-up
tell? In 0.2.3 (where this has been fixed), the line numbers do not match the ones from your stack trace...
Hrmmm, 0.1 o0
Marvin@marvin-note ~/contaazul (develop)
$ pip show git-up
---
Name: git-up
Version: 0.1
Location: /usr/lib/python2.7/site-packages
Requires: GitPython, colorama, termcolor
Marvin@marvin-note ~/contaazul (develop)
$ pip install -U git-up
Downloading/unpacking git-up from https://pypi.python.org/packages/source/g/git-up/git-up-0.2.3.zip#md5=192344e9988ae9ece1d16f5bcdd38d4a
Running setup.py egg_info for package git-up
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
Requirement already up-to-date: GitPython in /usr/lib/python2.7/site-packages (from git-up)
Requirement already up-to-date: colorama in /usr/lib/python2.7/site-packages (from git-up)
Requirement already up-to-date: termcolor in /usr/lib/python2.7/site-packages (from git-up)
Requirement already up-to-date: gitdb>=0.5.1 in /usr/lib/python2.7/site-packages (from GitPython->git-up)
Requirement already up-to-date: async>=0.6.1 in /usr/lib/python2.7/site-packages (from gitdb>=0.5.1->GitPython->git-up)
Requirement already up-to-date: smmap>=0.8.0 in /usr/lib/python2.7/site-packages (from gitdb>=0.5.1->GitPython->git-up)
Installing collected packages: git-up
Found existing installation: git-up 0.1
Uninstalling git-up:
Successfully uninstalled git-up
Running setup.py install for git-up
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url'
warnings.warn(msg)
changing mode of /usr/bin/gitup.py to 775
Installing git-up script to /usr/bin
Successfully installed git-up
Cleaning up...
Marvin@marvin-note ~/contaazul (develop)
$ pip show git-up
---
Name: git-up
Version: 0.1
Location: /usr/lib/python2.7/site-packages
Requires: GitPython, colorama, termcolor
Marvin@marvin-note ~/contaazul (develop)
$
Seems like this has to do with pypa/pip#709 (pip uses from old build dir).
As a workaround, try finding and removing pip's build dir (/tmp/pip-build-*
, ~/.pip
, ~/tmp/pip-build-*
or similar) and then install git-up
again.
It worked!
Many thanks!
yeap
Great :)