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

[gitstatus.py] Use --porcelain to make faster in using python #65

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

wkentaro
Copy link

Get files' status by parsing output of git status --porcelain to make it faster.

@wkentaro wkentaro force-pushed the fast-python-gitstatus-using-porcelain branch from 8cb257a to 0d5a3f5 Compare June 28, 2015 09:50
@wkentaro wkentaro force-pushed the fast-python-gitstatus-using-porcelain branch 2 times, most recently from c0e5025 to f95d5b5 Compare June 28, 2015 16:25
@mcornella
Copy link

Hi @wkentaro, I'm using your modification in ohmyzsh/ohmyzsh#4205 because it is the best one here.
You could simplify further by using git status --porcelain -b which shows the remote branch info (including ahead and behind commits):

$ git status --porcelain -b
## fix-git-prompt-plugin...origin/fix-git-prompt-plugin [ahead 2, behind 2]

@wkentaro
Copy link
Author

wkentaro commented Aug 1, 2015

Ok, thanks.

@wkentaro
Copy link
Author

wkentaro commented Aug 2, 2015

I sent PR: mcornella/ohmyzsh#2

@wkentaro wkentaro force-pushed the fast-python-gitstatus-using-porcelain branch from c0ef3dc to 7efd692 Compare August 3, 2015 21:52
@mcornella
Copy link

@olivierverdier I can confirm this works perfectly, and it only uses one call to git instead of 4-5 of before.
👍

@mcornella
Copy link

I had to push a patch to make this work for UTF-8 locales, see mcornella/ohmyzsh@b289beb and ohmyzsh/ohmyzsh#4205 (comment).

@wkentaro
Copy link
Author

wkentaro commented Aug 9, 2015

Thanks. I updated.

@mcornella
Copy link

There are some other caveats with the git status --porcelain -b command. See ohmyzsh/ohmyzsh#4205 (comment)

@wkentaro
Copy link
Author

Thanks, I updated.

@wkentaro wkentaro force-pushed the fast-python-gitstatus-using-porcelain branch 2 times, most recently from 425e7df to 884a449 Compare August 11, 2015 11:24
@wkentaro wkentaro force-pushed the fast-python-gitstatus-using-porcelain branch from 884a449 to 825f8ad Compare August 11, 2015 11:37
@wkentaro
Copy link
Author

I think this PR should be merged after ohmyzsh/ohmyzsh#4205 is merged.
So plz wait for it.

After it is merged, I will update all same commits to this PR.

@wkentaro
Copy link
Author

ohmyzsh/ohmyzsh#4205
is merged and updated the commits. Please review and merge.

pedantic79 added a commit to pedantic79/bash-git-prompt that referenced this pull request Sep 20, 2015
pedantic79 added a commit to pedantic79/bash-git-prompt that referenced this pull request Sep 20, 2015
@wkentaro wkentaro force-pushed the fast-python-gitstatus-using-porcelain branch 21 times, most recently from 65cdd90 to 526fd76 Compare October 25, 2015 15:43
@wkentaro
Copy link
Author

@olivierverdier
I added test suite on travis.yml. It tests

  • output of gitstatus.py
  • speed of gitstatus.py

it compares the speed with gitstatus.py at 9f0da67.

@wkentaro wkentaro force-pushed the fast-python-gitstatus-using-porcelain branch from 526fd76 to ab7512a Compare October 25, 2015 15:49
@wkentaro
Copy link
Author

wkentaro commented Nov 2, 2015

ping

@olivierverdier
Copy link
Owner

Thanks for the update. I wrote some comments in the commit. Basically, I think that we need unit tests as well.

@wkentaro
Copy link
Author

wkentaro commented Nov 3, 2015

Ok so you mean we should split the code in gitstatus.py and test each functions?

@olivierverdier
Copy link
Owner

Yes, exactly. (sorry for the late answer)

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

Successfully merging this pull request may close these issues.

3 participants