From: Markus Lehtonen Date: Mon, 9 Dec 2013 14:19:54 +0000 (+0200) Subject: export: determine remote repo name from git config X-Git-Tag: 0.21~26^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=92a29d392ce2334c5e0021b9c48be335723e7f3c;p=tools%2Fgbs.git export: determine remote repo name from git config Instead of trying to guess it from the remote tracking branch name which can be ambigous. Change-Id: I029c3fadb6f9ea63fa1c280e7183deba56c0e7ff Signed-off-by: Markus Lehtonen --- diff --git a/gitbuildsys/cmd_export.py b/gitbuildsys/cmd_export.py index e991a95..ef8725d 100644 --- a/gitbuildsys/cmd_export.py +++ b/gitbuildsys/cmd_export.py @@ -120,11 +120,16 @@ def create_gbp_export_args(repo, commit, export_dir, tmp_dir, spec, args, remotename = 'origin' if 'origin' in remotes else remotes.keys()[0] # Take the remote repo of current branch, if available try: - remote_branch = repo.get_upstream_branch(repo.branch) - if remote_branch: - remotename = remote_branch.split("/")[0] - except GitRepositoryError: + config_remote = repo.get_config('branch.%s.remote' % repo.branch) + except KeyError: pass + else: + if config_remote in remotes: + remotename = config_remote + elif config_remote != '.': + log.warning("You appear to have non-existent remote '%s' " + "configured for branch '%s'. Check your git config!" + % (config_remote, repo.branch)) reponame = urlparse(remotes[remotename][0]).path.lstrip('/') packaging_dir = get_packaging_dir(args)