Skip to content

Commit 31d7486

Browse files
committed
Merge branch 'develop' (release/0.5)
2 parents 366b7ce + ba5eec6 commit 31d7486

File tree

8 files changed

+160
-88
lines changed

8 files changed

+160
-88
lines changed

CHANGELOG

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
v0.5 (released August 28, 2018):
2+
3+
- Added a `--depth` flag to control recursion depth when searching for
4+
repositories inside of subdirectories. For example:
5+
- `--depth 0` will never recurse into subdirectories; the provided paths must
6+
be repositories by themselves.
7+
- `--depth 1` will descend one level to look for repositories. This is the
8+
old behavior.
9+
- `--depth 3` will look three levels deep. This is the new default.
10+
- `--depth -1` will recurse indefinitely. This is not recommended.
11+
- Allow gitup to be run directly as a Python module (python -m gitup).
12+
- Fixed an error when updating branches if the upstream is completely unrelated
13+
from the local branch (no common ancestor).
14+
- Fixed error message when fetching from a remote fails.
15+
116
v0.4.1 (released December 13, 2017):
217

318
- Bump dependencies to deal with newer versions of Git.
@@ -13,7 +28,7 @@ v0.4 (released January 17, 2017):
1328
- Cleaned up the bookmark file format, fixing a related Windows bug. The script
1429
will automatically migrate to the new one.
1530
- Fixed a bug related to Python 3 compatibility.
16-
- Fixed unicode support.
31+
- Fixed Unicode support.
1732

1833
v0.3 (released June 7, 2015):
1934

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2011-2017 Ben Kurtovic <[email protected]>
1+
Copyright (C) 2011-2018 Ben Kurtovic <[email protected]>
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
__gitup__ (the _git-repo-updater_)
22

3-
gitup is a tool designed to update a large number of git repositories at once.
4-
It is smart enough to handle multiple remotes, branches, dirty working
5-
directories, and more, hopefully providing a great way to get everything
6-
up-to-date for short periods of internet access between long periods of none.
3+
gitup is a tool for updating multiple git repositories at once. It is smart
4+
enough to handle several remotes, dirty working directories, diverged local
5+
branches, detached HEADs, and more. It was originally created to manage a large
6+
collection of projects and deal with sporadic internet access.
77

88
gitup should work on OS X, Linux, and Windows. You should have the latest
99
version of git and either Python 2.7 or Python 3 installed.
@@ -25,7 +25,7 @@ Then, to install for everyone:
2525

2626
sudo python setup.py install
2727

28-
...or for just yourself (make sure you have `~/.local/bin` in your PATH):
28+
or for just yourself (make sure you have `~/.local/bin` in your PATH):
2929

3030
python setup.py install --user
3131

@@ -53,7 +53,7 @@ Additionally, you can just type:
5353

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

56-
To add a bookmark (or bookmarks), either of these will work:
56+
To add bookmarks, either of these will work:
5757

5858
gitup --add ~/repos/foo ~/repos/bar ~/repos/baz
5959
gitup --add ~/repos
@@ -81,21 +81,25 @@ Update all git repositories in your current directory:
8181

8282
gitup .
8383

84+
You can control how deep gitup will look for repositories in a given directory,
85+
if that directory is not a git repo by itself, with the `--depth` (or `-t`)
86+
option. `--depth 0` will disable recursion entirely, meaning the provided paths
87+
must be repos by themselves. `--depth 1` will descend one level (this is the
88+
old behavior from pre-0.5 gitup). `--depth -1` will recurse indefinitely,
89+
which is not recommended. The default is `--depth 3`.
90+
8491
By default, gitup will fetch all remotes in a repository. Pass `--current-only`
85-
(or `-c`) to make it fetch _only_ the remote tracked by the current branch.
92+
(or `-c`) to make it fetch only the remote tracked by the current branch.
8693

8794
Also by default, gitup will try to fast-forward all branches that have
8895
upstreams configured. It will always skip branches where this is not possible
8996
(e.g. dirty working directory or a merge/rebase is required). Pass
90-
`--fetch-only` (or `-f`) to only fetch remotes.
97+
`--fetch-only` (or `-f`) to skip this step and only fetch remotes.
9198

9299
After fetching, gitup will _keep_ remote-tracking branches that no longer exist
93100
upstream. Pass `--prune` (or `-p`) to delete them, or set `fetch.prune` or
94-
`remote.<name>.prune` in git config to do this by default.
101+
`remote.<name>.prune` in your git config to do this by default.
95102

96103
For a full list of all command arguments and abbreviations:
97104

98105
gitup --help
99-
100-
Finally, all paths can be either absolute (e.g. `/path/to/repo`) or relative
101-
(e.g. `../my/repo`).

gitup/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright (C) 2011-2017 Ben Kurtovic <[email protected]>
3+
# Copyright (C) 2011-2018 Ben Kurtovic <[email protected]>
44
# Released under the terms of the MIT License. See LICENSE for details.
55

66
"""
77
gitup: the git repository updater
88
"""
99

1010
__author__ = "Ben Kurtovic"
11-
__copyright__ = "Copyright (C) 2011-2017 Ben Kurtovic"
11+
__copyright__ = "Copyright (C) 2011-2018 Ben Kurtovic"
1212
__license__ = "MIT License"
13-
__version__ = "0.4.1"
13+
__version__ = "0.5"
1414
__email__ = "[email protected]"

gitup/__main__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright (C) 2011-2018 Ben Kurtovic <[email protected]>
4+
# Released under the terms of the MIT License. See LICENSE for details.
5+
6+
from .script import run
7+
8+
if __name__ == "__main__":
9+
run()

gitup/script.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# -*- coding: utf-8 -*-
22
#
3-
# Copyright (C) 2011-2016 Ben Kurtovic <[email protected]>
3+
# Copyright (C) 2011-2018 Ben Kurtovic <[email protected]>
44
# Released under the terms of the MIT License. See LICENSE for details.
55

66
from __future__ import print_function
77

88
import argparse
99
import os
10+
import platform
1011
import sys
1112

1213
from colorama import init as color_init, Fore, Style
@@ -39,11 +40,15 @@ def main():
3940

4041
group_u.add_argument(
4142
'directories_to_update', nargs="*", metavar="path", type=_decode,
42-
help="""update all repositories in this directory (or the directory
43-
itself, if it is a repo)""")
43+
help="""update this repository, or all repositories it contains
44+
(if not a repo directly)""")
4445
group_u.add_argument(
4546
'-u', '--update', action="store_true", help="""update all bookmarks
4647
(default behavior when called without arguments)""")
48+
group_u.add_argument(
49+
'-t', '--depth', dest="max_depth", metavar="n", type=int, default=3,
50+
help="""max recursion depth when searching for repos in subdirectories
51+
(default: 3; use 0 for no recursion, or -1 for unlimited)""")
4752
group_u.add_argument(
4853
'-c', '--current-only', action="store_true", help="""only fetch the
4954
remote tracked by the current branch instead of all remotes""")
@@ -80,7 +85,8 @@ def main():
8085
'-h', '--help', action="help", help="show this help message and exit")
8186
group_m.add_argument(
8287
'-v', '--version', action="version",
83-
version="gitup " + __version__)
88+
version="gitup {0} (Python {1})".format(
89+
__version__, platform.python_version()))
8490

8591
# TODO: deprecated arguments, for removal in v1.0:
8692
parser.add_argument(
@@ -90,7 +96,6 @@ def main():
9096

9197
color_init(autoreset=True)
9298
args = parser.parse_args()
93-
update_args = args.current_only, args.fetch_only, args.prune
9499

95100
print(Style.BRIGHT + "gitup" + Style.RESET_ALL + ": the git-repo-updater")
96101
print()
@@ -121,15 +126,15 @@ def main():
121126

122127
if args.command:
123128
if args.directories_to_update:
124-
run_command(args.directories_to_update, args.command)
129+
run_command(args.directories_to_update, args)
125130
if args.update or not args.directories_to_update:
126-
run_command(get_bookmarks(args.bookmark_file), args.command)
131+
run_command(get_bookmarks(args.bookmark_file), args)
127132
else:
128133
if args.directories_to_update:
129-
update_directories(args.directories_to_update, update_args)
134+
update_directories(args.directories_to_update, args)
130135
acted = True
131136
if args.update or not acted:
132-
update_bookmarks(get_bookmarks(args.bookmark_file), update_args)
137+
update_bookmarks(get_bookmarks(args.bookmark_file), args)
133138

134139
def run():
135140
"""Thin wrapper for main() that catches KeyboardInterrupts."""

0 commit comments

Comments
 (0)