--- a/hggravatar.py Thu Dec 20 01:21:31 2018 -0600
+++ b/hggravatar.py Thu Dec 20 01:44:41 2018 -0600
@@ -5,6 +5,7 @@
from mercurial.i18n import _
@@ -16,6 +17,8 @@
from mercurial.utils import stringutil
+_CACHE_DIR = '.hg/cache/gravatar' urlencode = urlreq.urlencode
@@ -42,13 +45,15 @@
# we handle everything in the callback closure so nothing to do here
+ path = os.path.join(repo.root, _CACHE_DIR) - os.makedirs(opts.get('output'))
if err.errno != errno.EEXIST:
- map_file = os.path.join(opts.get('output'), 'author_map')
+ map_file = os.path.join(path, 'author_map') with open(map_file, 'w') as ofp:
json.dump(authors, ofp, indent=2)
@@ -94,7 +99,7 @@
- with open(os.path.join(opts.get('output'), filename), 'w') as ofp:
+ with open(os.path.join(repo.root, _CACHE_DIR, filename), 'w') as ofp: @@ -125,7 +130,6 @@
- ('o', 'output', '.hg/cache/gravatar/', _('output directory'), _('DIR')),
('r', 'rating', '', _('rating'), _('RATING')),
('s', 'size', '', _('size'), _('SIZE')),
('t', 'theme', '', _('theme'), _('THEME')),