2
0
mirror of https://github.com/frappe/bench.git synced 2025-01-10 09:02:10 +00:00

[minor] get-app to check origin and upstream

This commit is contained in:
Rushabh Mehta 2016-06-13 18:04:54 +05:30
parent 4a9933f8ae
commit 253f72fba3
2 changed files with 12 additions and 3 deletions

View File

@ -103,15 +103,25 @@ def pull_all_apps(bench='.'):
for app in get_apps(bench=bench):
app_dir = get_repo_dir(app, bench=bench)
if os.path.exists(os.path.join(app_dir, '.git')):
contents = subprocess.check_output(['git', 'remote', '-v'], cwd=app_dir,
stderr=subprocess.STDOUT)
if 'upstream ' in contents:
remote = 'upstream'
else:
# get the first remote
remote = contents.splitlines()[0].split()[0]
logger.info('pulling {0}'.format(app))
exec_cmd("git pull {rebase} upstream {branch}".format(rebase=rebase, branch=get_current_branch(app, bench=bench)), cwd=app_dir)
exec_cmd("git pull {rebase} {remote} {branch}".format(rebase=rebase,
remote=remote, branch=get_current_branch(app, bench=bench)), cwd=app_dir)
exec_cmd('find . -name "*.pyc" -delete', cwd=app_dir)
def is_version_upgrade(app='frappe', bench='.', branch=None):
try:
fetch_upstream(app, bench=bench)
except CommandFailedError, e:
except CommandFailedError:
raise InvalidRemoteException("No remote named upstream for {0}".format(app))
upstream_version = get_upstream_version(app=app, branch=branch, bench=bench)

View File

@ -88,7 +88,6 @@ def exec_cmd(cmd, cwd='.'):
stderr = stdout = subprocess.PIPE
else:
stderr = stdout = None
p = subprocess.Popen(cmd, cwd=cwd, shell=True, stdout=stdout, stderr=stderr)
if async: