From a19e1a76ea99a7ecd240d573f8e693a91194523f Mon Sep 17 00:00:00 2001 From: d-dorazio Date: Sat, 16 Jul 2016 17:57:01 +0200 Subject: [PATCH] Open Source :) --- LICENSE | 21 +++++++++++++++++++++ README.md | 8 ++++---- git_externals/gittify.py | 20 +++++++------------- 3 files changed, 32 insertions(+), 17 deletions(-) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..16a07b6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Develer srl + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index ef0ce6b..7221ad3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ reason this script is not meant to be used with the old Windows XP. ## How to Install ```bash -$ pip install git+ssh://gitlab.com/develer/svn-migration-tools.git +$ pip install https://github.com/develersrl/git-externals/archive/master.zip ``` ## Gittify @@ -32,9 +32,9 @@ This script can work in 3 modes: Usage: ```bash -$ gittify -A authors-file.txt file:///var/lib/svn/foo file:///var/lib/svn/bar &> clone_log -$ gittify -A authors-file.txt --fetch &> fetch_log -$ gittify --finalize --git-server=https://git.foo.com/ &> conversion_log +$ gittify -A authors-file.txt clone file:///var/lib/svn/foo file:///var/lib/svn/bar +$ gittify -A authors-file.txt fetch +$ gittify finalize --git-server=https://git.foo.com/ ``` However ```gittify --help``` is useful as well. diff --git a/git_externals/gittify.py b/git_externals/gittify.py index 0b4929a..6b1b22b 100755 --- a/git_externals/gittify.py +++ b/git_externals/gittify.py @@ -547,9 +547,14 @@ def check_call(command): @click.option('--externals-filename', default='git_externals.json') @click.option('--mismatched-refs-filename', default='mismatched_ext.json') @click.option('--dry-run', is_flag=True) +@click.option('--git-server', default=None) @click.pass_context def finalize(ctx, root, path, ignore_not_found, externals_filename, mismatched_refs_filename, - dry_run, git=git, checkout=checkout, check_call=check_call): + dry_run, git_server, git=git, checkout=checkout, check_call=check_call): + + if git_server is None: + error('git-server is required') + gitsvn_repo = ctx.obj['gitsvn_dir'] / (path + GITSVN_EXT) git_repo = ctx.obj['finalize_dir'] / (path + GIT_EXT) info('Finalize {}'.format(git_repo)) @@ -568,21 +573,10 @@ def add_ignores(*args): config = {'super_repos': ['packages/', 'vendor/'], 'svn_server': root, - 'git_server': 'foo', + 'git_server': git_server, 'basedir': str(ctx.obj['gitsvn_dir']), } - def prefix(config, path): - if path.startswith('/packages/'): - git_server = 'packages/' - elif path.startswith('/vendor/'): - git_server = 'vendor/' - else: - git_server = 'foo' - config = dict(config) - config['git_server'] = git_server - return config - def add_ignores(git_ignore): with open('.gitignore', 'wt') as fp: fp.write(git_ignore)