Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Show more differences with upstream #18

Closed
mauritsvanrees opened this issue Jan 4, 2012 · 1 comment
Closed

Show more differences with upstream #18

mauritsvanrees opened this issue Jan 4, 2012 · 1 comment

Comments

@mauritsvanrees
Copy link

I have been using a git-specific prompt for a few months, but am now trying out vcprompt as I want this info for other vcs as well, especially when I am in a subversion checkout within a git directory as then the git-only prompt gets confusing. So thanks for creating/expanding this!

One thing in vcprompt that I am missing from the git-specific prompt, is information on files that are staged and changes that have not yet been pushed upstream. This might be useful for other distributed vcs as well. See this example:

mauritsvanrees@procyon:Products.CMFPlone (master u=) $ # launch editor, make changes
mauritsvanrees@procyon:Products.CMFPlone (master * u=) $ git st
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   docs/CHANGES.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
mauritsvanrees@procyon:Products.CMFPlone (master * u=) $ git add docs/CHANGES.txt
mauritsvanrees@procyon:Products.CMFPlone (master + u=) $ git ci -m "history"
[master 617259c] history
 1 files changed, 3 insertions(+), 0 deletions(-)
mauritsvanrees@procyon:Products.CMFPlone (master u+1) $ git st
# On branch master
# Your branch is ahead of 'plone/master' by 1 commit.
#
nothing to commit (working directory clean)

So there is a * when there are unstaged changes, a + when there are staged changes, and a +1 (or +2 etc) when there are commits that have not been pushed upstream.

With vcprompt there is only a '+' when there are unstaged changes. For the record, I have VCPROMPT_FORMAT=' (%s:%b%m%u)

The git-specific prompt is from this gist: https://gist.github.com/1240533

Would you consider adding that information? I might create a pull request if I feel up to the task, but I should not let myself get distracted from other programming tasks. ;-)

Thanks.

@djl
Copy link
Owner

djl commented Jan 4, 2012

This isn't something I'd ever use personally (in fact, I only use two or three features in vcprompt as it is), maybe somebody will find it useful.

IMO, it would probably make more sense to do this in a separate little shell script or even combine vcprompt + git bash prompt. This would be faster than having to fork out to git with Python.

For example:

VCPROMPT_FORMAT=' (%s:%b%m%u)'
GIT_PS1_SHOWUPSTREAM="verbose"
PS1="$(vcprompt)$(__git_ps1)"

I have no idea if that will work as I've never used __git_ps1 but you get the idea.

But with all that said, if you provide a pull request it'll be harder for me to immediately say no :)

@djl djl closed this as completed Jan 22, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants