Commit b137a214 authored by Benjamin Blanc's avatar Benjamin Blanc

gitclone: Add new way to get revision information from [<name>-override] section.

Buildout remove parts when the configuration of the section has changed, by doing
its own uninstall (which remove parts), then it does a new install (instead of
doing an update, for example).
So, specifying a new revision makes buildout knowing a new section configuration,
and then removing the parts when we just wanted to update the code.
(This problem doesn't appear when a branch name is specified because section
configuration is not modified.)
So, this patch permits to the gitclone recipe to find the revision parameter
in an other section nammed [<name>-ovverride] where <name> is the name of the section calling the gitclone.
This, in order to do not remove parts each time revision has changed,
it acelerates considerably the execution time and bandwidth consumption
of the git operation.
parent d27df419
...@@ -120,14 +120,53 @@ def download_network_cached(path, name, revision, networkcache_options): ...@@ -120,14 +120,53 @@ def download_network_cached(path, name, revision, networkcache_options):
) )
class Recipe(object): class Recipe(object):
"""Clone a git repository.""" """Clone a git repository.
Input:
repository
Address of the remote repository.
git-executable
Path to the git executable to use.
revision (optional)
Revision to use.
branch (optional)
Branch to use.
location (optional)
Location
- In order to prevent buildout uninstalling, and re-installing parts
at each time revision input changes, you can use an additional
section to specifiy a revision. By inserting a new section in
your buildout configuration:
[<name>-override]
revision = <xxx>
Where <name> is the name the current section, and <xxx>
the revision to use.
- You cannot use the revision input and the additional
section descripted above at the same time.
- You can't specify a branch and a revision at the same time.
"""
def __init__(self, buildout, name, options): def __init__(self, buildout, name, options):
options.setdefault('location', options.setdefault('location',
os.path.join(buildout['buildout']['parts-directory'], name)) os.path.join(buildout['buildout']['parts-directory'], name))
self.repository = options.get('repository') self.repository = options.get('repository')
self.branch = options.get('branch', GIT_DEFAULT_BRANCH_NAME) self.branch = options.get('branch', GIT_DEFAULT_BRANCH_NAME)
# Get revision
self.revision = options.get('revision') self.revision = options.get('revision')
# Try to get revision in [<name>-override] section.
if buildout.get('%s-override' %name):
if buildout.get('%s-override' %name).get('revision'):
self.revision = buildout.get('%s-override' %name).get('revision')
self.git_command = options.get('git-executable', 'git') self.git_command = options.get('git-executable', 'git')
self.name = name self.name = name
self.location = options.get('location') self.location = options.get('location')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment