Browse Source

'project' -> 'repo' in some places

tags/v0.1
Ben Kurtovic 13 years ago
parent
commit
67e3188d43
3 changed files with 29 additions and 30 deletions
  1. +15
    -15
      README.md
  2. +12
    -13
      gitup.py
  3. +2
    -2
      setup.py

+ 15
- 15
README.md View File

@@ -1,8 +1,8 @@
__gitup__ (the _git-repo-updater_) __gitup__ (the _git-repo-updater_)


gitup is a tool designed to pull to a large number of git repositories at once. gitup is a tool designed to pull to a large number of git repositories at once.
It is smart enough to ignore projects with dirty working directories, and
provides a great way to get everything up-to-date for those short periods of
It is smart enough to ignore repos with dirty working directories, and provides
a (hopefully) great way to get everything up-to-date for those short periods of
internet access between long periods of none. internet access between long periods of none.


gitup works on both OS X and Linux. You should have the latest version of git gitup works on both OS X and Linux. You should have the latest version of git
@@ -27,25 +27,25 @@ Finally, simply delete the `git-repo-updater` directory, and you're done!


# Usage # Usage


There are two ways to update projects: you can pass them as command arguments,
There are two ways to update repos: you can pass them as command arguments,
or save them as "bookmarks". or save them as "bookmarks".


For example: For example:


gitup ~/projects/foo ~/projects/bar ~/projects/baz
gitup ~/repos/foo ~/repos/bar ~/repos/baz


...will automatically pull to the `foo`, `bar`, and `baz` git repositories if ...will automatically pull to the `foo`, `bar`, and `baz` git repositories if
their working directories are clean (to avoid merge conflicts). Additionally, their working directories are clean (to avoid merge conflicts). Additionally,
you can just type: you can just type:


gitup ~/projects
gitup ~/repos


...to automatically update all git repositories in that directory. ...to automatically update all git repositories in that directory.


To add a bookmark (or bookmarks), either of these will work: To add a bookmark (or bookmarks), either of these will work:


gitup --add ~/projects/foo ~/projects/bar ~/projects/baz
gitup --add ~/projects
gitup --add ~/repos/foo ~/repos/bar ~/repos/baz
gitup --add ~/repos


Then, to update (pull to) all of your bookmarks, just run gitup without args: Then, to update (pull to) all of your bookmarks, just run gitup without args:


@@ -53,7 +53,7 @@ Then, to update (pull to) all of your bookmarks, just run gitup without args:


Deleting a bookmark is as easy as adding one: Deleting a bookmark is as easy as adding one:


gitup --delete ~/projects
gitup --delete ~/repos


Want to view your current bookmarks? Simple: Want to view your current bookmarks? Simple:


@@ -61,12 +61,12 @@ Want to view your current bookmarks? Simple:


You can mix and match bookmarks and command arguments: You can mix and match bookmarks and command arguments:


gitup --add ~/projects/foo ~/projects/bar
gitup ~/projects/baz # update 'baz' only
gitup # update 'foo' and 'bar' only
gitup ~/projects/baz --update # update all three!
gitup --add ~/repos/foo ~/repos/bar
gitup ~/repos/baz # update 'baz' only
gitup # update 'foo' and 'bar' only
gitup ~/repos/baz --update # update all three!


Want to update all git projects in your current directory?
Want to update all git repositories in your current directory?


gitup . gitup .


@@ -74,5 +74,5 @@ For a list of all command arguments and abbreviations:


gitup --help gitup --help


Finally, all paths can be either absolute (e.g. /path/to/project) or relative
(e.g. ../my/project).
Finally, all paths can be either absolute (e.g. /path/to/repo) or relative
(e.g. ../my/repo).

+ 12
- 13
gitup.py View File

@@ -63,11 +63,11 @@ def get_tail_name(path):
return os.path.split(path)[1] return os.path.split(path)[1]


def update_repository(repo_path, repo_name): def update_repository(repo_path, repo_name):
"""Update a single git project by pulling from the remote repository."""
"""Update a single git repository by pulling from the remote."""
out(1, "{}{}{}:".format(ansi['bold'], repo_name, ansi['reset'])) out(1, "{}{}{}:".format(ansi['bold'], repo_name, ansi['reset']))
os.chdir(repo_path) # cd into the project folder so git commands target the
# correct repo
os.chdir(repo_path) # cd into our folder so git commands target the correct
# repo
try: try:
dry_fetch = exec_shell("git fetch --dry-run") # check if there is dry_fetch = exec_shell("git fetch --dry-run") # check if there is
@@ -101,13 +101,13 @@ def update_repository(repo_path, repo_name):
else: else:
out(2, """{}Warning:{} You have uncommitted changes in this out(2, """{}Warning:{} You have uncommitted changes in this
project!""".format(ansi['red'], ansi['reset']))
repository!""".format(ansi['red'], ansi['reset']))
out(2, "Ignoring.") out(2, "Ignoring.")


def update_directory(dir_path, dir_name, is_bookmark=False): def update_directory(dir_path, dir_name, is_bookmark=False):
"""First, make sure the specified object is actually a directory, then """First, make sure the specified object is actually a directory, then
determine whether the directory is a git project on its own or a directory
of git projects. If the former, update the single repository; if the
determine whether the directory is a git repo on its own or a directory
of git repositories. If the former, update the single repository; if the
latter, update all repositories contained within.""" latter, update all repositories contained within."""
if is_bookmark: if is_bookmark:
dir_source = "Bookmark" # where did we get this directory from? dir_source = "Bookmark" # where did we get this directory from?
@@ -247,19 +247,18 @@ def list_bookmarks():


def main(): def main():
"""Parse arguments and then call the appropriate function(s).""" """Parse arguments and then call the appropriate function(s)."""
parser = argparse.ArgumentParser(description="""Easily and intelligently
pull to multiple git projects at once.""", epilog="""Both relative
and absolute paths are accepted by all arguments. Questions?
Comments? Email the author at {}.""".format(__email__),
add_help=False)
parser = argparse.ArgumentParser(description="""Easily pull to multiple git
repositories at once.""", epilog="""Both relative and absolute
paths are accepted by all arguments. Questions? Comments? Email the
author at {}.""".format(__email__), add_help=False)
group_u = parser.add_argument_group("updating repositories") group_u = parser.add_argument_group("updating repositories")
group_b = parser.add_argument_group("bookmarking") group_b = parser.add_argument_group("bookmarking")
group_m = parser.add_argument_group("miscellaneous") group_m = parser.add_argument_group("miscellaneous")
group_u.add_argument('directories_to_update', nargs="*", metavar="path", group_u.add_argument('directories_to_update', nargs="*", metavar="path",
help="""update all projects in this directory (or the directory
itself, if it is a project)""")
help="""update all repositories in this directory (or the directory
itself, if it is a repo)""")
group_u.add_argument('-u', '--update', action="store_true", help="""update group_u.add_argument('-u', '--update', action="store_true", help="""update
all bookmarks (default behavior when called without arguments)""") all bookmarks (default behavior when called without arguments)""")


+ 2
- 2
setup.py View File

@@ -12,7 +12,7 @@ if os.path.exists("gitup"):
else: else:
os.rename("gitup.py", "gitup") os.rename("gitup.py", "gitup")


desc = "Easily and intelligently pull to multiple git projects at once."
desc = "Easily pull to multiple git repositories at once."


with open('README.md') as file: with open('README.md') as file:
long_desc = file.read() long_desc = file.read()
@@ -27,7 +27,7 @@ try:
description = desc, description = desc,
long_description = long_desc, long_description = long_desc,
license = "MIT License", license = "MIT License",
keywords = "git project repository pull update",
keywords = "git repository pull update",
url = "http://github.com/earwig/git-repo-updater", url = "http://github.com/earwig/git-repo-updater",
classifiers = ["Environment :: Console", classifiers = ["Environment :: Console",
"Intended Audience :: Developers", "Intended Audience :: Developers",


Loading…
Cancel
Save