setup.py
author Laurent Charignon <lcharignon@fb.com>
Sat, 13 Jun 2015 11:14:07 -0700
changeset 1363 2eaa2943f9f3
parent 1355 5b66cff0e470
child 1451 73eb4f33f9dc
permissions -rw-r--r--
directaccess: use cached filteredrevs Before this patch we were calling directly repoview.computehidden(repo) to compute the revisions visible with direct access, without going through the caching mechanism for the filtered revisions. There was two issues with that: (1) Performance: We were not leverating the cached values of the 'visible' revs (2) Stability: If there were to be a cache inconsistency with the computation of 'visible' we would crash in the branchmap consistency check partial.validfor. Consider the scenario of rebase with bookmarks: - when we delete a bookmark on an obsolete changeset (like what rebase does when moving the bookmark after rebasing the changesets) - then this changes the value returned by repoview.computehidden(repo) as bookmarks are used as dynamic blockers in repoview.computehidden(repo) - as of now, we don't invalidate the cache in the case of bookmark change - if we have a cached value from before the bookmark change, repoview.filterrevs(repo, 'visible') considers the cached value correct and returns something different than repoview.computehidden(repo) - in turn, if we use repoview.computehidden(repo) in directaccess, the subset relationship is broken and the cache consistency assertion (parial.validfor) fails if branchmap.updatecache is called in this time window This patch leverages the caching infrastructure in place to speed up the computation of the filteredrevs for visible-directaccess-nowarn and visible-directaccess-warn. Incidentally it prevents the bug discussed in (2) from crashing when running a rebase with a bookmark. Note that there still needs to be a fix in core for the case discussed in (2). The test for this side of the fix (not core's fix for (2) is very hard to implement without introducing a lot of dependencies and does not belong here. It is much easier to have the test of the fix for the scenario (2) in core along with the fix.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     1
# Copied from histedit setup.py
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     2
# Credit to Augie Fackler <durin42@gmail.com>
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     3
1242
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
     4
import os
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
     5
from distutils.core import setup
1149
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
     6
from os.path import dirname, join
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
     7
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
     8
def get_version(relpath):
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
     9
    '''Read version info from a file without importing it'''
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
    10
    for line in open(join(dirname(__file__), relpath), 'rb'):
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
    11
        # Decode to a fail-safe string for PY3
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
    12
        # (gives unicode object in PY2)
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
    13
        line = line.decode('utf8')
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
    14
        if '__version__' in line:
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
    15
          if "'" in line:
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
    16
            return line.split("'")[1]
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    17
1242
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
    18
py_modules = [
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
    19
    'hgext.evolve',
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
    20
]
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
    21
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
    22
if os.environ.get('INCLUDE_INHIBIT'):
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
    23
    py_modules.append('hgext.inhibit')
1355
5b66cff0e470 evolve: add directaccess to the setup.py
Laurent Charignon <lcharignon@fb.com>
parents: 1242
diff changeset
    24
    py_modules.append('hgext.directaccess')
1242
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
    25
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    26
setup(
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    27
    name='hg-evolve',
1149
a206ee74f129 evolve: add various version info to save time on troubleshooting
anatoly techtonik <techtonik@gmail.com>
parents: 1138
diff changeset
    28
    version=get_version('hgext/evolve.py'),
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    29
    author='Pierre-Yves David',
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    30
    maintainer='Pierre-Yves David',
916
48e68d3b0144 fix maintainer email
Pierre-Yves David <pierre-yves.david@fb.com>
parents: 859
diff changeset
    31
    maintainer_email='pierre-yves.david@ens-lyon.org',
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    32
    url='https://bitbucket.org/marmoute/mutable-history',
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    33
    description='Flexible evolution of Mercurial history.',
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    34
    long_description=open('README').read(),
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    35
    keywords='hg mercurial',
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    36
    license='GPLv2+',
1242
cf846d47bb7e setup: allow including inhibit in the build
Durham Goode <durham@fb.com>
parents: 1149
diff changeset
    37
    py_modules=py_modules
496
d3d9df795b4d [pkg] Add a setup.py
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff changeset
    38
)