Commits

Kevin Bullock committed 72c0431

make installable using distutils

  • Participants
  • Parent commits 2e678f1

Comments (0)

Files changed (3)

committer.py

-# committer.py - record the committer of other people's patches
-#
-# Copyright 2011 Eric Eisner
-#
-# This software may be used and distributed according to the terms of the
-# GNU General Public License version 2, incorporated herein by reference.
-
-'''
-Add committer extra to your commits when the supplied user isn't you.
-
-
-To set another user as author with yourself as committer:
-
-  $ hg commit -u author
-
-To set an author without a committer:
-
-  $ HGUSER=user hg commit
-
-To set the committer and author explicitly:
-
-  $ HGUSER=committer hg commit -u author
-'''
-
-import os
-from mercurial import encoding, extensions, localrepo, revset, templatekw
-from mercurial.i18n import _
-
-def commit(orig, self, text="", user=None, date=None, match=None, force=False,
-           editor=False, extra={}):
-    # record the committer if the supplied user is different
-    committer = os.environ.get("HGUSER")
-    if committer is None:
-        committer = self.ui.config("ui", "username")
-        if committer is not None:
-            committer = os.path.expandvars(committer)
-    if committer is None:
-        committer = os.environ.get("EMAIL")
-
-    if committer and user and user != committer:
-        extra = dict(extra)
-        extra['committer'] = encoding.fromlocal(committer.strip())
-    return orig(self, text, user, date, match, force, editor, extra)
-
-def revsetcommitter(repo, subset, x):
-    """``committer([user])``
-    Changesets with committer [matching the given user].
-    """
-    if x is None:
-        query = ''
-    else:
-        query = revset.getstring(x, _('committer requires a string')).lower()
-    revs = []
-    for r in subset:
-        extra = repo[r].extra()
-        if 'committer' in extra and query in extra.get('committer').lower():
-            revs.append(r)
-    return revs
-
-def kwcommitter(repo, ctx, **args):
-    """:committer: String. The committer of the changeset if any."""
-    if 'committer' in ctx.extra():
-        return ctx.extra().get('committer')
-
-def extsetup(ui):
-    revset.symbols['committer'] = revsetcommitter
-    templatekw.keywords['committer'] = kwcommitter
-    extensions.wrapfunction(localrepo.localrepository, 'commit', commit)
+# committer.py - record the committer of other people's patches
+#
+# Copyright 2011 Eric Eisner
+#
+# This software may be used and distributed according to the terms of the
+# GNU General Public License version 2, incorporated herein by reference.
+
+'''
+Add committer extra to your commits when the supplied user isn't you.
+
+
+To set another user as author with yourself as committer:
+
+  $ hg commit -u author
+
+To set an author without a committer:
+
+  $ HGUSER=user hg commit
+
+To set the committer and author explicitly:
+
+  $ HGUSER=committer hg commit -u author
+'''
+
+import os
+from mercurial import encoding, extensions, localrepo, revset, templatekw
+from mercurial.i18n import _
+
+def commit(orig, self, text="", user=None, date=None, match=None, force=False,
+           editor=False, extra={}):
+    # record the committer if the supplied user is different
+    committer = os.environ.get("HGUSER")
+    if committer is None:
+        committer = self.ui.config("ui", "username")
+        if committer is not None:
+            committer = os.path.expandvars(committer)
+    if committer is None:
+        committer = os.environ.get("EMAIL")
+
+    if committer and user and user != committer:
+        extra = dict(extra)
+        extra['committer'] = encoding.fromlocal(committer.strip())
+    return orig(self, text, user, date, match, force, editor, extra)
+
+def revsetcommitter(repo, subset, x):
+    """``committer([user])``
+    Changesets with committer [matching the given user].
+    """
+    if x is None:
+        query = ''
+    else:
+        query = revset.getstring(x, _('committer requires a string')).lower()
+    revs = []
+    for r in subset:
+        extra = repo[r].extra()
+        if 'committer' in extra and query in extra.get('committer').lower():
+            revs.append(r)
+    return revs
+
+def kwcommitter(repo, ctx, **args):
+    """:committer: String. The committer of the changeset if any."""
+    if 'committer' in ctx.extra():
+        return ctx.extra().get('committer')
+
+def extsetup(ui):
+    revset.symbols['committer'] = revsetcommitter
+    templatekw.keywords['committer'] = kwcommitter
+    extensions.wrapfunction(localrepo.localrepository, 'commit', commit)
+from distutils.core import setup
+
+setup(
+    name='hg-prompt',
+    version='0.1.0',
+    author='Eric Eisner',
+    author_email='ede@mit.edu',
+    url='http://bitbucket.org/ede/committer/',
+    description="Mercurial extension to add a committer extra when you commit some else's patch.",
+    keywords='hg mercurial committer author',
+    py_modules=['hgcommitter']
+)