Giter Site home page Giter Site logo

nailgun / unpushed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from eapen/uncommitted

30.0 1.0 4.0 57 KB

Command-line tool to scan a filesystem for uncommitted and unpushed version control changes

Home Page: http://pypi.python.org/pypi/unpushed

License: MIT License

Python 100.00%

unpushed's Introduction

unpushed

Scan version control for uncommitted and unpushed changes

This is fork of "uncommitted" project originally created by Brandon Rhodes.

"unpushed" adds some features:

  • support for checking branches for unpushed commits,
  • desktop notification.

Preface from original author

When working on one version-controlled project on my hard drive, I often flip over quickly to another project to make a quick change. By the end of the day I have forgotten about that other change and often find it months later when I enter that repository again. I needed a way to be alerted at the end of each day about any uncommitted changes sitting around on my system.

Thus was born this "uncommitted" script: using either your system locate(1) command or by walking a filesystem tree on its own, it will find version controlled directories and print a report on the standard output about any uncommitted changes still sitting on your drive. By running it from a cron(8) job you can make this notification routine.

Running "unpushed"

By default "unpushed" uses the locate(1) command to scan for repositories, which means that it can operate quickly even over very large filesystems like my home directory:

$ unpushed ~

But you should be warned: because the locate(1) database is only updated once a day on most systems, this will miss repositories which you have created since its last run. To be absolutely sure to see all current repositories, you should instead ask "unpushed" to search the filesystem tree itself. To do this on your "devel" directory, for example, you would type this:

$ unpushed -w ~/devel

Not only will the output of "-w" always be up-to-date, but it is usually faster for small directory trees. The default behavior of using locate(1) (which can also be explicitly requested, with "-l") is faster when the directory tree you are searching is very large.

Should you ever want a list of all repositories, and not just those with uncommitted changes, you can use the "-a" option:

$ unpushed -a ~

Also you can list exact files or braches was changed using the "-v" verbose option:

$ unpushed -v ~

You can always get help by running "unpushed" without arguments or with the "-h" or "--help" options.

Desktop notification

Application use system depended desktop notification facility. To show desktop notification run this command:

$ unpushed-notify ~

On Linux this is done through pynotify library. On OS X through pyobjc. On other systems this feature is not implemented yet.

You can add this line to your crontab (crontab -e):

*/10 18-20 * * *   unpushed-notify ~

This will show you notification about uncommitted and unpushed changes every 10 minutes starting from 6pm ending at 8pm.

Do not forget to add unpushed-notify to cron PATH!

Supported VCs

At the moment, "unpushed" supports:

TODO

  • Check svn existence before using it
  • Check locate existence before using it

Changelog

1.2.0 (2017 Sep 25)

  • Python 3 Migration

1.1.0 (2012 May 22)

  • Fix README markup
  • Report untracked files separately
  • Add -t option to ignore untracked files
  • Show not pushed changesets in Mercurial. Thanks Guilherme Gondim for testing

1.0.2 (2012 April 27)

  • Fix setup script

unpushed's People

Contributors

andor-pierdelacabeza avatar eapen avatar emkaroly avatar jamesdh avatar nailgun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

unpushed's Issues

crashes without mercurial installed

On encoutering folder with .hg subfolder this script attempts to call mercurial. If mercurial is not installed (may be typical today as git seems to won version control wars) this script crashes.

I would expect error message or even better - complaint ans skipping over such repository.

To reproduce - uninstall mercurial (if any is available), create folder, create subfolder named .hg, call this script to check location where test folder were created.

Traceback (most recent call last):
  File "/usr/local/bin/unpushed", line 9, in <module>
    load_entry_point('unpushed==1.1.0', 'console_scripts', 'unpushed')()
  File "/usr/local/lib/python2.7/dist-packages/unpushed/command.py", line 52, in main
    for status in scanner.scan_repos(repos, ignore_untracked=options.ignore_untracked):
  File "/usr/local/lib/python2.7/dist-packages/unpushed/scanner.py", line 61, in scan_repos
    for status in get_statuses(path, ignore_set, **options):
  File "/usr/local/lib/python2.7/dist-packages/unpushed/repos.py", line 11, in mercurial
    process = Popen(('hg', 'st'), stdout=PIPE, cwd=path)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

Bug is present also in parent - see eapen#7

Please add a license file

Can you please add a LICENSE file or at least mention licensing somewhere so people can know if it's ok to package/fork/etc?

fatal: bad revision 'master'

Not sure what it is caused by, but each time I run it I'll get a lot of this messages. I suppose it's always for unchanged repositories.

$ uname -a
Darwin picasso.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
$ python --version
Python 2.7.7
$ git --version
git version 2.0.0

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.