LA-Toth / git-repo

Automatically exported from code.google.com/p/git-repo
Apache License 2.0
0 stars 0 forks source link

"repo upload --cbr" fails with backtrace on branches created with "git checkout m/master && git checkout -b <new_name>" #156

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Affected Version:
repo version v1.12.7
       (from https://gerrit.googlesource.com/git-repo)
repo launcher version 1.20
       (from /Users/wt/bin/repo)
git version 1.8.3.4 (Apple Git-47)
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]

Environment: Mac OS X 10.8.5

What steps will reproduce the problem?
1. repo init something
2. repo sync
3. git checkout m/master
4. git checkout -b test
5. repo upload --cbr

What is the expected output? What do you see instead?
What I want:
Something like "Current branch cannot be pushed due to not having an upstream."

What I see instead is a backtrace:
$ repo upload --cbr
Traceback (most recent call last):
  File "/Users/wt/projects/gerrit_projects/manifest/.repo/repo/main.py", line 418, in <module>
    _Main(sys.argv[1:])
  File "/Users/wt/projects/gerrit_projects/manifest/.repo/repo/main.py", line 394, in _Main
    result = repo._Run(argv) or 0
  File "/Users/wt/projects/gerrit_projects/manifest/.repo/repo/main.py", line 142, in _Run
    result = cmd.Execute(copts, cargs)
  File "/Users/wt/projects/gerrit_projects/manifest/.repo/repo/subcmds/upload.py", line 450, in Execute
    self._SingleBranch(opt, pending[0][1][0], people)
  File "/Users/wt/projects/gerrit_projects/manifest/.repo/repo/subcmds/upload.py", line 179, in _SingleBranch
    project = branch.project
AttributeError: 'NoneType' object has no attribute 'project'

Please provide any additional information below.
I can actually fix the branch by execing the following:
$ git branch --set-upstream-to m/master (sets the upstream for the current 
branch to m/master)

I've attached a couple strawman patches to show options for fixing the problem. 
I am working on getting a CLA signed so that I can upload them into the gerrit 
for review.

I am also wondering if patches that don't have an upstream should just assume 
"m/master" as the upstream instead of failing.

Original issue reported on code.google.com by w...@ooyala.com on 28 Nov 2013 at 1:19

GoogleCodeExporter commented 9 years ago
I have added gerrit topics and changes for the two options.

https://gerrit-review.googlesource.com/#/q/status:open+owner:%22Warren+Turkal+%2
53Cwt%2540ooyala.com%253E%22,n,z

Original comment by w...@ooyala.com on 9 Dec 2013 at 9:51