From cbb84c82e119e3e77a418e3542b0c7646b789f89 Mon Sep 17 00:00:00 2001 From: Marcin Nowicki Date: Fri, 22 May 2015 12:14:08 +0200 Subject: [PATCH 1/6] Add installation instructions for homebrew. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index a6f6cdf..8a1d258 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,10 @@ directory where Python is installed: DOSKEY gitup=c:\python27\python.exe c:\python27\Scripts\gitup $* +# Homebrew Installation + +`brew install pr0d1r2/contrib/gitup && brew link gitup` + # Usage There are two ways to update repos: you can pass them as command arguments, From e2c637774d73468778af9d42926ee6efd609b71b Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 22 May 2015 15:25:21 -0400 Subject: [PATCH 2/6] GitPython requirement to 1.0.1. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 04fc1dd..5bec3dd 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ setup( name = "gitup", packages = find_packages(), entry_points = {"console_scripts": ["gitup = gitup.script:run"]}, - install_requires = ["GitPython >= 0.3.6", "colorama >= 0.3.3"], + install_requires = ["GitPython >= 1.0.1", "colorama >= 0.3.3"], version = __version__, author = "Ben Kurtovic", author_email = "ben.kurtovic@gmail.com", From bc80ab6a3c458a6b62bc9688748eb01c9d3b8bd2 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 22 May 2015 15:29:46 -0400 Subject: [PATCH 3/6] Tweak README installation instructions. --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8a1d258..181be94 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,12 @@ version of git and at least Python 2.7 installed. # Installation +With [Homebrew](http://brew.sh/): + + `brew install pr0d1r2/contrib/gitup && brew link gitup` + +## From source + First: git clone git://github.com/earwig/git-repo-updater.git @@ -31,10 +37,6 @@ directory where Python is installed: DOSKEY gitup=c:\python27\python.exe c:\python27\Scripts\gitup $* -# Homebrew Installation - -`brew install pr0d1r2/contrib/gitup && brew link gitup` - # Usage There are two ways to update repos: you can pass them as command arguments, From 07c6e68b33d60854f97f39b266c18aee2a61bee4 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Fri, 22 May 2015 15:51:03 -0400 Subject: [PATCH 4/6] XDG Base Directory compliance (fixes #12) --- gitup/config.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/gitup/config.py b/gitup/config.py index 5571cfe..c0ed7ee 100644 --- a/gitup/config.py +++ b/gitup/config.py @@ -13,24 +13,31 @@ from colorama import Fore, Style __all__ = ["get_bookmarks", "add_bookmarks", "delete_bookmarks", "list_bookmarks"] -CONFIG_FILENAME = os.path.join(os.path.expanduser("~"), ".gitup") - YELLOW = Fore.YELLOW + Style.BRIGHT RED = Fore.RED + Style.BRIGHT INDENT1 = " " * 3 +def _get_config_path(): + """Return the path to the configuration file.""" + xdg_cfg = os.environ.get("XDG_CONFIG_HOME") or os.path.join("~", ".config") + return os.path.join(os.path.expanduser(xdg_cfg), "gitup", "config.ini") + def _load_config_file(): """Read the config file and return a SafeConfigParser() object.""" config = configparser.SafeConfigParser() # Don't lowercase option names, because we are storing paths there: config.optionxform = str - config.read(CONFIG_FILENAME) + config.read(_get_config_path()) return config def _save_config_file(config): - """Save config changes to the config file specified by CONFIG_FILENAME.""" - with open(CONFIG_FILENAME, "wb") as config_file: + """Save config changes to the config file returned by _get_config_path.""" + cfg_path = _get_config_path() + if not os.path.exists(os.path.dirname(cfg_path)): # Race condition, meh... + os.makedirs(os.path.dirname(cfg_path)) + + with open(cfg_path, "wb") as config_file: config.write(config_file) def get_bookmarks(): From 6e6db21533076fd4efe751c5f9f6e27309ff63a5 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 23 May 2015 03:03:01 -0400 Subject: [PATCH 5/6] Migrate old config files (#12) --- gitup/config.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/gitup/config.py b/gitup/config.py index c0ed7ee..59f3c68 100644 --- a/gitup/config.py +++ b/gitup/config.py @@ -18,13 +18,28 @@ RED = Fore.RED + Style.BRIGHT INDENT1 = " " * 3 +def _ensure_dirs(path): + """Ensure the directories within the given pathname exist.""" + dirname = os.path.dirname(path) + if not os.path.exists(dirname): # Race condition, meh... + os.makedirs(dirname) + def _get_config_path(): """Return the path to the configuration file.""" xdg_cfg = os.environ.get("XDG_CONFIG_HOME") or os.path.join("~", ".config") return os.path.join(os.path.expanduser(xdg_cfg), "gitup", "config.ini") +def _migrate_old_config_path(): + """Migrate the old config location (~/.gitup) to the new one.""" + old_path = os.path.expanduser(os.path.join("~", ".gitup")) + if os.path.exists(old_path): + new_path = _get_config_path() + _ensure_dirs(new_path) + os.rename(old_path, new_path) + def _load_config_file(): """Read the config file and return a SafeConfigParser() object.""" + _migrate_old_config_path() config = configparser.SafeConfigParser() # Don't lowercase option names, because we are storing paths there: config.optionxform = str @@ -33,10 +48,9 @@ def _load_config_file(): def _save_config_file(config): """Save config changes to the config file returned by _get_config_path.""" + _migrate_old_config_path() cfg_path = _get_config_path() - if not os.path.exists(os.path.dirname(cfg_path)): # Race condition, meh... - os.makedirs(os.path.dirname(cfg_path)) - + _ensure_dirs(cfg_path) with open(cfg_path, "wb") as config_file: config.write(config_file) From 79c1651489ddfe530ad9fc4145a44433030d7806 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sat, 23 May 2015 03:04:54 -0400 Subject: [PATCH 6/6] release/0.2.4 --- README.md | 2 +- gitup/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 181be94..05c345b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ version of git and at least Python 2.7 installed. With [Homebrew](http://brew.sh/): - `brew install pr0d1r2/contrib/gitup && brew link gitup` + brew install pr0d1r2/contrib/gitup && brew link gitup ## From source diff --git a/gitup/__init__.py b/gitup/__init__.py index ee669d8..48be6a3 100644 --- a/gitup/__init__.py +++ b/gitup/__init__.py @@ -10,5 +10,5 @@ gitup: the git repository updater __author__ = "Ben Kurtovic" __copyright__ = "Copyright (C) 2011-2014 Ben Kurtovic" __license__ = "MIT License" -__version__ = "0.2.3" +__version__ = "0.2.4" __email__ = "ben.kurtovic@gmail.com"