view setup.py @ 123:cdde1656346f

client: add 'hidden' property to show hidden changesets. This enables interactions with the obsolete changesets in the repository: - add the attribute in client class - add the keyword to the relevant commands - enable log without hidden changesets even when self.hidden is True - add a few tests with the hidden keyword This changeset mirrors the behavior of the mercurial global command --hidden: an attribute is added to the client library. If set at True, adds the hidden keyword to all command which can use it to show hidden changesets. The alternative would be to add the keyword in rawcommand, but the hidden flag is not relevant for commands such as add or branch.
author Paul Tonelli <paul.tonelli@logilab.fr>
date Thu, 22 May 2014 15:23:12 +0200
parents 009e7858a93b
children 1b47146a4a2c
line wrap: on
line source

import os, time
from distutils.core import setup

# query Mercurial for version number
version = 'unknown'
if os.path.isdir('.hg'):
    cmd = "hg id -i -t"
    l = os.popen(cmd).read().split()
    while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
        l.pop()
    if len(l) > 1: # tag found
        version = l[-1]
        if l[0].endswith('+'): # propagate the dirty status to the tag
            version += '+'
    elif len(l) == 1: # no tag found
        cmd = 'hg parents --template "{latesttag}+{latesttagdistance}-"'
        version = os.popen(cmd).read() + l[0]
    if version.endswith('+'):
        version += time.strftime('%Y%m%d')
elif os.path.exists('.hg_archival.txt'):
    kw = dict([[t.strip() for t in l.split(':', 1)]
               for l in open('.hg_archival.txt')])
    if 'tag' in kw:
        version =  kw['tag']
    elif 'latesttag' in kw:
        version = '%(latesttag)s+%(latesttagdistance)s-%(node).12s' % kw
    else:
        version = kw.get('node', '')[:12]

setup(
    name='python-hglib',
    version=version,
    author='Idan Kamara',
    author_email='idankk86@gmail.com',
    url='http://selenic.com/repo/python-hglib',
    description='Mercurial Python library',
    long_description=open(os.path.join(os.path.dirname(__file__), 'README')).read(),
    license='MIT',
    packages=['hglib'])