# HG changeset patch # User Ludovic Chabant # Date 1651701828 25200 # Node ID fc35cae2fb524bc05f75576742ed9e4569c271f3 # Parent b8eeae888aab2596b23564efc585d83bbe53f1fd Support other branches than master for git repos diff -r b8eeae888aab -r fc35cae2fb52 install.cfg --- a/install.cfg Sun Nov 14 21:59:48 2021 -0800 +++ b/install.cfg Wed May 04 15:03:48 2022 -0700 @@ -1,5 +1,5 @@ [subrepos] -lib/fish/virtualfish = [git]https://github.com/justinmayer/virtualfish.git +lib/fish/virtualfish = [git:main]https://github.com/justinmayer/virtualfish.git lib/fzf = [git]https://github.com/junegunn/fzf.git diff -r b8eeae888aab -r fc35cae2fb52 install.py --- a/install.py Sun Nov 14 21:59:48 2021 -0800 +++ b/install.py Wed May 04 15:03:48 2022 -0700 @@ -1,5 +1,6 @@ import os import os.path +import re import sys import stat import shutil @@ -164,8 +165,8 @@ path = os.path.join(bundle_dir, name) if url.startswith('[local]'): pass - elif url.startswith('[git]'): - clone_git(url[len('[git]'):], path, force=force) + elif url.startswith('[git'): + clone_git(url, path, force=force) else: clone_hg(url, path, force=force) print() @@ -348,11 +349,19 @@ return True +re_git_url_prefix = re.compile(r'^\[git(\:(?P[^\]]+))?\](?P.*)$') + +# TODO: support for submodules def clone_git(url, path, force=False): + m = re_git_url_prefix.match(url) + if not m: + raise Exception("Not a git url: %s" % url) + url, branch = m.group('url'), (m.group('branch') or 'master') + if _is_non_empty_dir_with(path, '.git'): if not force: - print("git pull origin master %s" % path) - subprocess.check_call(['git', 'pull', 'origin', 'master'], + print("git pull origin %s %s" % (branch, path)) + subprocess.check_call(['git', 'pull', 'origin', branch], cwd=path) return else: @@ -390,8 +399,8 @@ for path, url in cfg.items('subrepos'): full_path = _p(path) - if url.startswith('[git]'): - clone_git(url[len('[git]'):], full_path, force=force) + if url.startswith('[git'): + clone_git(url, full_path, force=force) else: clone_hg(url, full_path, force=force) print() diff -r b8eeae888aab -r fc35cae2fb52 vim/local.pathogenrc --- a/vim/local.pathogenrc Sun Nov 14 21:59:48 2021 -0800 +++ b/vim/local.pathogenrc Wed May 04 15:03:48 2022 -0700 @@ -1,1 +1,2 @@ nogui:-* +-YouCompleteMe \ No newline at end of file