Giter Site home page Giter Site logo

vcprompt's Issues

missing timer.cancel() in main

Since 3ecd930, specifying a timeout actually causes vcprompt to run for exactly that many milliseconds. Tested on Python 2.7.1 in OS X. Patch based on 6a10066:

diff --git a/bin/vcprompt b/bin/vcprompt
index e8880f1..9e1dbb6 100755
--- a/bin/vcprompt
+++ b/bin/vcprompt
@@ -235,6 +235,7 @@ def main():
     output = vcprompt(options)
     if options.newline:
         output += '\n'
+    timer.cancel()
     return output

Syntax Error

When I added vcprompt to my prompt, I keep seeing this error

File "/home/nomad/bin/vcprompt", line 541                                     
    from __future__ import with_statement
SyntaxError: from __future__ imports must occur at the beginning of the file

Prompt refuses to update when changing directories

As the title suggests, whenever I cd into a directory that has version control in it, my prompt never updates to reflect that. I've followed the Install instructions verbatim:

$ curl -sL https://github.com/xvzf/vcprompt/raw/master/bin/vcprompt > ~/bin/vcprompt
$ chmod 755 ~/bin/vcprompt
$ export PS1="$(vcprompt) $PS1"

I then cd into any project directory covered by svn, git, or hg (I've tried all three). Just running the command correctly tells me any information:

$ vcprompt
svn:trunk

However, my prompt still stays as $. If I wait to run the export PS1="$(vcprompt) $PS1" line until I'm in a project directory already, then the prompt is correctly updated to be svn:trunk $. However, that svn:trunk stays in the front frozen like that no matter what I cd into from that point on. So even moving to my home directory still shows svn:trunk $ as my prompt.

This occurs both on my OSX and Ubuntu workstations. Both are running Python version 2.6.x. Both are using bash as the shell. To prevent any conflicts, I've made sure that the only line in my .bash_profile or .bashrc has been adding ~/bin to my $PATH.

Do you have any idea what might be causing this?

OSError: [Errno 2] No such file or directory and others errors

Today, when I update my Ubuntu 12.10 x64, I receive this message:

Traceback (most recent call last):
  File "/bin/vcprompt", line 672, in <module>
    prompt = main()
  File "/bin/vcprompt", line 226, in main
    output = vcprompt(options)
  File "/bin/vcprompt", line 179, in vcprompt
    conf = vcs(options)
  File "/bin/vcprompt", line 621, in svn
    process = Popen(command.split(), stdout=PIPE, stderr=PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1259, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

My prompt is: PS1="\n\u@\h:\w $(vcprompt -f '%b%m%u')\n> "

Anyway, thanks.

Show more differences with upstream

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.

SyntaxError: invalid syntax

I get this when I try to use vcprompt

[code]
File "/usr/bin/vcprompt", line 284
with open(file, 'r') as f:
^
SyntaxError: invalid syntax
[/code]

vcprompt explodes in newly-inited git repository

To see this problem simply do the following:

  1. mkdir vctest
  2. cd vctest
  3. git init
  4. If vcprompt is in your prompt you will already see the problem, else just run vcprompt

Here's the error:

~/S/P/test ♪ vcprompt
Traceback (most recent call last):
  File "/Users/bjeanes/.config/misc/vcprompt.py", line 676, in <module>
    print main()
  File "/Users/bjeanes/.config/misc/vcprompt.py", line 298, in main
    systems=options.systems, unknown=options.unknown)
  File "/Users/bjeanes/.config/misc/vcprompt.py", line 234, in vcprompt
    prompt = vcs(path, format, unknown)
  File "/Users/bjeanes/.config/misc/vcprompt.py", line 524, in git
    with open(hash_file, 'r') as f:
IOError: [Errno 2] No such file or directory: '/Users/bjeanes/Sites/Personal/test/.git/refs/heads/master'

suggestion: svn shows modified properties on 2nd column

From svn st --help:

Second column: Modifications of a file's or directory's properties
' ' no modifications
'C' Conflicted
'M' Modified

I realize it's debatable whether a changed property is a modification, but I lean towards calling it a modification since this indicates there is something in the working copy that should be checked-in.

support for git stash

In git, another important local status is whether there is something in the stash. Unfortunately, forgetting this status is all too easy...

vcprompt slow on large repos

Notable test case: https://github.com/mozilla/mozilla-central

This has been mentioned before other places, but I wonder if there is any way for vcprompt to auto-detect when it's "taking too long". I would rather not have to try to modify my ps1 depending on the directory.

1589 glind ~/gits/mozilla-central [git:master?] $ time vcprompt 
[git:master?] 
real    0m3.476s
user    0m0.421s
sys 0m1.610s

1590 glind ~/gits/mozilla-central [git:master?] $ time git status

real    0m6.032s
user    0m0.556s
sys 0m1.389s

Git prompt doesn't update until .bashrc runs

Here is an excerpt from my prompt. I am using Mac OS X 10.8.5 with a slightly customized prompt in .basrc.

Last login: Sun Sep 22 13:48:13 on ttys000

!me@~/t:someotherbranch+? !> brew list
autoconf    git     libtool     pkg-config
automake    libgpg-error    libyaml     readline
bash-completion libksba     openssl     vcprompt

!me@~/t:someotherbranch+? !> git --version
git version 1.8.4

!me@~ !> cd t

!me@~/t !> source ~/.bashrc

!me@~/t:master+? !> git checkout -b someotherbranch
M   a1.txt
Switched to a new branch 'someotherbranch'

!me@~/t:master+? !> source ~/.bashrc

!me@~/t:someotherbranch+? !> 

.bashrc

PS1="\n!\u@\w$(vcprompt -f ":%b%m%u") !> "
PS2=" !> "
PS3=" !> "
PS4=" !> "

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting

If %s is specified in the format, strange output is given

On Mac OS X 10.6 with stock python (2.6.1):

e.g.:

$ vcprompt --format "%s:%b" # In a non-versioned folder, with format
[m:"
$ vcprompt --format "%s:%b" # In a versioned folder, with format
[m:"git:master
$ vcprompt # In a versioned folder, without format
git:master

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.