2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-14 09:14:04 +00:00

Fix remote.upstream.fetch if --branch was used to get-app

This commit is contained in:
Pratik Vyas 2015-05-06 10:55:53 +05:30
parent e5088d28b6
commit c2acc81cd4

View File

@ -151,7 +151,10 @@ def switch_branch(branch, apps=None, bench='.', upgrade=False):
for app in apps:
app_dir = os.path.join(apps_dir, app)
if os.path.exists(app_dir):
exec_cmd("git fetch upstream", cwd=app_dir)
unshallow = "--unshallow" if os.path.exists(os.path.join(app_dir, ".git", "shallow")) else ""
exec_cmd("git config --unset-all remote.upstream.fetch", cwd=app_dir)
exec_cmd("git config --add remote.upstream.fetch '+refs/heads/*:refs/remotes/upstream/*'", cwd=app_dir)
exec_cmd("git fetch upstream {unshallow}".format(unshallow=unshallow), cwd=app_dir)
exec_cmd("git checkout {branch}".format(branch=branch), cwd=app_dir)
exec_cmd("git merge upstream/{branch}".format(branch=branch), cwd=app_dir)