aboutsummaryrefslogtreecommitdiff
path: root/egg-author.py
diff options
context:
space:
mode:
Diffstat (limited to 'egg-author.py')
-rw-r--r--egg-author.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/egg-author.py b/egg-author.py
index ddeeb54..297bc04 100644
--- a/egg-author.py
+++ b/egg-author.py
@@ -6,15 +6,17 @@
# [extensions]
# egg-author=~/.hg/egg-author.py
#
+# If you don't want automatic updates of your .meta-files, you can turn
+# it off by putting this in ~/.hg or in the repository-specific .hg/hgrc file:
+#
+# [egg-author]
+# update-meta=False
+#
# This silly file may be used and distributed according to the terms of
# the GNU General Public License, version 2 or later "(at your option)".
#
# See http://mercurial.selenic.com/wiki/License for more info, including
# a link to the license text.
-#
-# TODO: Add automatic meta-file updates when tagging tip? Or perhaps
-# based on a repo-specific setting, since people using the tarball method
-# might not want their meta-files cluttered with long lists of files...
'''Tools to help make egg authors' lives easier'''
@@ -71,11 +73,26 @@ def eggtag(ui, repo, name1, *names, **opts):
allnames = [t.strip() for t in (name1,) + names]
release_info_file = _find_egg_info_file(repo, 'release-info')
+
+ # Duplicate check in tag() to prevent meta-file from getting updated
+ # while tagging might fail afterwards
+ for n in allnames:
+ if n in repo.tags():
+ raise util.Abort('Release %s already exists!' % n)
+
+ if ui.configbool('egg-author', 'update-meta', default=True):
+ meta_message = 'Updated meta-file for release %s' % (', '.join(allnames))
+ meta_file = _find_egg_info_file(repo, 'meta')
+ update_meta(ui, repo)
+ m = matchmod.exact(repo.root, '', [meta_file])
+ repo.commit(text=meta_message, user=opts.get('user'), date=opts.get('date'), match=m)
+
fp = repo.wfile(release_info_file, 'r+')
commands.tag(ui, repo, name1, *names, **opts)
+ ui.status(_('Tagged %s\n') % (', '.join(allnames)))
# if hg's original tag command succeeded, we can do our stuff
- relinfo_message = ('Updated release-info file for release tag %s' % (', '.join(allnames)))
+ relinfo_message = 'Updated release-info file for release tag %s' % (', '.join(allnames))
fp.seek(0, 2) # to the end
for n in allnames:
fp.write("(release %s)\n" % _to_scheme_string(n))
@@ -83,6 +100,7 @@ def eggtag(ui, repo, name1, *names, **opts):
m = matchmod.exact(repo.root, '', [release_info_file])
repo.commit(text=relinfo_message, user=opts.get('user'), date=opts.get('date'), match=m)
+ ui.status(_('Updated and committed release-info %s\n') % (', '.join(allnames)))
def read_byte(f,res):
byte = f.read(1)