-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Support git unicode branches #4433
Conversation
I'm not being able to run the tests with unicode chars on branch/tag names in my local instance ( What do I need to do to be able to run these unicode tests in my local instance? (I want to be able to run them all with Py2 and Py3 using tox but also make them work when just running |
I wasn't able to make this work with |
I think we should implement something like #4442 here also as a workaround for now until we found a proper solution, since we are having different problems in production because of this issues of Unicode branches :/ |
But we aren't close to run rtd with py3 in production? |
We're now running py3 in prod, so what is the status of this PR? |
@ericholscher Unicode branches/tags are supported in production with the current code. Although, this branch also migrates the code to parse the output of So, it's still valid for a review if we want to go in that direction. |
I think it makes sense to reduce our hacky parsing when possible, especially if a library we're already using does it for us, and is almost certainly better tested and supported. |
Codecov Report
@@ Coverage Diff @@
## master #4433 +/- ##
==========================================
- Coverage 76.75% 76.71% -0.04%
==========================================
Files 158 158
Lines 10048 10038 -10
Branches 1265 1262 -3
==========================================
- Hits 7712 7701 -11
Misses 1995 1995
- Partials 341 342 +1
|
Use `gitpython` to get repository branches instead of our custom/hacky csv parser. With this change, we loose the output from `git branch -r` command shown to the user under the build output.
9f0e3f9
to
b7ab9d3
Compare
@stsewd I think that I understand that the idea is to check the differences between the
I don't really understand how it was working before my changes in this PR, but look at the following code: # This is the original code from master
# with a pdb at test_backend.py:L149
(Pdb) repo
<readthedocs.vcs_support.backends.git.Backend object at 0x7f4483b57978>
(Pdb) repo.working_dir
'/tmp/tmpjlndlpwd/local'
(Pdb) repo.tags
[<VCSVersion: /tmp/tmpi5ht05y4/sample_repo:v01, <VCSVersion: /tmp/tmpi5ht05y4/sample_repo:v02]
(Pdb) repo.branches
[<VCSVersion: /tmp/tmpi5ht05y4/sample_repo:invalidsubmodule, <VCSVersion: /tmp/tmpi5ht05y4/sample_repo:master, <VCSVersion: /tmp/tmpi5ht05y4/sample_repo:newbranch, <VCSVersion: /tmp/tmpi5ht05y4/sample_repo:relativesubmodule, <VCSVersion: /tmp/tmpi5ht05y4/sample_repo:submodule]
(Pdb) self.project.repo
'/tmp/tmpi5ht05y4/sample_repo'
(Pdb) import git
(Pdb) git.Repo(self.project.repo).tags
[<git.TagReference "refs/tags/v01">]
(Pdb) git.Repo(self.project.repo).branches
[<git.Head "refs/heads/invalidsubmodule">, <git.Head "refs/heads/master">, <git.Head "refs/heads/relativesubmodule">, <git.Head "refs/heads/submodule">]
(Pdb) local_repo
'/tmp/tmpjlndlpwd/local'
(Pdb) It doesn't make sense to me. The repo is not using the |
I think you are missing the clone step? there we clone the local repo, I'll pdb to be sure. |
I pdb and found that local path is getting a repo /tmp/tmp0d8n7ki5/local on master ⌚ 16:49:23
$ g status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Also the remote_repo /tmp/tmpmfuupwhq/sample_repo on master! ⌚ 16:50:44
$ g status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
invalidsubmodule/
relativesubmodule/
nothing added to commit but untracked files present (use "git add" to track)
repo.tags uses local repo (which is the same frmo working_dir) |
Not sure what is going on with gitpython and branches, I'll investigate |
Ok, I get it, when cloning the repo, all the branches point to origin, so, technically there aren't local branches, only remote ones. Gitpython list only local branches with repo.branches. Note that previously we were using |
Awesome! Thanks for pointing me this out. I was driving crazy and I supposed the test was wrong. I adapt my |
0f6a12d
to
999a39b
Compare
This PR is ready to merge after review. |
Use
gitpython
to get repository branches instead of our custom/hacky csv parser.With this change, we loose the output from
git branch -r
command shown to the user under the build output.These changes need more QA:
NOTE: this PR also changes how the branches are parsed and I'm not 100% sure that removing the
origin/
from its name is enough and exactly the same that we were doing beforeRef: #2997 #4052
Fixes: #3060